@vlian/framework 1.2.61 → 1.2.62

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 (260) hide show
  1. package/dist/analytics.umd.js +1 -1
  2. package/dist/components/index.cjs +1 -1
  3. package/dist/components/index.d.ts +0 -4
  4. package/dist/components/index.js +1 -1
  5. package/dist/core-bak/Test.cjs +1 -0
  6. package/dist/core-bak/Test.d.ts +5 -0
  7. package/dist/core-bak/Test.js +1 -0
  8. package/dist/core-bak/app/AppContext.cjs +1 -0
  9. package/dist/core-bak/app/AppContext.d.ts +113 -0
  10. package/dist/core-bak/app/AppContext.js +1 -0
  11. package/dist/core-bak/app/AppContext.types.cjs +1 -0
  12. package/dist/core-bak/app/AppContext.types.d.ts +146 -0
  13. package/dist/core-bak/app/AppContext.types.js +1 -0
  14. package/dist/core-bak/app/BasicLayout.cjs +1 -0
  15. package/dist/core-bak/app/BasicLayout.d.ts +15 -0
  16. package/dist/core-bak/app/BasicLayout.js +1 -0
  17. package/dist/core-bak/app/DefaultApp.cjs +1 -0
  18. package/dist/core-bak/app/DefaultApp.d.ts +10 -0
  19. package/dist/core-bak/app/DefaultApp.js +1 -0
  20. package/dist/core-bak/app/index.cjs +1 -0
  21. package/dist/core-bak/app/index.d.ts +8 -0
  22. package/dist/core-bak/app/index.js +1 -0
  23. package/dist/core-bak/config/AppConfig.cjs +1 -0
  24. package/dist/core-bak/config/AppConfig.d.ts +88 -0
  25. package/dist/core-bak/config/AppConfig.js +1 -0
  26. package/dist/core-bak/config/ConfigLoader.cjs +1 -0
  27. package/dist/core-bak/config/ConfigLoader.d.ts +118 -0
  28. package/dist/core-bak/config/ConfigLoader.js +1 -0
  29. package/dist/core-bak/config/ConfigValidator.cjs +2 -0
  30. package/dist/core-bak/config/ConfigValidator.d.ts +84 -0
  31. package/dist/core-bak/config/ConfigValidator.js +2 -0
  32. package/dist/core-bak/config/index.cjs +1 -0
  33. package/dist/core-bak/config/index.d.ts +6 -0
  34. package/dist/core-bak/config/index.js +1 -0
  35. package/dist/core-bak/dev/DevTools.cjs +1 -0
  36. package/dist/core-bak/dev/DevTools.d.ts +16 -0
  37. package/dist/core-bak/dev/DevTools.js +1 -0
  38. package/dist/core-bak/error/ErrorBoundary.cjs +1 -0
  39. package/dist/core-bak/error/ErrorBoundary.d.ts +121 -0
  40. package/dist/core-bak/error/ErrorBoundary.js +1 -0
  41. package/dist/core-bak/error/ErrorHandler.cjs +1 -0
  42. package/dist/core-bak/error/ErrorHandler.d.ts +171 -0
  43. package/dist/core-bak/error/ErrorHandler.js +1 -0
  44. package/dist/core-bak/error/index.cjs +1 -0
  45. package/dist/core-bak/error/index.d.ts +7 -0
  46. package/dist/core-bak/error/index.js +1 -0
  47. package/dist/core-bak/event/AppEventBus.cjs +1 -0
  48. package/dist/core-bak/event/AppEventBus.d.ts +178 -0
  49. package/dist/core-bak/event/AppEventBus.js +1 -0
  50. package/dist/core-bak/event/frameworkEvents.cjs +1 -0
  51. package/dist/core-bak/event/frameworkEvents.d.ts +69 -0
  52. package/dist/core-bak/event/frameworkEvents.js +1 -0
  53. package/dist/core-bak/event/hooks.cjs +1 -0
  54. package/dist/core-bak/event/hooks.d.ts +57 -0
  55. package/dist/core-bak/event/hooks.js +1 -0
  56. package/dist/core-bak/event/index.cjs +1 -0
  57. package/dist/core-bak/event/index.d.ts +10 -0
  58. package/dist/core-bak/event/index.js +1 -0
  59. package/dist/core-bak/event/types.cjs +1 -0
  60. package/dist/core-bak/event/types.d.ts +269 -0
  61. package/dist/core-bak/event/types.js +1 -0
  62. package/dist/core-bak/event/useEventBus.cjs +1 -0
  63. package/dist/core-bak/event/useEventBus.d.ts +28 -0
  64. package/dist/core-bak/event/useEventBus.js +1 -0
  65. package/dist/core-bak/index.cjs +1 -0
  66. package/dist/core-bak/index.d.ts +54 -0
  67. package/dist/core-bak/index.js +1 -0
  68. package/dist/core-bak/initialization/InitializationErrorThrower.cjs +1 -0
  69. package/dist/core-bak/initialization/InitializationErrorThrower.d.ts +7 -0
  70. package/dist/core-bak/initialization/InitializationErrorThrower.js +1 -0
  71. package/dist/core-bak/initialization/index.cjs +1 -0
  72. package/dist/core-bak/initialization/index.d.ts +7 -0
  73. package/dist/core-bak/initialization/index.js +1 -0
  74. package/dist/core-bak/initialization/initialization.cjs +1 -0
  75. package/dist/core-bak/initialization/initialization.d.ts +69 -0
  76. package/dist/core-bak/initialization/initialization.js +1 -0
  77. package/dist/core-bak/initialization/initializationErrorState.cjs +1 -0
  78. package/dist/core-bak/initialization/initializationErrorState.d.ts +35 -0
  79. package/dist/core-bak/initialization/initializationErrorState.js +1 -0
  80. package/dist/core-bak/kernel/defaultAdapters.cjs +1 -0
  81. package/dist/core-bak/kernel/defaultAdapters.d.ts +2 -0
  82. package/dist/core-bak/kernel/defaultAdapters.js +1 -0
  83. package/dist/core-bak/kernel/errors.cjs +1 -0
  84. package/dist/core-bak/kernel/errors.d.ts +18 -0
  85. package/dist/core-bak/kernel/errors.js +1 -0
  86. package/dist/core-bak/kernel/index.cjs +1 -0
  87. package/dist/core-bak/kernel/index.d.ts +3 -0
  88. package/dist/core-bak/kernel/index.js +1 -0
  89. package/dist/core-bak/kernel/startKernel.cjs +1 -0
  90. package/dist/core-bak/kernel/startKernel.d.ts +2 -0
  91. package/dist/core-bak/kernel/startKernel.js +1 -0
  92. package/dist/core-bak/kernel/types.cjs +1 -0
  93. package/dist/core-bak/kernel/types.d.ts +114 -0
  94. package/dist/core-bak/kernel/types.js +1 -0
  95. package/dist/core-bak/middleware.cjs +1 -0
  96. package/dist/core-bak/middleware.d.ts +36 -0
  97. package/dist/core-bak/middleware.js +1 -0
  98. package/dist/core-bak/plugin/PluginEventBus.cjs +1 -0
  99. package/dist/core-bak/plugin/PluginEventBus.d.ts +169 -0
  100. package/dist/core-bak/plugin/PluginEventBus.js +1 -0
  101. package/dist/core-bak/plugin/PluginSandbox.cjs +1 -0
  102. package/dist/core-bak/plugin/PluginSandbox.d.ts +101 -0
  103. package/dist/core-bak/plugin/PluginSandbox.js +1 -0
  104. package/dist/core-bak/plugin.cjs +1 -0
  105. package/dist/core-bak/plugin.d.ts +224 -0
  106. package/dist/core-bak/plugin.js +1 -0
  107. package/dist/core-bak/router/RouterManager.cjs +1 -0
  108. package/dist/core-bak/router/RouterManager.d.ts +87 -0
  109. package/dist/core-bak/router/RouterManager.js +1 -0
  110. package/dist/core-bak/router/adapter/AdapterManager.cjs +1 -0
  111. package/dist/core-bak/router/adapter/AdapterManager.d.ts +94 -0
  112. package/dist/core-bak/router/adapter/AdapterManager.js +1 -0
  113. package/dist/core-bak/router/adapter/index.cjs +1 -0
  114. package/dist/core-bak/router/adapter/index.d.ts +6 -0
  115. package/dist/core-bak/router/adapter/index.js +1 -0
  116. package/dist/core-bak/router/adapter/react-router/ReactRouterAdapter.cjs +1 -0
  117. package/dist/core-bak/router/adapter/react-router/ReactRouterAdapter.d.ts +43 -0
  118. package/dist/core-bak/router/adapter/react-router/ReactRouterAdapter.js +1 -0
  119. package/dist/core-bak/router/adapter/react-router/index.cjs +1 -0
  120. package/dist/core-bak/router/adapter/react-router/index.d.ts +4 -0
  121. package/dist/core-bak/router/adapter/react-router/index.js +1 -0
  122. package/dist/core-bak/router/adapter/types.cjs +1 -0
  123. package/dist/core-bak/router/adapter/types.d.ts +111 -0
  124. package/dist/core-bak/router/adapter/types.js +1 -0
  125. package/dist/core-bak/router/dev/RouterDevTools.cjs +1 -0
  126. package/dist/core-bak/router/dev/RouterDevTools.d.ts +5 -0
  127. package/dist/core-bak/router/dev/RouterDevTools.js +1 -0
  128. package/dist/core-bak/router/dev/index.cjs +1 -0
  129. package/dist/core-bak/router/dev/index.d.ts +4 -0
  130. package/dist/core-bak/router/dev/index.js +1 -0
  131. package/dist/core-bak/router/dynamic/DynamicRouteManager.cjs +1 -0
  132. package/dist/core-bak/router/dynamic/DynamicRouteManager.d.ts +71 -0
  133. package/dist/core-bak/router/dynamic/DynamicRouteManager.js +1 -0
  134. package/dist/core-bak/router/dynamic/index.cjs +1 -0
  135. package/dist/core-bak/router/dynamic/index.d.ts +4 -0
  136. package/dist/core-bak/router/dynamic/index.js +1 -0
  137. package/dist/core-bak/router/errors/RouterError.cjs +1 -0
  138. package/dist/core-bak/router/errors/RouterError.d.ts +48 -0
  139. package/dist/core-bak/router/errors/RouterError.js +1 -0
  140. package/dist/core-bak/router/errors/index.cjs +1 -0
  141. package/dist/core-bak/router/errors/index.d.ts +4 -0
  142. package/dist/core-bak/router/errors/index.js +1 -0
  143. package/dist/core-bak/router/index.cjs +1 -0
  144. package/dist/core-bak/router/index.d.ts +16 -0
  145. package/dist/core-bak/router/index.js +1 -0
  146. package/dist/core-bak/router/lifecycle/RouterLifecycleManager.cjs +1 -0
  147. package/dist/core-bak/router/lifecycle/RouterLifecycleManager.d.ts +56 -0
  148. package/dist/core-bak/router/lifecycle/RouterLifecycleManager.js +1 -0
  149. package/dist/core-bak/router/lifecycle/index.cjs +1 -0
  150. package/dist/core-bak/router/lifecycle/index.d.ts +4 -0
  151. package/dist/core-bak/router/lifecycle/index.js +1 -0
  152. package/dist/core-bak/router/middleware/RouterMiddlewareManager.cjs +1 -0
  153. package/dist/core-bak/router/middleware/RouterMiddlewareManager.d.ts +61 -0
  154. package/dist/core-bak/router/middleware/RouterMiddlewareManager.js +1 -0
  155. package/dist/core-bak/router/middleware/auth.cjs +1 -0
  156. package/dist/core-bak/router/middleware/auth.d.ts +54 -0
  157. package/dist/core-bak/router/middleware/auth.js +1 -0
  158. package/dist/core-bak/router/middleware/index.cjs +1 -0
  159. package/dist/core-bak/router/middleware/index.d.ts +6 -0
  160. package/dist/core-bak/router/middleware/index.js +1 -0
  161. package/dist/core-bak/router/middleware/types.cjs +1 -0
  162. package/dist/core-bak/router/middleware/types.d.ts +82 -0
  163. package/dist/core-bak/router/middleware/types.js +1 -0
  164. package/dist/core-bak/router/monitoring/RouterMonitoring.cjs +1 -0
  165. package/dist/core-bak/router/monitoring/RouterMonitoring.d.ts +134 -0
  166. package/dist/core-bak/router/monitoring/RouterMonitoring.js +1 -0
  167. package/dist/core-bak/router/monitoring/index.cjs +1 -0
  168. package/dist/core-bak/router/monitoring/index.d.ts +4 -0
  169. package/dist/core-bak/router/monitoring/index.js +1 -0
  170. package/dist/core-bak/router/navigation/RouterNavigation.cjs +1 -0
  171. package/dist/core-bak/router/navigation/RouterNavigation.d.ts +43 -0
  172. package/dist/core-bak/router/navigation/RouterNavigation.js +1 -0
  173. package/dist/core-bak/router/navigation/index.cjs +1 -0
  174. package/dist/core-bak/router/navigation/index.d.ts +4 -0
  175. package/dist/core-bak/router/navigation/index.js +1 -0
  176. package/dist/core-bak/router/performance/RouteCache.cjs +1 -0
  177. package/dist/core-bak/router/performance/RouteCache.d.ts +113 -0
  178. package/dist/core-bak/router/performance/RouteCache.js +1 -0
  179. package/dist/core-bak/router/performance/RoutePreloader.cjs +1 -0
  180. package/dist/core-bak/router/performance/RoutePreloader.d.ts +111 -0
  181. package/dist/core-bak/router/performance/RoutePreloader.js +1 -0
  182. package/dist/core-bak/router/performance/index.cjs +1 -0
  183. package/dist/core-bak/router/performance/index.d.ts +5 -0
  184. package/dist/core-bak/router/performance/index.js +1 -0
  185. package/dist/core-bak/router/plugin/RouterPluginManager.cjs +1 -0
  186. package/dist/core-bak/router/plugin/RouterPluginManager.d.ts +74 -0
  187. package/dist/core-bak/router/plugin/RouterPluginManager.js +1 -0
  188. package/dist/core-bak/router/plugin/index.cjs +1 -0
  189. package/dist/core-bak/router/plugin/index.d.ts +5 -0
  190. package/dist/core-bak/router/plugin/index.js +1 -0
  191. package/dist/core-bak/router/plugin/types.cjs +1 -0
  192. package/dist/core-bak/router/plugin/types.d.ts +153 -0
  193. package/dist/core-bak/router/plugin/types.js +1 -0
  194. package/dist/core-bak/router/types.cjs +1 -0
  195. package/dist/core-bak/router/types.d.ts +464 -0
  196. package/dist/core-bak/router/types.js +1 -0
  197. package/dist/core-bak/router/utils/adapters/react-router/RouteErrorBoundary.cjs +1 -0
  198. package/dist/core-bak/router/utils/adapters/react-router/RouteErrorBoundary.d.ts +2 -0
  199. package/dist/core-bak/router/utils/adapters/react-router/RouteErrorBoundary.js +1 -0
  200. package/dist/core-bak/router/utils/adapters/react-router/transform.cjs +1 -0
  201. package/dist/core-bak/router/utils/adapters/react-router/transform.d.ts +5 -0
  202. package/dist/core-bak/router/utils/adapters/react-router/transform.js +1 -0
  203. package/dist/core-bak/router/utils/transform.cjs +1 -0
  204. package/dist/core-bak/router/utils/transform.d.ts +348 -0
  205. package/dist/core-bak/router/utils/transform.js +1 -0
  206. package/dist/core-bak/router/validation/RouterConfigValidator.cjs +2 -0
  207. package/dist/core-bak/router/validation/RouterConfigValidator.d.ts +121 -0
  208. package/dist/core-bak/router/validation/RouterConfigValidator.js +2 -0
  209. package/dist/core-bak/router/validation/index.cjs +1 -0
  210. package/dist/core-bak/router/validation/index.d.ts +5 -0
  211. package/dist/core-bak/router/validation/index.js +1 -0
  212. package/dist/core-bak/router/validation/schema.cjs +1 -0
  213. package/dist/core-bak/router/validation/schema.d.ts +180 -0
  214. package/dist/core-bak/router/validation/schema.js +1 -0
  215. package/dist/core-bak/router/version/RouteVersionManager.cjs +1 -0
  216. package/dist/core-bak/router/version/RouteVersionManager.d.ts +124 -0
  217. package/dist/core-bak/router/version/RouteVersionManager.js +1 -0
  218. package/dist/core-bak/router/version/index.cjs +1 -0
  219. package/dist/core-bak/router/version/index.d.ts +4 -0
  220. package/dist/core-bak/router/version/index.js +1 -0
  221. package/dist/core-bak/splash/SplashScreen.cjs +1 -0
  222. package/dist/core-bak/splash/SplashScreen.d.ts +14 -0
  223. package/dist/core-bak/splash/SplashScreen.js +1 -0
  224. package/dist/core-bak/splash/index.cjs +1 -0
  225. package/dist/core-bak/splash/index.d.ts +5 -0
  226. package/dist/core-bak/splash/index.js +1 -0
  227. package/dist/core-bak/splash/splashScreenUtils.cjs +1 -0
  228. package/dist/core-bak/splash/splashScreenUtils.d.ts +7 -0
  229. package/dist/core-bak/splash/splashScreenUtils.js +1 -0
  230. package/dist/core-bak/startup/AppInstance.cjs +1 -0
  231. package/dist/core-bak/startup/AppInstance.d.ts +138 -0
  232. package/dist/core-bak/startup/AppInstance.js +1 -0
  233. package/dist/core-bak/startup/environment.cjs +1 -0
  234. package/dist/core-bak/startup/environment.d.ts +87 -0
  235. package/dist/core-bak/startup/environment.js +1 -0
  236. package/dist/core-bak/startup/index.cjs +1 -0
  237. package/dist/core-bak/startup/index.d.ts +7 -0
  238. package/dist/core-bak/startup/index.js +1 -0
  239. package/dist/core-bak/startup/initializeServices.cjs +1 -0
  240. package/dist/core-bak/startup/initializeServices.d.ts +68 -0
  241. package/dist/core-bak/startup/initializeServices.js +1 -0
  242. package/dist/core-bak/startup/performanceTracker.cjs +1 -0
  243. package/dist/core-bak/startup/performanceTracker.d.ts +104 -0
  244. package/dist/core-bak/startup/performanceTracker.js +1 -0
  245. package/dist/core-bak/startup/renderApp.cjs +1 -0
  246. package/dist/core-bak/startup/renderApp.d.ts +70 -0
  247. package/dist/core-bak/startup/renderApp.js +1 -0
  248. package/dist/core-bak/startup/startApp.cjs +1 -0
  249. package/dist/core-bak/startup/startApp.d.ts +14 -0
  250. package/dist/core-bak/startup/startApp.js +1 -0
  251. package/dist/core-bak/types.cjs +1 -0
  252. package/dist/core-bak/types.d.ts +501 -0
  253. package/dist/core-bak/types.js +1 -0
  254. package/dist/index.cjs +1 -1
  255. package/dist/index.d.ts +0 -1
  256. package/dist/index.js +1 -1
  257. package/dist/index.umd.js +31 -246
  258. package/dist/kernel/types.d.ts +46 -3
  259. package/dist/state.umd.js +1 -1
  260. package/package.json +1 -11
