@vlian/framework 1.2.62 → 1.2.63
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/dist/analytics.umd.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/state.umd.js +1 -1
- package/package.json +21 -6
- package/dist/components/LocaleSwitch.cjs +0 -1
- package/dist/components/LocaleSwitch.d.ts +0 -21
- package/dist/components/LocaleSwitch.js +0 -1
- package/dist/components/ThemeSwitch.cjs +0 -1
- package/dist/components/ThemeSwitch.d.ts +0 -20
- package/dist/components/ThemeSwitch.js +0 -1
- package/dist/core/Test.cjs +0 -1
- package/dist/core/Test.d.ts +0 -5
- package/dist/core/Test.js +0 -1
- package/dist/core/app/AppContext.cjs +0 -1
- package/dist/core/app/AppContext.d.ts +0 -113
- package/dist/core/app/AppContext.js +0 -1
- package/dist/core/app/AppContext.types.cjs +0 -1
- package/dist/core/app/AppContext.types.d.ts +0 -146
- package/dist/core/app/AppContext.types.js +0 -1
- package/dist/core/app/BasicLayout.cjs +0 -1
- package/dist/core/app/BasicLayout.d.ts +0 -15
- package/dist/core/app/BasicLayout.js +0 -1
- package/dist/core/app/DefaultApp.cjs +0 -1
- package/dist/core/app/DefaultApp.d.ts +0 -10
- package/dist/core/app/DefaultApp.js +0 -1
- package/dist/core/app/index.cjs +0 -1
- package/dist/core/app/index.d.ts +0 -8
- package/dist/core/app/index.js +0 -1
- package/dist/core/config/AppConfig.cjs +0 -1
- package/dist/core/config/AppConfig.d.ts +0 -88
- package/dist/core/config/AppConfig.js +0 -1
- package/dist/core/config/ConfigLoader.cjs +0 -1
- package/dist/core/config/ConfigLoader.d.ts +0 -118
- package/dist/core/config/ConfigLoader.js +0 -1
- package/dist/core/config/ConfigValidator.cjs +0 -2
- package/dist/core/config/ConfigValidator.d.ts +0 -84
- package/dist/core/config/ConfigValidator.js +0 -2
- package/dist/core/config/index.cjs +0 -1
- package/dist/core/config/index.d.ts +0 -6
- package/dist/core/config/index.js +0 -1
- package/dist/core/dev/DevTools.cjs +0 -1
- package/dist/core/dev/DevTools.d.ts +0 -16
- package/dist/core/dev/DevTools.js +0 -1
- package/dist/core/error/ErrorBoundary.cjs +0 -1
- package/dist/core/error/ErrorBoundary.d.ts +0 -121
- package/dist/core/error/ErrorBoundary.js +0 -1
- package/dist/core/error/ErrorHandler.cjs +0 -1
- package/dist/core/error/ErrorHandler.d.ts +0 -171
- package/dist/core/error/ErrorHandler.js +0 -1
- package/dist/core/error/index.cjs +0 -1
- package/dist/core/error/index.d.ts +0 -7
- package/dist/core/error/index.js +0 -1
- package/dist/core/event/AppEventBus.cjs +0 -1
- package/dist/core/event/AppEventBus.d.ts +0 -178
- package/dist/core/event/AppEventBus.js +0 -1
- package/dist/core/event/frameworkEvents.cjs +0 -1
- package/dist/core/event/frameworkEvents.d.ts +0 -69
- package/dist/core/event/frameworkEvents.js +0 -1
- package/dist/core/event/hooks.cjs +0 -1
- package/dist/core/event/hooks.d.ts +0 -57
- package/dist/core/event/hooks.js +0 -1
- package/dist/core/event/index.cjs +0 -1
- package/dist/core/event/index.d.ts +0 -10
- package/dist/core/event/index.js +0 -1
- package/dist/core/event/types.cjs +0 -1
- package/dist/core/event/types.d.ts +0 -269
- package/dist/core/event/types.js +0 -1
- package/dist/core/event/useEventBus.cjs +0 -1
- package/dist/core/event/useEventBus.d.ts +0 -28
- package/dist/core/event/useEventBus.js +0 -1
- package/dist/core/index.cjs +0 -1
- package/dist/core/index.d.ts +0 -54
- package/dist/core/index.js +0 -1
- package/dist/core/initialization/InitializationErrorThrower.cjs +0 -1
- package/dist/core/initialization/InitializationErrorThrower.d.ts +0 -7
- package/dist/core/initialization/InitializationErrorThrower.js +0 -1
- package/dist/core/initialization/index.cjs +0 -1
- package/dist/core/initialization/index.d.ts +0 -7
- package/dist/core/initialization/index.js +0 -1
- package/dist/core/initialization/initialization.cjs +0 -1
- package/dist/core/initialization/initialization.d.ts +0 -69
- package/dist/core/initialization/initialization.js +0 -1
- package/dist/core/initialization/initializationErrorState.cjs +0 -1
- package/dist/core/initialization/initializationErrorState.d.ts +0 -35
- package/dist/core/initialization/initializationErrorState.js +0 -1
- package/dist/core/kernel/defaultAdapters.cjs +0 -1
- package/dist/core/kernel/defaultAdapters.d.ts +0 -2
- package/dist/core/kernel/defaultAdapters.js +0 -1
- package/dist/core/kernel/errors.cjs +0 -1
- package/dist/core/kernel/errors.d.ts +0 -18
- package/dist/core/kernel/errors.js +0 -1
- package/dist/core/kernel/index.cjs +0 -1
- package/dist/core/kernel/index.d.ts +0 -3
- package/dist/core/kernel/index.js +0 -1
- package/dist/core/kernel/startKernel.cjs +0 -1
- package/dist/core/kernel/startKernel.d.ts +0 -2
- package/dist/core/kernel/startKernel.js +0 -1
- package/dist/core/kernel/types.cjs +0 -1
- package/dist/core/kernel/types.d.ts +0 -114
- package/dist/core/kernel/types.js +0 -1
- package/dist/core/middleware.cjs +0 -1
- package/dist/core/middleware.d.ts +0 -36
- package/dist/core/middleware.js +0 -1
- package/dist/core/plugin/PluginEventBus.cjs +0 -1
- package/dist/core/plugin/PluginEventBus.d.ts +0 -169
- package/dist/core/plugin/PluginEventBus.js +0 -1
- package/dist/core/plugin/PluginSandbox.cjs +0 -1
- package/dist/core/plugin/PluginSandbox.d.ts +0 -101
- package/dist/core/plugin/PluginSandbox.js +0 -1
- package/dist/core/plugin.cjs +0 -1
- package/dist/core/plugin.d.ts +0 -224
- package/dist/core/plugin.js +0 -1
- package/dist/core/router/RouterManager.cjs +0 -1
- package/dist/core/router/RouterManager.d.ts +0 -87
- package/dist/core/router/RouterManager.js +0 -1
- package/dist/core/router/adapter/AdapterManager.cjs +0 -1
- package/dist/core/router/adapter/AdapterManager.d.ts +0 -94
- package/dist/core/router/adapter/AdapterManager.js +0 -1
- package/dist/core/router/adapter/index.cjs +0 -1
- package/dist/core/router/adapter/index.d.ts +0 -6
- package/dist/core/router/adapter/index.js +0 -1
- package/dist/core/router/adapter/react-router/ReactRouterAdapter.cjs +0 -1
- package/dist/core/router/adapter/react-router/ReactRouterAdapter.d.ts +0 -43
- package/dist/core/router/adapter/react-router/ReactRouterAdapter.js +0 -1
- package/dist/core/router/adapter/react-router/index.cjs +0 -1
- package/dist/core/router/adapter/react-router/index.d.ts +0 -4
- package/dist/core/router/adapter/react-router/index.js +0 -1
- package/dist/core/router/adapter/types.cjs +0 -1
- package/dist/core/router/adapter/types.d.ts +0 -111
- package/dist/core/router/adapter/types.js +0 -1
- package/dist/core/router/dev/RouterDevTools.cjs +0 -1
- package/dist/core/router/dev/RouterDevTools.d.ts +0 -5
- package/dist/core/router/dev/RouterDevTools.js +0 -1
- package/dist/core/router/dev/index.cjs +0 -1
- package/dist/core/router/dev/index.d.ts +0 -4
- package/dist/core/router/dev/index.js +0 -1
- package/dist/core/router/dynamic/DynamicRouteManager.cjs +0 -1
- package/dist/core/router/dynamic/DynamicRouteManager.d.ts +0 -71
- package/dist/core/router/dynamic/DynamicRouteManager.js +0 -1
- package/dist/core/router/dynamic/index.cjs +0 -1
- package/dist/core/router/dynamic/index.d.ts +0 -4
- package/dist/core/router/dynamic/index.js +0 -1
- package/dist/core/router/errors/RouterError.cjs +0 -1
- package/dist/core/router/errors/RouterError.d.ts +0 -48
- package/dist/core/router/errors/RouterError.js +0 -1
- package/dist/core/router/errors/index.cjs +0 -1
- package/dist/core/router/errors/index.d.ts +0 -4
- package/dist/core/router/errors/index.js +0 -1
- package/dist/core/router/index.cjs +0 -1
- package/dist/core/router/index.d.ts +0 -16
- package/dist/core/router/index.js +0 -1
- package/dist/core/router/lifecycle/RouterLifecycleManager.cjs +0 -1
- package/dist/core/router/lifecycle/RouterLifecycleManager.d.ts +0 -56
- package/dist/core/router/lifecycle/RouterLifecycleManager.js +0 -1
- package/dist/core/router/lifecycle/index.cjs +0 -1
- package/dist/core/router/lifecycle/index.d.ts +0 -4
- package/dist/core/router/lifecycle/index.js +0 -1
- package/dist/core/router/middleware/RouterMiddlewareManager.cjs +0 -1
- package/dist/core/router/middleware/RouterMiddlewareManager.d.ts +0 -61
- package/dist/core/router/middleware/RouterMiddlewareManager.js +0 -1
- package/dist/core/router/middleware/auth.cjs +0 -1
- package/dist/core/router/middleware/auth.d.ts +0 -54
- package/dist/core/router/middleware/auth.js +0 -1
- package/dist/core/router/middleware/index.cjs +0 -1
- package/dist/core/router/middleware/index.d.ts +0 -6
- package/dist/core/router/middleware/index.js +0 -1
- package/dist/core/router/middleware/types.cjs +0 -1
- package/dist/core/router/middleware/types.d.ts +0 -82
- package/dist/core/router/middleware/types.js +0 -1
- package/dist/core/router/monitoring/RouterMonitoring.cjs +0 -1
- package/dist/core/router/monitoring/RouterMonitoring.d.ts +0 -134
- package/dist/core/router/monitoring/RouterMonitoring.js +0 -1
- package/dist/core/router/monitoring/index.cjs +0 -1
- package/dist/core/router/monitoring/index.d.ts +0 -4
- package/dist/core/router/monitoring/index.js +0 -1
- package/dist/core/router/navigation/RouterNavigation.cjs +0 -1
- package/dist/core/router/navigation/RouterNavigation.d.ts +0 -43
- package/dist/core/router/navigation/RouterNavigation.js +0 -1
- package/dist/core/router/navigation/index.cjs +0 -1
- package/dist/core/router/navigation/index.d.ts +0 -4
- package/dist/core/router/navigation/index.js +0 -1
- package/dist/core/router/performance/RouteCache.cjs +0 -1
- package/dist/core/router/performance/RouteCache.d.ts +0 -113
- package/dist/core/router/performance/RouteCache.js +0 -1
- package/dist/core/router/performance/RoutePreloader.cjs +0 -1
- package/dist/core/router/performance/RoutePreloader.d.ts +0 -111
- package/dist/core/router/performance/RoutePreloader.js +0 -1
- package/dist/core/router/performance/index.cjs +0 -1
- package/dist/core/router/performance/index.d.ts +0 -5
- package/dist/core/router/performance/index.js +0 -1
- package/dist/core/router/plugin/RouterPluginManager.cjs +0 -1
- package/dist/core/router/plugin/RouterPluginManager.d.ts +0 -74
- package/dist/core/router/plugin/RouterPluginManager.js +0 -1
- package/dist/core/router/plugin/index.cjs +0 -1
- package/dist/core/router/plugin/index.d.ts +0 -5
- package/dist/core/router/plugin/index.js +0 -1
- package/dist/core/router/plugin/types.cjs +0 -1
- package/dist/core/router/plugin/types.d.ts +0 -153
- package/dist/core/router/plugin/types.js +0 -1
- package/dist/core/router/types.cjs +0 -1
- package/dist/core/router/types.d.ts +0 -464
- package/dist/core/router/types.js +0 -1
- package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.cjs +0 -1
- package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.d.ts +0 -2
- package/dist/core/router/utils/adapters/react-router/RouteErrorBoundary.js +0 -1
- package/dist/core/router/utils/adapters/react-router/transform.cjs +0 -1
- package/dist/core/router/utils/adapters/react-router/transform.d.ts +0 -5
- package/dist/core/router/utils/adapters/react-router/transform.js +0 -1
- package/dist/core/router/utils/transform.cjs +0 -1
- package/dist/core/router/utils/transform.d.ts +0 -348
- package/dist/core/router/utils/transform.js +0 -1
- package/dist/core/router/validation/RouterConfigValidator.cjs +0 -2
- package/dist/core/router/validation/RouterConfigValidator.d.ts +0 -121
- package/dist/core/router/validation/RouterConfigValidator.js +0 -2
- package/dist/core/router/validation/index.cjs +0 -1
- package/dist/core/router/validation/index.d.ts +0 -5
- package/dist/core/router/validation/index.js +0 -1
- package/dist/core/router/validation/schema.cjs +0 -1
- package/dist/core/router/validation/schema.d.ts +0 -180
- package/dist/core/router/validation/schema.js +0 -1
- package/dist/core/router/version/RouteVersionManager.cjs +0 -1
- package/dist/core/router/version/RouteVersionManager.d.ts +0 -124
- package/dist/core/router/version/RouteVersionManager.js +0 -1
- package/dist/core/router/version/index.cjs +0 -1
- package/dist/core/router/version/index.d.ts +0 -4
- package/dist/core/router/version/index.js +0 -1
- package/dist/core/splash/SplashScreen.cjs +0 -1
- package/dist/core/splash/SplashScreen.d.ts +0 -14
- package/dist/core/splash/SplashScreen.js +0 -1
- package/dist/core/splash/index.cjs +0 -1
- package/dist/core/splash/index.d.ts +0 -5
- package/dist/core/splash/index.js +0 -1
- package/dist/core/splash/splashScreenUtils.cjs +0 -1
- package/dist/core/splash/splashScreenUtils.d.ts +0 -7
- package/dist/core/splash/splashScreenUtils.js +0 -1
- package/dist/core/startup/AppInstance.cjs +0 -1
- package/dist/core/startup/AppInstance.d.ts +0 -138
- package/dist/core/startup/AppInstance.js +0 -1
- package/dist/core/startup/environment.cjs +0 -1
- package/dist/core/startup/environment.d.ts +0 -87
- package/dist/core/startup/environment.js +0 -1
- package/dist/core/startup/index.cjs +0 -1
- package/dist/core/startup/index.d.ts +0 -7
- package/dist/core/startup/index.js +0 -1
- package/dist/core/startup/initializeServices.cjs +0 -1
- package/dist/core/startup/initializeServices.d.ts +0 -68
- package/dist/core/startup/initializeServices.js +0 -1
- package/dist/core/startup/performanceTracker.cjs +0 -1
- package/dist/core/startup/performanceTracker.d.ts +0 -104
- package/dist/core/startup/performanceTracker.js +0 -1
- package/dist/core/startup/renderApp.cjs +0 -1
- package/dist/core/startup/renderApp.d.ts +0 -70
- package/dist/core/startup/renderApp.js +0 -1
- package/dist/core/startup/startApp.cjs +0 -1
- package/dist/core/startup/startApp.d.ts +0 -14
- package/dist/core/startup/startApp.js +0 -1
- package/dist/core/types.cjs +0 -1
- package/dist/core/types.d.ts +0 -501
- package/dist/core/types.js +0 -1
- package/dist/core-bak/Test.cjs +0 -1
- package/dist/core-bak/Test.d.ts +0 -5
- package/dist/core-bak/Test.js +0 -1
- package/dist/core-bak/app/AppContext.cjs +0 -1
- package/dist/core-bak/app/AppContext.d.ts +0 -113
- package/dist/core-bak/app/AppContext.js +0 -1
- package/dist/core-bak/app/AppContext.types.cjs +0 -1
- package/dist/core-bak/app/AppContext.types.d.ts +0 -146
- package/dist/core-bak/app/AppContext.types.js +0 -1
- package/dist/core-bak/app/BasicLayout.cjs +0 -1
- package/dist/core-bak/app/BasicLayout.d.ts +0 -15
- package/dist/core-bak/app/BasicLayout.js +0 -1
- package/dist/core-bak/app/DefaultApp.cjs +0 -1
- package/dist/core-bak/app/DefaultApp.d.ts +0 -10
- package/dist/core-bak/app/DefaultApp.js +0 -1
- package/dist/core-bak/app/index.cjs +0 -1
- package/dist/core-bak/app/index.d.ts +0 -8
- package/dist/core-bak/app/index.js +0 -1
- package/dist/core-bak/config/AppConfig.cjs +0 -1
- package/dist/core-bak/config/AppConfig.d.ts +0 -88
- package/dist/core-bak/config/AppConfig.js +0 -1
- package/dist/core-bak/config/ConfigLoader.cjs +0 -1
- package/dist/core-bak/config/ConfigLoader.d.ts +0 -118
- package/dist/core-bak/config/ConfigLoader.js +0 -1
- package/dist/core-bak/config/ConfigValidator.cjs +0 -2
- package/dist/core-bak/config/ConfigValidator.d.ts +0 -84
- package/dist/core-bak/config/ConfigValidator.js +0 -2
- package/dist/core-bak/config/index.cjs +0 -1
- package/dist/core-bak/config/index.d.ts +0 -6
- package/dist/core-bak/config/index.js +0 -1
- package/dist/core-bak/dev/DevTools.cjs +0 -1
- package/dist/core-bak/dev/DevTools.d.ts +0 -16
- package/dist/core-bak/dev/DevTools.js +0 -1
- package/dist/core-bak/error/ErrorBoundary.cjs +0 -1
- package/dist/core-bak/error/ErrorBoundary.d.ts +0 -121
- package/dist/core-bak/error/ErrorBoundary.js +0 -1
- package/dist/core-bak/error/ErrorHandler.cjs +0 -1
- package/dist/core-bak/error/ErrorHandler.d.ts +0 -171
- package/dist/core-bak/error/ErrorHandler.js +0 -1
- package/dist/core-bak/error/index.cjs +0 -1
- package/dist/core-bak/error/index.d.ts +0 -7
- package/dist/core-bak/error/index.js +0 -1
- package/dist/core-bak/event/AppEventBus.cjs +0 -1
- package/dist/core-bak/event/AppEventBus.d.ts +0 -178
- package/dist/core-bak/event/AppEventBus.js +0 -1
- package/dist/core-bak/event/frameworkEvents.cjs +0 -1
- package/dist/core-bak/event/frameworkEvents.d.ts +0 -69
- package/dist/core-bak/event/frameworkEvents.js +0 -1
- package/dist/core-bak/event/hooks.cjs +0 -1
- package/dist/core-bak/event/hooks.d.ts +0 -57
- package/dist/core-bak/event/hooks.js +0 -1
- package/dist/core-bak/event/index.cjs +0 -1
- package/dist/core-bak/event/index.d.ts +0 -10
- package/dist/core-bak/event/index.js +0 -1
- package/dist/core-bak/event/types.cjs +0 -1
- package/dist/core-bak/event/types.d.ts +0 -269
- package/dist/core-bak/event/types.js +0 -1
- package/dist/core-bak/event/useEventBus.cjs +0 -1
- package/dist/core-bak/event/useEventBus.d.ts +0 -28
- package/dist/core-bak/event/useEventBus.js +0 -1
- package/dist/core-bak/index.cjs +0 -1
- package/dist/core-bak/index.d.ts +0 -54
- package/dist/core-bak/index.js +0 -1
- package/dist/core-bak/initialization/InitializationErrorThrower.cjs +0 -1
- package/dist/core-bak/initialization/InitializationErrorThrower.d.ts +0 -7
- package/dist/core-bak/initialization/InitializationErrorThrower.js +0 -1
- package/dist/core-bak/initialization/index.cjs +0 -1
- package/dist/core-bak/initialization/index.d.ts +0 -7
- package/dist/core-bak/initialization/index.js +0 -1
- package/dist/core-bak/initialization/initialization.cjs +0 -1
- package/dist/core-bak/initialization/initialization.d.ts +0 -69
- package/dist/core-bak/initialization/initialization.js +0 -1
- package/dist/core-bak/initialization/initializationErrorState.cjs +0 -1
- package/dist/core-bak/initialization/initializationErrorState.d.ts +0 -35
- package/dist/core-bak/initialization/initializationErrorState.js +0 -1
- package/dist/core-bak/kernel/defaultAdapters.cjs +0 -1
- package/dist/core-bak/kernel/defaultAdapters.d.ts +0 -2
- package/dist/core-bak/kernel/defaultAdapters.js +0 -1
- package/dist/core-bak/kernel/errors.cjs +0 -1
- package/dist/core-bak/kernel/errors.d.ts +0 -18
- package/dist/core-bak/kernel/errors.js +0 -1
- package/dist/core-bak/kernel/index.cjs +0 -1
- package/dist/core-bak/kernel/index.d.ts +0 -3
- package/dist/core-bak/kernel/index.js +0 -1
- package/dist/core-bak/kernel/startKernel.cjs +0 -1
- package/dist/core-bak/kernel/startKernel.d.ts +0 -2
- package/dist/core-bak/kernel/startKernel.js +0 -1
- package/dist/core-bak/kernel/types.cjs +0 -1
- package/dist/core-bak/kernel/types.d.ts +0 -114
- package/dist/core-bak/kernel/types.js +0 -1
- package/dist/core-bak/middleware.cjs +0 -1
- package/dist/core-bak/middleware.d.ts +0 -36
- package/dist/core-bak/middleware.js +0 -1
- package/dist/core-bak/plugin/PluginEventBus.cjs +0 -1
- package/dist/core-bak/plugin/PluginEventBus.d.ts +0 -169
- package/dist/core-bak/plugin/PluginEventBus.js +0 -1
- package/dist/core-bak/plugin/PluginSandbox.cjs +0 -1
- package/dist/core-bak/plugin/PluginSandbox.d.ts +0 -101
- package/dist/core-bak/plugin/PluginSandbox.js +0 -1
- package/dist/core-bak/plugin.cjs +0 -1
- package/dist/core-bak/plugin.d.ts +0 -224
- package/dist/core-bak/plugin.js +0 -1
- package/dist/core-bak/router/RouterManager.cjs +0 -1
- package/dist/core-bak/router/RouterManager.d.ts +0 -87
- package/dist/core-bak/router/RouterManager.js +0 -1
- package/dist/core-bak/router/adapter/AdapterManager.cjs +0 -1
- package/dist/core-bak/router/adapter/AdapterManager.d.ts +0 -94
- package/dist/core-bak/router/adapter/AdapterManager.js +0 -1
- package/dist/core-bak/router/adapter/index.cjs +0 -1
- package/dist/core-bak/router/adapter/index.d.ts +0 -6
- package/dist/core-bak/router/adapter/index.js +0 -1
- package/dist/core-bak/router/adapter/react-router/ReactRouterAdapter.cjs +0 -1
- package/dist/core-bak/router/adapter/react-router/ReactRouterAdapter.d.ts +0 -43
- package/dist/core-bak/router/adapter/react-router/ReactRouterAdapter.js +0 -1
- package/dist/core-bak/router/adapter/react-router/index.cjs +0 -1
- package/dist/core-bak/router/adapter/react-router/index.d.ts +0 -4
- package/dist/core-bak/router/adapter/react-router/index.js +0 -1
- package/dist/core-bak/router/adapter/types.cjs +0 -1
- package/dist/core-bak/router/adapter/types.d.ts +0 -111
- package/dist/core-bak/router/adapter/types.js +0 -1
- package/dist/core-bak/router/dev/RouterDevTools.cjs +0 -1
- package/dist/core-bak/router/dev/RouterDevTools.d.ts +0 -5
- package/dist/core-bak/router/dev/RouterDevTools.js +0 -1
- package/dist/core-bak/router/dev/index.cjs +0 -1
- package/dist/core-bak/router/dev/index.d.ts +0 -4
- package/dist/core-bak/router/dev/index.js +0 -1
- package/dist/core-bak/router/dynamic/DynamicRouteManager.cjs +0 -1
- package/dist/core-bak/router/dynamic/DynamicRouteManager.d.ts +0 -71
- package/dist/core-bak/router/dynamic/DynamicRouteManager.js +0 -1
- package/dist/core-bak/router/dynamic/index.cjs +0 -1
- package/dist/core-bak/router/dynamic/index.d.ts +0 -4
- package/dist/core-bak/router/dynamic/index.js +0 -1
- package/dist/core-bak/router/errors/RouterError.cjs +0 -1
- package/dist/core-bak/router/errors/RouterError.d.ts +0 -48
- package/dist/core-bak/router/errors/RouterError.js +0 -1
- package/dist/core-bak/router/errors/index.cjs +0 -1
- package/dist/core-bak/router/errors/index.d.ts +0 -4
- package/dist/core-bak/router/errors/index.js +0 -1
- package/dist/core-bak/router/index.cjs +0 -1
- package/dist/core-bak/router/index.d.ts +0 -16
- package/dist/core-bak/router/index.js +0 -1
- package/dist/core-bak/router/lifecycle/RouterLifecycleManager.cjs +0 -1
- package/dist/core-bak/router/lifecycle/RouterLifecycleManager.d.ts +0 -56
- package/dist/core-bak/router/lifecycle/RouterLifecycleManager.js +0 -1
- package/dist/core-bak/router/lifecycle/index.cjs +0 -1
- package/dist/core-bak/router/lifecycle/index.d.ts +0 -4
- package/dist/core-bak/router/lifecycle/index.js +0 -1
- package/dist/core-bak/router/middleware/RouterMiddlewareManager.cjs +0 -1
- package/dist/core-bak/router/middleware/RouterMiddlewareManager.d.ts +0 -61
- package/dist/core-bak/router/middleware/RouterMiddlewareManager.js +0 -1
- package/dist/core-bak/router/middleware/auth.cjs +0 -1
- package/dist/core-bak/router/middleware/auth.d.ts +0 -54
- package/dist/core-bak/router/middleware/auth.js +0 -1
- package/dist/core-bak/router/middleware/index.cjs +0 -1
- package/dist/core-bak/router/middleware/index.d.ts +0 -6
- package/dist/core-bak/router/middleware/index.js +0 -1
- package/dist/core-bak/router/middleware/types.cjs +0 -1
- package/dist/core-bak/router/middleware/types.d.ts +0 -82
- package/dist/core-bak/router/middleware/types.js +0 -1
- package/dist/core-bak/router/monitoring/RouterMonitoring.cjs +0 -1
- package/dist/core-bak/router/monitoring/RouterMonitoring.d.ts +0 -134
- package/dist/core-bak/router/monitoring/RouterMonitoring.js +0 -1
- package/dist/core-bak/router/monitoring/index.cjs +0 -1
- package/dist/core-bak/router/monitoring/index.d.ts +0 -4
- package/dist/core-bak/router/monitoring/index.js +0 -1
- package/dist/core-bak/router/navigation/RouterNavigation.cjs +0 -1
- package/dist/core-bak/router/navigation/RouterNavigation.d.ts +0 -43
- package/dist/core-bak/router/navigation/RouterNavigation.js +0 -1
- package/dist/core-bak/router/navigation/index.cjs +0 -1
- package/dist/core-bak/router/navigation/index.d.ts +0 -4
- package/dist/core-bak/router/navigation/index.js +0 -1
- package/dist/core-bak/router/performance/RouteCache.cjs +0 -1
- package/dist/core-bak/router/performance/RouteCache.d.ts +0 -113
- package/dist/core-bak/router/performance/RouteCache.js +0 -1
- package/dist/core-bak/router/performance/RoutePreloader.cjs +0 -1
- package/dist/core-bak/router/performance/RoutePreloader.d.ts +0 -111
- package/dist/core-bak/router/performance/RoutePreloader.js +0 -1
- package/dist/core-bak/router/performance/index.cjs +0 -1
- package/dist/core-bak/router/performance/index.d.ts +0 -5
- package/dist/core-bak/router/performance/index.js +0 -1
- package/dist/core-bak/router/plugin/RouterPluginManager.cjs +0 -1
- package/dist/core-bak/router/plugin/RouterPluginManager.d.ts +0 -74
- package/dist/core-bak/router/plugin/RouterPluginManager.js +0 -1
- package/dist/core-bak/router/plugin/index.cjs +0 -1
- package/dist/core-bak/router/plugin/index.d.ts +0 -5
- package/dist/core-bak/router/plugin/index.js +0 -1
- package/dist/core-bak/router/plugin/types.cjs +0 -1
- package/dist/core-bak/router/plugin/types.d.ts +0 -153
- package/dist/core-bak/router/plugin/types.js +0 -1
- package/dist/core-bak/router/types.cjs +0 -1
- package/dist/core-bak/router/types.d.ts +0 -464
- package/dist/core-bak/router/types.js +0 -1
- package/dist/core-bak/router/utils/adapters/react-router/RouteErrorBoundary.cjs +0 -1
- package/dist/core-bak/router/utils/adapters/react-router/RouteErrorBoundary.d.ts +0 -2
- package/dist/core-bak/router/utils/adapters/react-router/RouteErrorBoundary.js +0 -1
- package/dist/core-bak/router/utils/adapters/react-router/transform.cjs +0 -1
- package/dist/core-bak/router/utils/adapters/react-router/transform.d.ts +0 -5
- package/dist/core-bak/router/utils/adapters/react-router/transform.js +0 -1
- package/dist/core-bak/router/utils/transform.cjs +0 -1
- package/dist/core-bak/router/utils/transform.d.ts +0 -348
- package/dist/core-bak/router/utils/transform.js +0 -1
- package/dist/core-bak/router/validation/RouterConfigValidator.cjs +0 -2
- package/dist/core-bak/router/validation/RouterConfigValidator.d.ts +0 -121
- package/dist/core-bak/router/validation/RouterConfigValidator.js +0 -2
- package/dist/core-bak/router/validation/index.cjs +0 -1
- package/dist/core-bak/router/validation/index.d.ts +0 -5
- package/dist/core-bak/router/validation/index.js +0 -1
- package/dist/core-bak/router/validation/schema.cjs +0 -1
- package/dist/core-bak/router/validation/schema.d.ts +0 -180
- package/dist/core-bak/router/validation/schema.js +0 -1
- package/dist/core-bak/router/version/RouteVersionManager.cjs +0 -1
- package/dist/core-bak/router/version/RouteVersionManager.d.ts +0 -124
- package/dist/core-bak/router/version/RouteVersionManager.js +0 -1
- package/dist/core-bak/router/version/index.cjs +0 -1
- package/dist/core-bak/router/version/index.d.ts +0 -4
- package/dist/core-bak/router/version/index.js +0 -1
- package/dist/core-bak/splash/SplashScreen.cjs +0 -1
- package/dist/core-bak/splash/SplashScreen.d.ts +0 -14
- package/dist/core-bak/splash/SplashScreen.js +0 -1
- package/dist/core-bak/splash/index.cjs +0 -1
- package/dist/core-bak/splash/index.d.ts +0 -5
- package/dist/core-bak/splash/index.js +0 -1
- package/dist/core-bak/splash/splashScreenUtils.cjs +0 -1
- package/dist/core-bak/splash/splashScreenUtils.d.ts +0 -7
- package/dist/core-bak/splash/splashScreenUtils.js +0 -1
- package/dist/core-bak/startup/AppInstance.cjs +0 -1
- package/dist/core-bak/startup/AppInstance.d.ts +0 -138
- package/dist/core-bak/startup/AppInstance.js +0 -1
- package/dist/core-bak/startup/environment.cjs +0 -1
- package/dist/core-bak/startup/environment.d.ts +0 -87
- package/dist/core-bak/startup/environment.js +0 -1
- package/dist/core-bak/startup/index.cjs +0 -1
- package/dist/core-bak/startup/index.d.ts +0 -7
- package/dist/core-bak/startup/index.js +0 -1
- package/dist/core-bak/startup/initializeServices.cjs +0 -1
- package/dist/core-bak/startup/initializeServices.d.ts +0 -68
- package/dist/core-bak/startup/initializeServices.js +0 -1
- package/dist/core-bak/startup/performanceTracker.cjs +0 -1
- package/dist/core-bak/startup/performanceTracker.d.ts +0 -104
- package/dist/core-bak/startup/performanceTracker.js +0 -1
- package/dist/core-bak/startup/renderApp.cjs +0 -1
- package/dist/core-bak/startup/renderApp.d.ts +0 -70
- package/dist/core-bak/startup/renderApp.js +0 -1
- package/dist/core-bak/startup/startApp.cjs +0 -1
- package/dist/core-bak/startup/startApp.d.ts +0 -14
- package/dist/core-bak/startup/startApp.js +0 -1
- package/dist/core-bak/types.cjs +0 -1
- package/dist/core-bak/types.d.ts +0 -501
- package/dist/core-bak/types.js +0 -1
- package/dist/index.umd.cjs +0 -1
- package/dist/index.umd.d.ts +0 -7
package/dist/core/types.d.ts
DELETED
|
@@ -1,501 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/core/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|
package/dist/core-bak/Test.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});const _jsxruntime=require("react/jsx-runtime");const _react=/*#__PURE__*/_interop_require_wildcard(require("react"));const _logger=require("@vlian/logger");function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interop_require_wildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={__proto__:null};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}const App=({onComplete})=>{(0,_react.useEffect)(()=>{_logger.logger.info("App mounted");onComplete()},[]);return(0,_jsxruntime.jsx)("div",{children:"App"})};const _default=App;
|
package/dist/core-bak/Test.d.ts
DELETED
package/dist/core-bak/Test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import React,{useEffect}from"react";import{logger}from"@vlian/logger";const App=({onComplete})=>{useEffect(()=>{logger.info("App mounted");onComplete()},[]);return _jsx("div",{children:"App"})};export default App;
|
|
@@ -1 +0,0 @@
|
|
|
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 AppContextProvider(){return AppContextProvider},get useAppContext(){return useAppContext},get useConfig(){return useConfig},get useLocale(){return useLocale},get useStateManager(){return useStateManager},get useTheme(){return useTheme}});const _jsxruntime=require("react/jsx-runtime");const _react=/*#__PURE__*/_interop_require_wildcard(require("react"));const _library=require("../../library");const _AppConfig=require("../config/AppConfig");function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interop_require_wildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={__proto__:null};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}const ThemeContext=(0,_react.createContext)(undefined);const LocaleContext=(0,_react.createContext)(undefined);const ConfigContext=(0,_react.createContext)(undefined);const StateManagerContext=(0,_react.createContext)(undefined);const ThemeProvider=_react.default.memo(({children,initialTheme})=>{const[theme,setThemeState]=(0,_react.useState)(initialTheme||_AppConfig.appConfig.getTheme());const applyDocumentThemeClass=(0,_react.useCallback)(mode=>{if(typeof window==="undefined"){return}const html=document.documentElement;html.classList.remove("light","dark");const resolvedMode=mode==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":mode||"light";html.classList.add(resolvedMode)},[]);(0,_react.useEffect)(()=>{_AppConfig.appConfig.setTheme(theme)},[theme]);(0,_react.useEffect)(()=>{if(typeof window==="undefined"){return}applyDocumentThemeClass(theme.mode);if(theme.mode!=="system"){return}const mediaQuery=window.matchMedia("(prefers-color-scheme: dark)");const onSystemThemeChange=()=>applyDocumentThemeClass("system");if(typeof mediaQuery.addEventListener==="function"){mediaQuery.addEventListener("change",onSystemThemeChange);return()=>mediaQuery.removeEventListener("change",onSystemThemeChange)}mediaQuery.addListener(onSystemThemeChange);return()=>mediaQuery.removeListener(onSystemThemeChange)},[applyDocumentThemeClass,theme.mode]);const setTheme=(0,_react.useCallback)(newTheme=>{setThemeState(prev=>{return typeof newTheme==="function"?newTheme(prev):newTheme})},[]);const value=(0,_react.useMemo)(()=>({theme,setTheme}),[theme,setTheme]);return(0,_jsxruntime.jsx)(ThemeContext.Provider,{value:value,children:children})});ThemeProvider.displayName="ThemeProvider";const LocaleProvider=_react.default.memo(({children,initialLocale})=>{const[locale,setLocaleState]=(0,_react.useState)(initialLocale||_AppConfig.appConfig.getLocale());const[isChanging,setIsChanging]=(0,_react.useState)(false);(0,_react.useEffect)(()=>{_AppConfig.appConfig.setLocale(locale)},[locale]);const setLocale=(0,_react.useCallback)(newLocale=>{if(newLocale===locale){return}setIsChanging(true);setLocaleState(newLocale);(0,_library.setLang)(newLocale);requestAnimationFrame(()=>{setIsChanging(false)})},[locale]);const value=(0,_react.useMemo)(()=>({locale,setLocale,isChanging}),[locale,setLocale,isChanging]);return(0,_jsxruntime.jsx)(LocaleContext.Provider,{value:value,children:children})});LocaleProvider.displayName="LocaleProvider";const AppConfigProvider=_react.default.memo(({children,initialAntdConfig,initialInitializationContext})=>{const[antdConfig,setAntdConfigState]=(0,_react.useState)(initialAntdConfig||_AppConfig.appConfig.getAntdConfig());const[initializationContext,setInitializationContextState]=(0,_react.useState)(initialInitializationContext||_AppConfig.appConfig.getInitializationContext());(0,_react.useEffect)(()=>{_AppConfig.appConfig.setAntdConfig(antdConfig)},[antdConfig]);(0,_react.useEffect)(()=>{_AppConfig.appConfig.setInitializationContext(initializationContext)},[initializationContext]);const setAntdConfig=(0,_react.useCallback)(config=>{setAntdConfigState(config)},[]);const setInitializationContext=(0,_react.useCallback)(context=>{setInitializationContextState(context)},[]);const value=(0,_react.useMemo)(()=>({antdConfig,initializationContext,setAntdConfig,setInitializationContext}),[antdConfig,initializationContext,setAntdConfig,setInitializationContext]);return(0,_jsxruntime.jsx)(ConfigContext.Provider,{value:value,children:children})});AppConfigProvider.displayName="AppConfigProvider";const StateManagerProvider=_react.default.memo(({children,stateManager})=>{const value=(0,_react.useMemo)(()=>({stateManager:stateManager??null}),[stateManager]);return(0,_jsxruntime.jsx)(StateManagerContext.Provider,{value:value,children:children})});StateManagerProvider.displayName="StateManagerProvider";const AppContextProvider=({children,initialTheme,initialLocale,initialAntdConfig,initialInitializationContext,stateManager,antdApp:_antdApp,uiApp:_uiApp})=>{const initializedRef=_react.default.useRef(false);_react.default.useEffect(()=>{if(!initializedRef.current){_AppConfig.appConfig.initialize({theme:initialTheme,locale:initialLocale,antdConfig:initialAntdConfig,initializationContext:initialInitializationContext});initializedRef.current=true}},[initialTheme,initialLocale,initialAntdConfig,initialInitializationContext]);return(0,_jsxruntime.jsx)(ThemeProvider,{initialTheme:initialTheme,children:(0,_jsxruntime.jsx)(LocaleProvider,{initialLocale:initialLocale,children:(0,_jsxruntime.jsx)(AppConfigProvider,{initialAntdConfig:initialAntdConfig,initialInitializationContext:initialInitializationContext,children:(0,_jsxruntime.jsx)(StateManagerProvider,{stateManager:stateManager,children:children})})})})};const useTheme=()=>{const context=(0,_react.useContext)(ThemeContext);if(context===undefined){throw new Error("useTheme 必须在 AppContextProvider 内使用")}return context};const useLocale=()=>{const context=(0,_react.useContext)(LocaleContext);if(context===undefined){throw new Error("useLocale 必须在 AppContextProvider 内使用")}return context};const useConfig=()=>{const context=(0,_react.useContext)(ConfigContext);if(context===undefined){throw new Error("useConfig 必须在 AppContextProvider 内使用")}return context};const useStateManager=()=>{const context=(0,_react.useContext)(StateManagerContext);if(context===undefined){throw new Error("useStateManager 必须在 AppContextProvider 内使用")}return context.stateManager};const useAppContext=()=>{const themeContext=useTheme();const localeContext=useLocale();const configContext=useConfig();const stateManagerContext=useStateManager();return(0,_react.useMemo)(()=>({theme:themeContext.theme,locale:localeContext.locale,antdConfig:configContext.antdConfig,initializationContext:configContext.initializationContext,stateManager:stateManagerContext,setTheme:themeContext.setTheme,setLocale:localeContext.setLocale,setAntdConfig:configContext.setAntdConfig,setInitializationContext:configContext.setInitializationContext}),[themeContext.theme,localeContext.locale,configContext.antdConfig,configContext.initializationContext,stateManagerContext,themeContext.setTheme,localeContext.setLocale,configContext.setAntdConfig,configContext.setInitializationContext])};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { PropsWithChildren } from 'react';
|
|
3
|
-
import type { LangType } from '../../library/locale/types';
|
|
4
|
-
import type { InitializationContext } from '../initialization';
|
|
5
|
-
import type { ThemeContextValue, LocaleContextValue, ConfigContextValue, AppContextValue, ThemeConfig } from './AppContext.types';
|
|
6
|
-
import type { StateManager } from '../../state';
|
|
7
|
-
import type { UIAppConfig, UIProviderConfig } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* 应用上下文 Provider 属性
|
|
10
|
-
*/
|
|
11
|
-
export interface AppContextProviderProps extends PropsWithChildren {
|
|
12
|
-
/**
|
|
13
|
-
* 初始主题配置
|
|
14
|
-
*/
|
|
15
|
-
initialTheme?: ThemeConfig;
|
|
16
|
-
/**
|
|
17
|
-
* 初始国际化语言
|
|
18
|
-
*/
|
|
19
|
-
initialLocale?: LangType;
|
|
20
|
-
/**
|
|
21
|
-
* 初始 Ant Design 配置
|
|
22
|
-
*/
|
|
23
|
-
initialAntdConfig?: UIProviderConfig;
|
|
24
|
-
/**
|
|
25
|
-
* 初始初始化上下文
|
|
26
|
-
*/
|
|
27
|
-
initialInitializationContext?: InitializationContext;
|
|
28
|
-
/**
|
|
29
|
-
* 状态管理器实例
|
|
30
|
-
*/
|
|
31
|
-
stateManager?: StateManager | null;
|
|
32
|
-
/**
|
|
33
|
-
* UI App 基础配置
|
|
34
|
-
*
|
|
35
|
-
* 用于传递 UI 适配层的应用级配置(如消息、通知、弹窗容器)。
|
|
36
|
-
*/
|
|
37
|
-
antdApp?: UIAppConfig;
|
|
38
|
-
/**
|
|
39
|
-
* UI App 配置(无框架绑定)
|
|
40
|
-
*/
|
|
41
|
-
uiApp?: UIAppConfig;
|
|
42
|
-
}
|
|
43
|
-
export declare const AppContextProvider: React.FC<AppContextProviderProps>;
|
|
44
|
-
/**
|
|
45
|
-
* 使用主题上下文 Hook
|
|
46
|
-
*
|
|
47
|
-
* @returns 主题上下文值
|
|
48
|
-
* @throws 如果不在 ThemeProvider 内使用会抛出错误
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```tsx
|
|
52
|
-
* const { theme, setTheme } = useTheme();
|
|
53
|
-
*
|
|
54
|
-
* // 切换主题
|
|
55
|
-
* setTheme({ mode: 'dark' });
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare const useTheme: () => ThemeContextValue;
|
|
59
|
-
/**
|
|
60
|
-
* 使用国际化上下文 Hook
|
|
61
|
-
*
|
|
62
|
-
* @returns 国际化上下文值
|
|
63
|
-
* @throws 如果不在 LocaleProvider 内使用会抛出错误
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```tsx
|
|
67
|
-
* const { locale, setLocale } = useLocale();
|
|
68
|
-
*
|
|
69
|
-
* // 切换语言
|
|
70
|
-
* setLocale('en-US');
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export declare const useLocale: () => LocaleContextValue;
|
|
74
|
-
/**
|
|
75
|
-
* 使用配置上下文 Hook
|
|
76
|
-
*
|
|
77
|
-
* @returns 配置上下文值
|
|
78
|
-
* @throws 如果不在 ConfigProvider 内使用会抛出错误
|
|
79
|
-
*/
|
|
80
|
-
export declare const useConfig: () => ConfigContextValue;
|
|
81
|
-
/**
|
|
82
|
-
* 使用应用上下文 Hook(聚合所有上下文)
|
|
83
|
-
*
|
|
84
|
-
* @returns 应用上下文值
|
|
85
|
-
* @throws 如果不在 AppContextProvider 内使用会抛出错误
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```tsx
|
|
89
|
-
* const { theme, setTheme, locale, setLocale, antdConfig } = useAppContext();
|
|
90
|
-
*
|
|
91
|
-
* // 切换主题
|
|
92
|
-
* setTheme({ mode: 'dark' });
|
|
93
|
-
*
|
|
94
|
-
* // 切换语言
|
|
95
|
-
* setLocale('en-US');
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
/**
|
|
99
|
-
* 使用状态管理器 Hook
|
|
100
|
-
*
|
|
101
|
-
* @returns 状态管理器实例
|
|
102
|
-
* @throws 如果不在 AppContextProvider 内使用会抛出错误
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```tsx
|
|
106
|
-
* const stateManager = useStateManager();
|
|
107
|
-
*
|
|
108
|
-
* // 创建状态实例
|
|
109
|
-
* const countState = stateManager?.createState(0);
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export declare const useStateManager: () => StateManager | null;
|
|
113
|
-
export declare const useAppContext: () => AppContextValue;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import React,{createContext,useContext,useState,useCallback,useMemo,useEffect}from"react";import{setLang}from"../../library";import{appConfig}from"../config/AppConfig";const ThemeContext=createContext(undefined);const LocaleContext=createContext(undefined);const ConfigContext=createContext(undefined);const StateManagerContext=createContext(undefined);const ThemeProvider=React.memo(({children,initialTheme})=>{const[theme,setThemeState]=useState(initialTheme||appConfig.getTheme());const applyDocumentThemeClass=useCallback(mode=>{if(typeof window==="undefined"){return}const html=document.documentElement;html.classList.remove("light","dark");const resolvedMode=mode==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":mode||"light";html.classList.add(resolvedMode)},[]);useEffect(()=>{appConfig.setTheme(theme)},[theme]);useEffect(()=>{if(typeof window==="undefined"){return}applyDocumentThemeClass(theme.mode);if(theme.mode!=="system"){return}const mediaQuery=window.matchMedia("(prefers-color-scheme: dark)");const onSystemThemeChange=()=>applyDocumentThemeClass("system");if(typeof mediaQuery.addEventListener==="function"){mediaQuery.addEventListener("change",onSystemThemeChange);return()=>mediaQuery.removeEventListener("change",onSystemThemeChange)}mediaQuery.addListener(onSystemThemeChange);return()=>mediaQuery.removeListener(onSystemThemeChange)},[applyDocumentThemeClass,theme.mode]);const setTheme=useCallback(newTheme=>{setThemeState(prev=>{return typeof newTheme==="function"?newTheme(prev):newTheme})},[]);const value=useMemo(()=>({theme,setTheme}),[theme,setTheme]);return _jsx(ThemeContext.Provider,{value:value,children:children})});ThemeProvider.displayName="ThemeProvider";const LocaleProvider=React.memo(({children,initialLocale})=>{const[locale,setLocaleState]=useState(initialLocale||appConfig.getLocale());const[isChanging,setIsChanging]=useState(false);useEffect(()=>{appConfig.setLocale(locale)},[locale]);const setLocale=useCallback(newLocale=>{if(newLocale===locale){return}setIsChanging(true);setLocaleState(newLocale);setLang(newLocale);requestAnimationFrame(()=>{setIsChanging(false)})},[locale]);const value=useMemo(()=>({locale,setLocale,isChanging}),[locale,setLocale,isChanging]);return _jsx(LocaleContext.Provider,{value:value,children:children})});LocaleProvider.displayName="LocaleProvider";const AppConfigProvider=React.memo(({children,initialAntdConfig,initialInitializationContext})=>{const[antdConfig,setAntdConfigState]=useState(initialAntdConfig||appConfig.getAntdConfig());const[initializationContext,setInitializationContextState]=useState(initialInitializationContext||appConfig.getInitializationContext());useEffect(()=>{appConfig.setAntdConfig(antdConfig)},[antdConfig]);useEffect(()=>{appConfig.setInitializationContext(initializationContext)},[initializationContext]);const setAntdConfig=useCallback(config=>{setAntdConfigState(config)},[]);const setInitializationContext=useCallback(context=>{setInitializationContextState(context)},[]);const value=useMemo(()=>({antdConfig,initializationContext,setAntdConfig,setInitializationContext}),[antdConfig,initializationContext,setAntdConfig,setInitializationContext]);return _jsx(ConfigContext.Provider,{value:value,children:children})});AppConfigProvider.displayName="AppConfigProvider";const StateManagerProvider=React.memo(({children,stateManager})=>{const value=useMemo(()=>({stateManager:stateManager??null}),[stateManager]);return _jsx(StateManagerContext.Provider,{value:value,children:children})});StateManagerProvider.displayName="StateManagerProvider";export const AppContextProvider=({children,initialTheme,initialLocale,initialAntdConfig,initialInitializationContext,stateManager,antdApp:_antdApp,uiApp:_uiApp})=>{const initializedRef=React.useRef(false);React.useEffect(()=>{if(!initializedRef.current){appConfig.initialize({theme:initialTheme,locale:initialLocale,antdConfig:initialAntdConfig,initializationContext:initialInitializationContext});initializedRef.current=true}},[initialTheme,initialLocale,initialAntdConfig,initialInitializationContext]);return _jsx(ThemeProvider,{initialTheme:initialTheme,children:_jsx(LocaleProvider,{initialLocale:initialLocale,children:_jsx(AppConfigProvider,{initialAntdConfig:initialAntdConfig,initialInitializationContext:initialInitializationContext,children:_jsx(StateManagerProvider,{stateManager:stateManager,children:children})})})})};export const useTheme=()=>{const context=useContext(ThemeContext);if(context===undefined){throw new Error("useTheme 必须在 AppContextProvider 内使用")}return context};export const useLocale=()=>{const context=useContext(LocaleContext);if(context===undefined){throw new Error("useLocale 必须在 AppContextProvider 内使用")}return context};export const useConfig=()=>{const context=useContext(ConfigContext);if(context===undefined){throw new Error("useConfig 必须在 AppContextProvider 内使用")}return context};export const useStateManager=()=>{const context=useContext(StateManagerContext);if(context===undefined){throw new Error("useStateManager 必须在 AppContextProvider 内使用")}return context.stateManager};export const useAppContext=()=>{const themeContext=useTheme();const localeContext=useLocale();const configContext=useConfig();const stateManagerContext=useStateManager();return useMemo(()=>({theme:themeContext.theme,locale:localeContext.locale,antdConfig:configContext.antdConfig,initializationContext:configContext.initializationContext,stateManager:stateManagerContext,setTheme:themeContext.setTheme,setLocale:localeContext.setLocale,setAntdConfig:configContext.setAntdConfig,setInitializationContext:configContext.setInitializationContext}),[themeContext.theme,localeContext.locale,configContext.antdConfig,configContext.initializationContext,stateManagerContext,themeContext.setTheme,localeContext.setLocale,configContext.setAntdConfig,configContext.setInitializationContext])};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|