@@ -0,0 +1,501 @@
1
+ import { LogLevel } from '@vlian/logger';
2
+ import type { LangType } from '../library/locale/types';
3
+ import { Container, RootOptions } from 'react-dom/client';
4
+ import { type ComponentType, type PropsWithChildren, type ReactElement, type ReactNode } from 'react';
5
+ import { type InitializationContext } from './initialization';
6
+ import type { StorageOptions } from '../types';
7
+ import type { ThemeConfig } from './app';
8
+ import type { FrameworkError } from '@vlian/utils';
9
+ import type { RouterConfig } from './router/types';
10
+ export type UIProviderConfig = Record<string, unknown>;
11
+ export type UIAppConfig = Record<string, unknown>;
12
+ export type GlobalProviderComponent = ComponentType<PropsWithChildren>;
13
+ export type GlobalProviderLoader = () => Promise<{
14
+ default: GlobalProviderComponent;
15
+ }>;
16
+ /**
17
+ * 生命周期钩子函数类型
18
+ */
19
+ export type ManagerLifecycle = {
20
+ /**
21
+ * 在初始化之前执行
22
+ */
23
+ beforeInitialization?: () => Promise<void> | void;
24
+ /**
25
+ * 初始化
26
+ */
27
+ initialization?: () => Promise<void> | void;
28
+ /**
29
+ * 在初始化之后执行
30
+ *
31
+ * @param context - 初始化上下文,包含配置、进度、耗时等信息
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * start({
36
+ * lifecycle: {
37
+ * afterInitialization: (context) => {
38
+ * console.log('初始化完成', context);
39
+ * },
40
+ * },
41
+ * });
42
+ * ```
43
+ */
44
+ afterInitialization?: (context: InitializationContext) => Promise<void> | void;
45
+ };
46
+ /**
47
+ * 启动配置选项
48
+ */
49
+ export interface StartOptions {
50
+ /**
51
+ * React 应用的挂载容器
52
+ *
53
+ * 用于指定 React 应用渲染的目标 DOM 元素。如果不提供,框架将自动查找页面中
54
+ * 的根元素(通常为 id="root" 的元素)作为默认容器。
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * import { start } from '@vlian/framework';
59
+ *
60
+ * // 使用默认容器(自动查找 id="root" 的元素)
61
+ * start({});
62
+ *
63
+ * // 指定自定义容器
64
+ * const container = document.getElementById('app');
65
+ * start({ container });
66
+ * ```
67
+ */
68
+ container?: Container;
69
+ /**
70
+ * React 根节点的配置选项
71
+ *
72
+ * 用于配置 React 18+ 的 createRoot 方法的选项,包括:
73
+ * - `onRecoverableError`: 错误恢复回调函数
74
+ * - `identifierPrefix`: 用于标识符前缀,用于服务端渲染的 hydration
75
+ *
76
+ * 这些选项将传递给 `react-dom/client` 的 `createRoot` 方法。
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * import { start } from '@vlian/framework';
81
+ *
82
+ * start({
83
+ * rootOptions: {
84
+ * onRecoverableError: (error) => {
85
+ * console.error('React 错误恢复:', error);
86
+ * },
87
+ * identifierPrefix: 'my-app-',
88
+ * },
89
+ * });
90
+ * ```
91
+ */
92
+ rootOptions?: RootOptions;
93
+ /**
94
+ * 应用根组件
95
+ *
96
+ * 用于指定要渲染的 React 应用根组件。
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * import { start } from '@vlian/framework';
101
+ * import App from './App';
102
+ *
103
+ * start({
104
+ * app: <App />,
105
+ * });
106
+ * ```
107
+ */
108
+ app?: ReactElement;
109
+ /**
110
+ * 是否显示启动页
111
+ * - 'auto': 自动判断(推荐)
112
+ * - 'always': 总是显示
113
+ * - 'never': 从不显示
114
+ * - 'first-time-only': 仅首次加载显示
115
+ *
116
+ * @default 'auto'
117
+ */
118
+ showSplashScreen?: 'auto' | 'always' | 'never' | 'first-time-only';
119
+ /**
120
+ * 启动页最小显示时间(毫秒)
121
+ *
122
+ * 用于避免启动页闪烁,确保用户能看到启动过程。
123
+ * 如果初始化完成时间小于此值,将等待至最小时间后再隐藏启动页。
124
+ *
125
+ * @default 500
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * start({
130
+ * minSplashScreenTime: 1000, // 至少显示 1 秒
131
+ * });
132
+ * ```
133
+ */
134
+ minSplashScreenTime?: number;
135
+ /**
136
+ * 路由配置
137
+ *
138
+ * 配置应用的路由系统,支持内置路由、自定义路由和禁用路由三种模式。
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * start({
143
+ * router: {
144
+ * enabled: true,
145
+ * routes: [
146
+ * {
147
+ * path: '/login',
148
+ * page: LoginPage,
149
+ * },
150
+ * {
151
+ * path: '/',
152
+ * layout: MainLayout,
153
+ * children: [
154
+ * {
155
+ * path: 'dashboard',
156
+ * page: DashboardPage,
157
+ * meta: { title: '仪表盘' },
158
+ * },
159
+ * ],
160
+ * },
161
+ * ],
162
+ * },
163
+ * });
164
+ * ```
165
+ */
166
+ router?: RouterConfig;
167
+ /**
168
+ * 日志级别
169
+ */
170
+ loggerLevel?: LogLevel;
171
+ /**
172
+ * 生命周期钩子
173
+ */
174
+ lifecycle?: ManagerLifecycle;
175
+ /**
176
+ * 国际化
177
+ */
178
+ locale?: Record<LangType, Record<string, unknown>>;
179
+ /**
180
+ * 启动页完成回调
181
+ * 仅在显示启动页时,启动页完成初始化后调用
182
+ * 可以在这里执行额外的操作,然后调用 complete() 继续
183
+ *
184
+ * @example
185
+ * ```typescript
186
+ * start({
187
+ * onSplashComplete: (complete, context) => {
188
+ * // 执行额外操作
189
+ * await doSomething();
190
+ * // 完成后继续
191
+ * complete();
192
+ * },
193
+ * });
194
+ * ```
195
+ */
196
+ onSplashComplete?: (complete: () => void, context: InitializationContext) => Promise<void> | void;
197
+ /**
198
+ * 存储配置
199
+ */
200
+ storageOptions?: StorageOptions;
201
+ /**
202
+ * IndexedDB 表名
203
+ */
204
+ indexedDBTableName?: string;
205
+ /**
206
+ * UI Provider 配置(框架无关)
207
+ * 可由 UI 适配器消费,适配到 antd/shadcn 等实现。
208
+ */
209
+ uiProvider?: UIProviderConfig;
210
+ /**
211
+ * UI App 基础配置(框架无关)
212
+ * 可用于通知、弹窗、消息容器等能力的统一注入。
213
+ */
214
+ uiApp?: UIAppConfig;
215
+ /**
216
+ * 全局 UI 包裹组件懒加载器
217
+ *
218
+ * 组件会在 BasicLayout 中统一包裹 children。
219
+ * 需返回带 default 导出的 React 组件模块。
220
+ *
221
+ * @example
222
+ * ```typescript
223
+ * start({
224
+ * globalProvider: () => import('./components/AntdGlobalProvider'),
225
+ * });
226
+ * ```
227
+ */
228
+ globalProvider?: GlobalProviderLoader;
229
+ /**
230
+ * @deprecated 使用 uiProvider 替代
231
+ */
232
+ antd?: Record<string, unknown>;
233
+ /**
234
+ * @deprecated 使用 uiApp 替代
235
+ */
236
+ antdApp?: Record<string, unknown>;
237
+ /**
238
+ * 主题配置
239
+ *
240
+ * @example
241
+ * ```typescript
242
+ * start({
243
+ * theme: {
244
+ * mode: 'dark',
245
+ * primaryColor: '#1890ff',
246
+ * },
247
+ * });
248
+ * ```
249
+ */
250
+ theme?: ThemeConfig;
251
+ /**
252
+ * 运行时安全配置
253
+ */
254
+ runtimeSecurity?: import('../utils/runtimeSecurity').RuntimeSecurityOptions;
255
+ /**
256
+ * 配置安全选项
257
+ */
258
+ configSecurity?: import('../utils/configSecurity').ConfigSecurityOptions;
259
+ /**
260
+ * 性能监控配置
261
+ */
262
+ performanceMonitor?: import('../utils/performance').PerformanceMonitorConfig;
263
+ /**
264
+ * 错误监控配置
265
+ */
266
+ errorMonitor?: import('@vlian/monitoring').ErrorMonitorConfig;
267
+ /**
268
+ * 分析服务配置
269
+ */
270
+ analytics?: import('../utils/analytics').AnalyticsConfig;
271
+ /**
272
+ * 状态管理器配置
273
+ *
274
+ * 配置框架的状态管理器,支持自定义适配器和作用域设置。
275
+ * 如果不提供,将使用默认配置创建状态管理器。
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * import { start } from '@vlian/framework';
280
+ *
281
+ * start({
282
+ * stateManager: {
283
+ * enableRegistry: true,
284
+ * defaultScope: 'app',
285
+ * devMode: true,
286
+ * },
287
+ * });
288
+ * ```
289
+ */
290
+ stateManager?: import('../state').StateManagerOptions;
291
+ /**
292
+ * 事件总线配置
293
+ *
294
+ * 配置应用级事件系统,支持事件追踪、性能监控、安全模式等。
295
+ * 如果不提供,将使用默认配置创建事件总线。
296
+ *
297
+ * @example
298
+ * ```typescript
299
+ * import { start } from '@vlian/framework';
300
+ *
301
+ * start({
302
+ * eventBus: {
303
+ * enableTracking: true,
304
+ * maxHistorySize: 200,
305
+ * enablePerformanceMonitoring: true,
306
+ * namespacePrefix: 'my-app:',
307
+ * },
308
+ * });
309
+ * ```
310
+ */
311
+ eventBus?: {
312
+ enableTracking?: boolean;
313
+ maxHistorySize?: number;
314
+ enableValidation?: boolean;
315
+ validator?: (event: string, data: unknown) => boolean;
316
+ enablePerformanceMonitoring?: boolean;
317
+ namespacePrefix?: string;
318
+ instanceId?: string;
319
+ enableSecurityMode?: boolean;
320
+ allowedSources?: string[];
321
+ };
322
+ /**
323
+ * 自定义启动屏组件
324
+ *
325
+ * 如果提供,将使用自定义组件替代默认的启动屏 UI。
326
+ * 自定义组件将接收初始化进度、当前步骤和初始化状态作为 props。
327
+ *
328
+ * @example
329
+ * ```typescript
330
+ * import { start } from '@vlian/framework';
331
+ *
332
+ * const CustomSplashScreen = ({ progress, currentStep, isInitializing }) => {
333
+ * return (
334
+ * <div>
335
+ * <h1>加载中...</h1>
336
+ * <div>进度: {progress}%</div>
337
+ * <div>步骤: {currentStep}</div>
338
+ * </div>
339
+ * );
340
+ * };
341
+ *
342
+ * start({
343
+ * splashScreen: CustomSplashScreen,
344
+ * });
345
+ * ```
346
+ */
347
+ splashScreen?: React.ComponentType<SplashScreenCustomProps>;
348
+ /**
349
+ * 自定义错误反馈组件
350
+ *
351
+ * 如果提供,将使用自定义的错误 UI 替代默认错误 UI。
352
+ * 自定义组件将接收错误对象和重置函数作为参数。
353
+ *
354
+ * @param error - 标准化后的框架错误对象
355
+ * @param resetError - 重置错误边界的函数,调用后可以尝试重新渲染子组件
356
+ * @returns 错误 UI 的 React 节点
357
+ *
358
+ * @example
359
+ * ```typescript
360
+ * import { start } from '@vlian/framework';
361
+ * start({
362
+ * errorFallback: (error, reset) => (
363
+ * <div>
364
+ * <h2>自定义错误标题</h2>
365
+ * <p>{error.message}</p>
366
+ * <button onClick={reset}>重试</button>
367
+ * </div>
368
+ * ),
369
+ * });
370
+ * ```
371
+ */
372
+ errorFallback?: (error: FrameworkError, resetError: () => void) => ReactNode;
373
+ /**
374
+ * 安全配置选项
375
+ *
376
+ * 用于配置框架的安全策略,包括 XSS 防护、配置验证等。
377
+ * 框架默认启用所有安全策略,确保应用安全。
378
+ *
379
+ * @example
380
+ * ```typescript
381
+ * start({
382
+ * security: {
383
+ * enableXSSProtection: true, // 默认启用
384
+ * validateConfig: true, // 默认启用
385
+ * sanitizeUserInput: true, // 默认启用
386
+ * },
387
+ * });
388
+ * ```
389
+ */
390
+ security?: {
391
+ /**
392
+ * 是否启用 XSS 防护
393
+ * @default true
394
+ */
395
+ enableXSSProtection?: boolean;
396
+ /**
397
+ * 是否验证配置项安全性
398
+ * @default true
399
+ */
400
+ validateConfig?: boolean;
401
+ /**
402
+ * 是否清理用户输入
403
+ * @default true
404
+ */
405
+ sanitizeUserInput?: boolean;
406
+ /**
407
+ * CSP(内容安全策略)配置
408
+ */
409
+ csp?: {
410
+ defaultSrc?: string[];
411
+ scriptSrc?: string[];
412
+ styleSrc?: string[];
413
+ imgSrc?: string[];
414
+ connectSrc?: string[];
415
+ fontSrc?: string[];
416
+ frameSrc?: string[];
417
+ allowUnsafeInline?: boolean;
418
+ allowUnsafeEval?: boolean;
419
+ };
420
+ /**
421
+ * CSRF 防护配置
422
+ */
423
+ csrf?: {
424
+ /**
425
+ * 是否启用 CSRF 防护
426
+ * @default true
427
+ */
428
+ enabled?: boolean;
429
+ /**
430
+ * CSRF Token 获取函数
431
+ * 如果不提供,框架会自动从 cookie 或 header 中获取
432
+ */
433
+ getToken?: () => string | Promise<string>;
434
+ /**
435
+ * CSRF Token 验证函数
436
+ * 如果不提供,框架会使用默认验证逻辑
437
+ */
438
+ validateToken?: (token: string) => boolean | Promise<boolean>;
439
+ /**
440
+ * CSRF Token 请求头名称
441
+ * @default 'X-CSRF-Token'
442
+ */
443
+ headerName?: string;
444
+ /**
445
+ * CSRF Token Cookie 名称
446
+ * @default 'csrf-token'
447
+ */
448
+ cookieName?: string;
449
+ };
450
+ };
451
+ /**
452
+ * 服务初始化重试配置
453
+ *
454
+ * 用于配置服务初始化失败时的重试策略。
455
+ *
456
+ * @example
457
+ * ```typescript
458
+ * start({
459
+ * serviceRetry: {
460
+ * maxRetries: 3,
461
+ * retryDelay: 1000,
462
+ * exponentialBackoff: true,
463
+ * },
464
+ * });
465
+ * ```
466
+ */
467
+ serviceRetry?: {
468
+ /**
469
+ * 最大重试次数
470
+ * @default 3
471
+ */
472
+ maxRetries?: number;
473
+ /**
474
+ * 重试延迟(毫秒)
475
+ * @default 1000
476
+ */
477
+ retryDelay?: number;
478
+ /**
479
+ * 是否启用指数退避
480
+ * @default true
481
+ */
482
+ exponentialBackoff?: boolean;
483
+ };
484
+ }
485
+ /**
486
+ * 自定义启动屏组件的 Props
487
+ */
488
+ export interface SplashScreenCustomProps {
489
+ /**
490
+ * 初始化进度(0-100)
491
+ */
492
+ progress: number;
493
+ /**
494
+ * 当前步骤描述
495
+ */
496
+ currentStep: string;
497
+ /**
498
+ * 是否正在初始化
499
+ */
500
+ isInitializing: boolean;
501
+ }
@@ -0,0 +1 @@
1
+ export{};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get $t(){return _library.$t},get Kernel(){return _kernel.Kernel},get getKernel(){return _kernel.getKernel},get kernelStartApp(){return _kernel.kernelStartApp},get setLang(){return _library.setLang},get setupI18n(){return _library.setupI18n},get startup(){return _kernel.startup}});const _library=require("./library");_export_star(require("./core"),exports);_export_star(require("./utils"),exports);_export_star(require("./state"),exports);_export_star(require("./components"),exports);const _kernel=require("./kernel");function _export_star(from,to){Object.keys(from).forEach(function(k){if(k!=="default"&&!Object.prototype.hasOwnProperty.call(to,k)){Object.defineProperty(to,k,{enumerable:true,get:function(){return from[k]}})}});return from}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:Object.getOwnPropertyDescriptor(all,name).get})}_export(exports,{get $t(){return _library.$t},get Kernel(){return _kernel.Kernel},get getKernel(){return _kernel.getKernel},get kernelStartApp(){return _kernel.kernelStartApp},get setLang(){return _library.setLang},get setupI18n(){return _library.setupI18n},get startup(){return _kernel.startup}});const _library=require("./library");_export_star(require("./utils"),exports);_export_star(require("./state"),exports);_export_star(require("./components"),exports);const _kernel=require("./kernel");function _export_star(from,to){Object.keys(from).forEach(function(k){if(k!=="default"&&!Object.prototype.hasOwnProperty.call(to,k)){Object.defineProperty(to,k,{enumerable:true,get:function(){return from[k]}})}});return from}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { setupI18n, setLang, $t } from './library';
2
- export * from './core';
3
2
  export * from './utils';
4
3
  export * from './state';
5
4
  export * from './components';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{setupI18n,setLang,$t}from"./library";export*from"./core";export*from"./utils";export*from"./state";export*from"./components";export{setupI18n,setLang,$t};export{Kernel,startup,getKernel,kernelStartApp}from"./kernel";
1
+ import{setupI18n,setLang,$t}from"./library";export*from"./utils";export*from"./state";export*from"./components";export{setupI18n,setLang,$t};export{Kernel,startup,getKernel,kernelStartApp}from"./kernel";