@saolabs/client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +221 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins.d.ts +38 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +61 -0
- package/dist/plugins.js.map +1 -0
- package/dist/src/core/app/Application.d.ts +159 -0
- package/dist/src/core/app/Application.d.ts.map +1 -0
- package/dist/src/core/app/Application.js +338 -0
- package/dist/src/core/app/Application.js.map +1 -0
- package/dist/src/core/bootstrap/app.d.ts +4 -0
- package/dist/src/core/bootstrap/app.d.ts.map +1 -0
- package/dist/src/core/bootstrap/app.js +49 -0
- package/dist/src/core/bootstrap/app.js.map +1 -0
- package/dist/src/core/bootstrap/providers/ApiServiceProvider.d.ts +9 -0
- package/dist/src/core/bootstrap/providers/ApiServiceProvider.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/ApiServiceProvider.js +18 -0
- package/dist/src/core/bootstrap/providers/ApiServiceProvider.js.map +1 -0
- package/dist/src/core/bootstrap/providers/CoreServiceProvider.d.ts +6 -0
- package/dist/src/core/bootstrap/providers/CoreServiceProvider.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/CoreServiceProvider.js +21 -0
- package/dist/src/core/bootstrap/providers/CoreServiceProvider.js.map +1 -0
- package/dist/src/core/bootstrap/providers/HelperServiceProvider.d.ts +7 -0
- package/dist/src/core/bootstrap/providers/HelperServiceProvider.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/HelperServiceProvider.js +14 -0
- package/dist/src/core/bootstrap/providers/HelperServiceProvider.js.map +1 -0
- package/dist/src/core/bootstrap/providers/RouteServiceProvider.d.ts +9 -0
- package/dist/src/core/bootstrap/providers/RouteServiceProvider.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/RouteServiceProvider.js +18 -0
- package/dist/src/core/bootstrap/providers/RouteServiceProvider.js.map +1 -0
- package/dist/src/core/bootstrap/providers/ServiceProvider.d.ts +38 -0
- package/dist/src/core/bootstrap/providers/ServiceProvider.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/ServiceProvider.js +41 -0
- package/dist/src/core/bootstrap/providers/ServiceProvider.js.map +1 -0
- package/dist/src/core/bootstrap/providers/ViewServiceProvider.d.ts +9 -0
- package/dist/src/core/bootstrap/providers/ViewServiceProvider.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/ViewServiceProvider.js +18 -0
- package/dist/src/core/bootstrap/providers/ViewServiceProvider.js.map +1 -0
- package/dist/src/core/bootstrap/providers/default-providers.d.ts +14 -0
- package/dist/src/core/bootstrap/providers/default-providers.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/default-providers.js +79 -0
- package/dist/src/core/bootstrap/providers/default-providers.js.map +1 -0
- package/dist/src/core/bootstrap/providers/index.d.ts +10 -0
- package/dist/src/core/bootstrap/providers/index.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/index.js +9 -0
- package/dist/src/core/bootstrap/providers/index.js.map +1 -0
- package/dist/src/core/bootstrap/providers/provider-order.d.ts +19 -0
- package/dist/src/core/bootstrap/providers/provider-order.d.ts.map +1 -0
- package/dist/src/core/bootstrap/providers/provider-order.js +51 -0
- package/dist/src/core/bootstrap/providers/provider-order.js.map +1 -0
- package/dist/src/core/cache/ViewCache.d.ts +46 -0
- package/dist/src/core/cache/ViewCache.d.ts.map +1 -0
- package/dist/src/core/cache/ViewCache.js +85 -0
- package/dist/src/core/cache/ViewCache.js.map +1 -0
- package/dist/src/core/cache/index.d.ts +2 -0
- package/dist/src/core/cache/index.d.ts.map +1 -0
- package/dist/src/core/cache/index.js +2 -0
- package/dist/src/core/cache/index.js.map +1 -0
- package/dist/src/core/contracts/ApiInterface.d.ts +11 -0
- package/dist/src/core/contracts/ApiInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ApiInterface.js +2 -0
- package/dist/src/core/contracts/ApiInterface.js.map +1 -0
- package/dist/src/core/contracts/ApplicationInterface.d.ts +66 -0
- package/dist/src/core/contracts/ApplicationInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ApplicationInterface.js +3 -0
- package/dist/src/core/contracts/ApplicationInterface.js.map +1 -0
- package/dist/src/core/contracts/BlockInterface.d.ts +67 -0
- package/dist/src/core/contracts/BlockInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/BlockInterface.js +2 -0
- package/dist/src/core/contracts/BlockInterface.js.map +1 -0
- package/dist/src/core/contracts/ComponentInterface.d.ts +24 -0
- package/dist/src/core/contracts/ComponentInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ComponentInterface.js +2 -0
- package/dist/src/core/contracts/ComponentInterface.js.map +1 -0
- package/dist/src/core/contracts/ElementInterface.d.ts +117 -0
- package/dist/src/core/contracts/ElementInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ElementInterface.js +2 -0
- package/dist/src/core/contracts/ElementInterface.js.map +1 -0
- package/dist/src/core/contracts/EventServiceInterface.d.ts +37 -0
- package/dist/src/core/contracts/EventServiceInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/EventServiceInterface.js +3 -0
- package/dist/src/core/contracts/EventServiceInterface.js.map +1 -0
- package/dist/src/core/contracts/HelperInterface.d.ts +231 -0
- package/dist/src/core/contracts/HelperInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/HelperInterface.js +3 -0
- package/dist/src/core/contracts/HelperInterface.js.map +1 -0
- package/dist/src/core/contracts/HttpServiceInterface.d.ts +38 -0
- package/dist/src/core/contracts/HttpServiceInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/HttpServiceInterface.js +3 -0
- package/dist/src/core/contracts/HttpServiceInterface.js.map +1 -0
- package/dist/src/core/contracts/LoggerServiceInterface.d.ts +37 -0
- package/dist/src/core/contracts/LoggerServiceInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/LoggerServiceInterface.js +3 -0
- package/dist/src/core/contracts/LoggerServiceInterface.js.map +1 -0
- package/dist/src/core/contracts/LoopContextInterface.d.ts +14 -0
- package/dist/src/core/contracts/LoopContextInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/LoopContextInterface.js +3 -0
- package/dist/src/core/contracts/LoopContextInterface.js.map +1 -0
- package/dist/src/core/contracts/MarkerInterface.d.ts +55 -0
- package/dist/src/core/contracts/MarkerInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/MarkerInterface.js +2 -0
- package/dist/src/core/contracts/MarkerInterface.js.map +1 -0
- package/dist/src/core/contracts/ReactiveInterface.d.ts +38 -0
- package/dist/src/core/contracts/ReactiveInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ReactiveInterface.js +2 -0
- package/dist/src/core/contracts/ReactiveInterface.js.map +1 -0
- package/dist/src/core/contracts/RouterInterface.d.ts +58 -0
- package/dist/src/core/contracts/RouterInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/RouterInterface.js +2 -0
- package/dist/src/core/contracts/RouterInterface.js.map +1 -0
- package/dist/src/core/contracts/ServiceProviderInterface.d.ts +12 -0
- package/dist/src/core/contracts/ServiceProviderInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ServiceProviderInterface.js +2 -0
- package/dist/src/core/contracts/ServiceProviderInterface.js.map +1 -0
- package/dist/src/core/contracts/StorageServiceInterface.d.ts +43 -0
- package/dist/src/core/contracts/StorageServiceInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/StorageServiceInterface.js +3 -0
- package/dist/src/core/contracts/StorageServiceInterface.js.map +1 -0
- package/dist/src/core/contracts/StoreServiceInterface.d.ts +45 -0
- package/dist/src/core/contracts/StoreServiceInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/StoreServiceInterface.js +3 -0
- package/dist/src/core/contracts/StoreServiceInterface.js.map +1 -0
- package/dist/src/core/contracts/ViewCacheInterface.d.ts +13 -0
- package/dist/src/core/contracts/ViewCacheInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ViewCacheInterface.js +3 -0
- package/dist/src/core/contracts/ViewCacheInterface.js.map +1 -0
- package/dist/src/core/contracts/ViewControllerInterface.d.ts +115 -0
- package/dist/src/core/contracts/ViewControllerInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ViewControllerInterface.js +2 -0
- package/dist/src/core/contracts/ViewControllerInterface.js.map +1 -0
- package/dist/src/core/contracts/ViewInterface.d.ts +24 -0
- package/dist/src/core/contracts/ViewInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ViewInterface.js +2 -0
- package/dist/src/core/contracts/ViewInterface.js.map +1 -0
- package/dist/src/core/contracts/ViewManagerInterface.d.ts +44 -0
- package/dist/src/core/contracts/ViewManagerInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ViewManagerInterface.js +2 -0
- package/dist/src/core/contracts/ViewManagerInterface.js.map +1 -0
- package/dist/src/core/contracts/ViewStateInterface.d.ts +40 -0
- package/dist/src/core/contracts/ViewStateInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/ViewStateInterface.js +3 -0
- package/dist/src/core/contracts/ViewStateInterface.js.map +1 -0
- package/dist/src/core/contracts/common.d.ts +28 -0
- package/dist/src/core/contracts/common.d.ts.map +1 -0
- package/dist/src/core/contracts/common.js +29 -0
- package/dist/src/core/contracts/common.js.map +1 -0
- package/dist/src/core/contracts/utils.d.ts +20 -0
- package/dist/src/core/contracts/utils.d.ts.map +1 -0
- package/dist/src/core/contracts/utils.js +4 -0
- package/dist/src/core/contracts/utils.js.map +1 -0
- package/dist/src/core/contracts/views.d.ts +23 -0
- package/dist/src/core/contracts/views.d.ts.map +1 -0
- package/dist/src/core/contracts/views.js +2 -0
- package/dist/src/core/contracts/views.js.map +1 -0
- package/dist/src/core/elements/Block.d.ts +58 -0
- package/dist/src/core/elements/Block.d.ts.map +1 -0
- package/dist/src/core/elements/Block.js +77 -0
- package/dist/src/core/elements/Block.js.map +1 -0
- package/dist/src/core/elements/BlockOutlet.d.ts +34 -0
- package/dist/src/core/elements/BlockOutlet.d.ts.map +1 -0
- package/dist/src/core/elements/BlockOutlet.js +59 -0
- package/dist/src/core/elements/BlockOutlet.js.map +1 -0
- package/dist/src/core/elements/Component.d.ts +62 -0
- package/dist/src/core/elements/Component.d.ts.map +1 -0
- package/dist/src/core/elements/Component.js +72 -0
- package/dist/src/core/elements/Component.js.map +1 -0
- package/dist/src/core/elements/ElementManager.d.ts +23 -0
- package/dist/src/core/elements/ElementManager.d.ts.map +1 -0
- package/dist/src/core/elements/ElementManager.js +33 -0
- package/dist/src/core/elements/ElementManager.js.map +1 -0
- package/dist/src/core/elements/Fragment.d.ts +51 -0
- package/dist/src/core/elements/Fragment.d.ts.map +1 -0
- package/dist/src/core/elements/Fragment.js +133 -0
- package/dist/src/core/elements/Fragment.js.map +1 -0
- package/dist/src/core/elements/Html.d.ts +52 -0
- package/dist/src/core/elements/Html.d.ts.map +1 -0
- package/dist/src/core/elements/Html.js +299 -0
- package/dist/src/core/elements/Html.js.map +1 -0
- package/dist/src/core/elements/Output.d.ts +69 -0
- package/dist/src/core/elements/Output.d.ts.map +1 -0
- package/dist/src/core/elements/Output.js +121 -0
- package/dist/src/core/elements/Output.js.map +1 -0
- package/dist/src/core/elements/Reactive.d.ts +77 -0
- package/dist/src/core/elements/Reactive.d.ts.map +1 -0
- package/dist/src/core/elements/Reactive.js +199 -0
- package/dist/src/core/elements/Reactive.js.map +1 -0
- package/dist/src/core/elements/TextElement.d.ts +46 -0
- package/dist/src/core/elements/TextElement.d.ts.map +1 -0
- package/dist/src/core/elements/TextElement.js +94 -0
- package/dist/src/core/elements/TextElement.js.map +1 -0
- package/dist/src/core/elements/Wrapper.d.ts +50 -0
- package/dist/src/core/elements/Wrapper.d.ts.map +1 -0
- package/dist/src/core/elements/Wrapper.js +96 -0
- package/dist/src/core/elements/Wrapper.js.map +1 -0
- package/dist/src/core/elements/Yield.d.ts +34 -0
- package/dist/src/core/elements/Yield.d.ts.map +1 -0
- package/dist/src/core/elements/Yield.js +56 -0
- package/dist/src/core/elements/Yield.js.map +1 -0
- package/dist/src/core/elements/helpers.d.ts +8 -0
- package/dist/src/core/elements/helpers.d.ts.map +1 -0
- package/dist/src/core/elements/helpers.js +40 -0
- package/dist/src/core/elements/helpers.js.map +1 -0
- package/dist/src/core/elements/index.d.ts +12 -0
- package/dist/src/core/elements/index.d.ts.map +1 -0
- package/dist/src/core/elements/index.js +12 -0
- package/dist/src/core/elements/index.js.map +1 -0
- package/dist/src/core/hellpers/ApiClient.d.ts +58 -0
- package/dist/src/core/hellpers/ApiClient.d.ts.map +1 -0
- package/dist/src/core/hellpers/ApiClient.js +122 -0
- package/dist/src/core/hellpers/ApiClient.js.map +1 -0
- package/dist/src/core/hellpers/app.d.ts +3 -0
- package/dist/src/core/hellpers/app.d.ts.map +1 -0
- package/dist/src/core/hellpers/app.js +53 -0
- package/dist/src/core/hellpers/app.js.map +1 -0
- package/dist/src/core/hellpers/utils.d.ts +26 -0
- package/dist/src/core/hellpers/utils.d.ts.map +1 -0
- package/dist/src/core/hellpers/utils.js +96 -0
- package/dist/src/core/hellpers/utils.js.map +1 -0
- package/dist/src/core/routers/Router.d.ts +212 -0
- package/dist/src/core/routers/Router.d.ts.map +1 -0
- package/dist/src/core/routers/Router.js +623 -0
- package/dist/src/core/routers/Router.js.map +1 -0
- package/dist/src/core/routers/index.d.ts +3 -0
- package/dist/src/core/routers/index.d.ts.map +1 -0
- package/dist/src/core/routers/index.js +2 -0
- package/dist/src/core/routers/index.js.map +1 -0
- package/dist/src/core/services/BlockManager.d.ts +63 -0
- package/dist/src/core/services/BlockManager.d.ts.map +1 -0
- package/dist/src/core/services/BlockManager.js +191 -0
- package/dist/src/core/services/BlockManager.js.map +1 -0
- package/dist/src/core/services/DomService.d.ts +9 -0
- package/dist/src/core/services/DomService.d.ts.map +1 -0
- package/dist/src/core/services/DomService.js +18 -0
- package/dist/src/core/services/DomService.js.map +1 -0
- package/dist/src/core/services/EventService.d.ts +58 -0
- package/dist/src/core/services/EventService.d.ts.map +1 -0
- package/dist/src/core/services/EventService.js +212 -0
- package/dist/src/core/services/EventService.js.map +1 -0
- package/dist/src/core/services/HelperService.d.ts +443 -0
- package/dist/src/core/services/HelperService.d.ts.map +1 -0
- package/dist/src/core/services/HelperService.js +1650 -0
- package/dist/src/core/services/HelperService.js.map +1 -0
- package/dist/src/core/services/HttpService.d.ts +63 -0
- package/dist/src/core/services/HttpService.d.ts.map +1 -0
- package/dist/src/core/services/HttpService.js +182 -0
- package/dist/src/core/services/HttpService.js.map +1 -0
- package/dist/src/core/services/LoggerService.d.ts +56 -0
- package/dist/src/core/services/LoggerService.d.ts.map +1 -0
- package/dist/src/core/services/LoggerService.js +94 -0
- package/dist/src/core/services/LoggerService.js.map +1 -0
- package/dist/src/core/services/MarkerRegistry.d.ts +94 -0
- package/dist/src/core/services/MarkerRegistry.d.ts.map +1 -0
- package/dist/src/core/services/MarkerRegistry.js +199 -0
- package/dist/src/core/services/MarkerRegistry.js.map +1 -0
- package/dist/src/core/services/MarkerService.d.ts +299 -0
- package/dist/src/core/services/MarkerService.d.ts.map +1 -0
- package/dist/src/core/services/MarkerService.js +723 -0
- package/dist/src/core/services/MarkerService.js.map +1 -0
- package/dist/src/core/services/StorageService.d.ts +69 -0
- package/dist/src/core/services/StorageService.d.ts.map +1 -0
- package/dist/src/core/services/StorageService.js +243 -0
- package/dist/src/core/services/StorageService.js.map +1 -0
- package/dist/src/core/services/StoreService.d.ts +80 -0
- package/dist/src/core/services/StoreService.d.ts.map +1 -0
- package/dist/src/core/services/StoreService.js +301 -0
- package/dist/src/core/services/StoreService.js.map +1 -0
- package/dist/src/core/services/index.d.ts +9 -0
- package/dist/src/core/services/index.d.ts.map +1 -0
- package/dist/src/core/services/index.js +9 -0
- package/dist/src/core/services/index.js.map +1 -0
- package/dist/src/core/types/utils.d.ts +29 -0
- package/dist/src/core/types/utils.d.ts.map +1 -0
- package/dist/src/core/types/utils.js +22 -0
- package/dist/src/core/types/utils.js.map +1 -0
- package/dist/src/core/view/LoopContext.d.ts +38 -0
- package/dist/src/core/view/LoopContext.d.ts.map +1 -0
- package/dist/src/core/view/LoopContext.js +100 -0
- package/dist/src/core/view/LoopContext.js.map +1 -0
- package/dist/src/core/view/Section.d.ts +41 -0
- package/dist/src/core/view/Section.d.ts.map +1 -0
- package/dist/src/core/view/Section.js +67 -0
- package/dist/src/core/view/Section.js.map +1 -0
- package/dist/src/core/view/View.d.ts +63 -0
- package/dist/src/core/view/View.d.ts.map +1 -0
- package/dist/src/core/view/View.js +85 -0
- package/dist/src/core/view/View.js.map +1 -0
- package/dist/src/core/view/ViewController.d.ts +277 -0
- package/dist/src/core/view/ViewController.d.ts.map +1 -0
- package/dist/src/core/view/ViewController.js +862 -0
- package/dist/src/core/view/ViewController.js.map +1 -0
- package/dist/src/core/view/ViewManager.d.ts +141 -0
- package/dist/src/core/view/ViewManager.d.ts.map +1 -0
- package/dist/src/core/view/ViewManager.js +565 -0
- package/dist/src/core/view/ViewManager.js.map +1 -0
- package/dist/src/core/view/ViewState.d.ts +117 -0
- package/dist/src/core/view/ViewState.d.ts.map +1 -0
- package/dist/src/core/view/ViewState.js +410 -0
- package/dist/src/core/view/ViewState.js.map +1 -0
- package/dist/src/core/view/index.d.ts +6 -0
- package/dist/src/core/view/index.d.ts.map +1 -0
- package/dist/src/core/view/index.js +6 -0
- package/dist/src/core/view/index.js.map +1 -0
- package/index.ts +62 -0
- package/package.json +70 -0
- package/plugins.ts +77 -0
- package/src/core/app/Application.ts +410 -0
- package/src/core/bootstrap/app.ts +58 -0
- package/src/core/bootstrap/providers/ApiServiceProvider.ts +18 -0
- package/src/core/bootstrap/providers/CoreServiceProvider.ts +19 -0
- package/src/core/bootstrap/providers/HelperServiceProvider.ts +12 -0
- package/src/core/bootstrap/providers/RouteServiceProvider.ts +17 -0
- package/src/core/bootstrap/providers/ServiceProvider.ts +51 -0
- package/src/core/bootstrap/providers/ViewServiceProvider.ts +17 -0
- package/src/core/bootstrap/providers/default-providers.ts +94 -0
- package/src/core/bootstrap/providers/index.ts +9 -0
- package/src/core/bootstrap/providers/provider-order.test.ts +67 -0
- package/src/core/bootstrap/providers/provider-order.ts +66 -0
- package/src/core/cache/ViewCache.ts +102 -0
- package/src/core/cache/index.ts +1 -0
- package/src/core/contracts/ApiInterface.ts +11 -0
- package/src/core/contracts/ApplicationInterface.ts +79 -0
- package/src/core/contracts/BlockInterface.ts +76 -0
- package/src/core/contracts/ComponentInterface.ts +26 -0
- package/src/core/contracts/ElementInterface.ts +140 -0
- package/src/core/contracts/EventServiceInterface.ts +47 -0
- package/src/core/contracts/HelperInterface.ts +256 -0
- package/src/core/contracts/HttpServiceInterface.ts +51 -0
- package/src/core/contracts/LoggerServiceInterface.ts +48 -0
- package/src/core/contracts/LoopContextInterface.ts +15 -0
- package/src/core/contracts/MarkerInterface.ts +77 -0
- package/src/core/contracts/ReactiveInterface.ts +45 -0
- package/src/core/contracts/RouterInterface.ts +65 -0
- package/src/core/contracts/ServiceProviderInterface.ts +12 -0
- package/src/core/contracts/StorageServiceInterface.ts +48 -0
- package/src/core/contracts/StoreServiceInterface.ts +50 -0
- package/src/core/contracts/ViewCacheInterface.ts +14 -0
- package/src/core/contracts/ViewControllerInterface.ts +135 -0
- package/src/core/contracts/ViewInterface.ts +31 -0
- package/src/core/contracts/ViewManagerInterface.ts +45 -0
- package/src/core/contracts/ViewStateInterface.ts +47 -0
- package/src/core/contracts/common.ts +27 -0
- package/src/core/contracts/utils.ts +23 -0
- package/src/core/contracts/views.ts +23 -0
- package/src/core/elements/Block.ts +113 -0
- package/src/core/elements/BlockOutlet.ts +83 -0
- package/src/core/elements/Component.ts +114 -0
- package/src/core/elements/ElementManager.ts +48 -0
- package/src/core/elements/Fragment.ts +168 -0
- package/src/core/elements/Html.ts +364 -0
- package/src/core/elements/Output.ts +167 -0
- package/src/core/elements/Reactive.ts +253 -0
- package/src/core/elements/TextElement.ts +110 -0
- package/src/core/elements/Wrapper.ts +131 -0
- package/src/core/elements/Yield.ts +70 -0
- package/src/core/elements/helpers.ts +56 -0
- package/src/core/elements/index.ts +26 -0
- package/src/core/hellpers/ApiClient.ts +145 -0
- package/src/core/hellpers/app.ts +57 -0
- package/src/core/hellpers/utils.ts +109 -0
- package/src/core/routers/Router.ts +765 -0
- package/src/core/routers/index.ts +2 -0
- package/src/core/services/BlockManager.ts +210 -0
- package/src/core/services/DomService.ts +26 -0
- package/src/core/services/EventService.ts +266 -0
- package/src/core/services/HelperService.ts +1653 -0
- package/src/core/services/HttpService.ts +235 -0
- package/src/core/services/LoggerService.ts +139 -0
- package/src/core/services/MarkerRegistry.ts +239 -0
- package/src/core/services/MarkerService.ts +923 -0
- package/src/core/services/StorageService.ts +268 -0
- package/src/core/services/StoreService.ts +338 -0
- package/src/core/services/index.ts +8 -0
- package/src/core/types/utils.ts +30 -0
- package/src/core/view/LoopContext.ts +109 -0
- package/src/core/view/Section.ts +86 -0
- package/src/core/view/View.ts +109 -0
- package/src/core/view/ViewController.ts +1002 -0
- package/src/core/view/ViewManager.ts +700 -0
- package/src/core/view/ViewState.ts +453 -0
- package/src/core/view/index.ts +5 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ApplicationInterface } from "../../contracts/ApplicationInterface";
|
|
2
|
+
import { ServiceProviderInterface } from "../../contracts/utils";
|
|
3
|
+
import { app } from "../../hellpers/app";
|
|
4
|
+
import { OneObjectType, OOTEnum } from "../../types/utils";
|
|
5
|
+
import { NamedServiceProvider } from "./provider-order";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Base class cho Service Provider — API giống Laravel.
|
|
9
|
+
*
|
|
10
|
+
* Subclass chỉ cần:
|
|
11
|
+
* - Khai báo `name` và `dependsOn`
|
|
12
|
+
* - Override `register()` để bind services (dùng `this.app`)
|
|
13
|
+
* - Override `boot()` để init services sau khi tất cả đã register
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* class AuthServiceProvider extends ServiceProvider {
|
|
17
|
+
* readonly name = 'auth';
|
|
18
|
+
* readonly dependsOn = ['core', 'api'];
|
|
19
|
+
*
|
|
20
|
+
* register() {
|
|
21
|
+
* this.app.set('Auth', new AuthService(this.app));
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* boot() {
|
|
25
|
+
* this.app.get('Auth').loadUser();
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
export abstract class ServiceProvider implements ServiceProviderInterface {
|
|
30
|
+
readonly oneType: OneObjectType = OOTEnum.SERVICE_PROVIDER;
|
|
31
|
+
abstract readonly name: string;
|
|
32
|
+
readonly dependsOn?: string[];
|
|
33
|
+
protected app: ApplicationInterface;
|
|
34
|
+
|
|
35
|
+
constructor(application?: ApplicationInterface) {
|
|
36
|
+
this.app = application ?? app<ApplicationInterface>();
|
|
37
|
+
this.initApplication();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
initApplication(App?: ApplicationInterface): void {
|
|
41
|
+
if (!this.app || typeof this.app !== 'object' || this.app.oneType !== OOTEnum.APPLICATION) {
|
|
42
|
+
this.app = (App && App.oneType === OOTEnum.APPLICATION) ? App : app<ApplicationInterface>();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Override để đăng ký services vào container */
|
|
47
|
+
register(): void {}
|
|
48
|
+
|
|
49
|
+
/** Override để init services sau khi tất cả providers đã register */
|
|
50
|
+
boot(): void {}
|
|
51
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ViewManager } from "../../view";
|
|
2
|
+
import { PROVIDER_NAMES } from "./provider-order";
|
|
3
|
+
import { ServiceProvider } from "./ServiceProvider";
|
|
4
|
+
|
|
5
|
+
export class ViewServiceProvider extends ServiceProvider {
|
|
6
|
+
readonly name = PROVIDER_NAMES.VIEW;
|
|
7
|
+
readonly dependsOn = [PROVIDER_NAMES.CORE];
|
|
8
|
+
static config: Record<string, any> = {};
|
|
9
|
+
|
|
10
|
+
register(): void {
|
|
11
|
+
this.app.set<ViewManager>("View", new ViewManager(this.app), true);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
boot(): void {
|
|
15
|
+
this.app.get<ViewManager>("View").init(ViewServiceProvider.config);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ApplicationInterface } from "../../contracts/ApplicationInterface";
|
|
2
|
+
import { app } from "../../hellpers/app";
|
|
3
|
+
import { NamedServiceProvider, PROVIDER_NAMES } from "./provider-order";
|
|
4
|
+
import { ApiServiceProvider } from "./ApiServiceProvider";
|
|
5
|
+
import { CoreServiceProvider } from "./CoreServiceProvider";
|
|
6
|
+
import { HelperServiceProvider } from "./HelperServiceProvider";
|
|
7
|
+
import { RouteServiceProvider } from "./RouteServiceProvider";
|
|
8
|
+
import { ServiceProvider } from "./ServiceProvider";
|
|
9
|
+
import { ViewServiceProvider } from "./ViewServiceProvider";
|
|
10
|
+
import { ServiceProviderInterface } from "../../contracts/ServiceProviderInterface";
|
|
11
|
+
import { OOTEnum } from "../../types/utils";
|
|
12
|
+
|
|
13
|
+
/** Provider class type — constructor nhận optional app */
|
|
14
|
+
type ProviderClass = new (app?: ApplicationInterface) => ServiceProvider;
|
|
15
|
+
|
|
16
|
+
/** Tên system providers — không cho phép override */
|
|
17
|
+
const SYSTEM_PROVIDER_NAMES = new Set(Object.values(PROVIDER_NAMES));
|
|
18
|
+
|
|
19
|
+
/** Tên system services — không cho phép ghi đè qua config.services */
|
|
20
|
+
const SYSTEM_SERVICE_KEYS = new Set(['Marker', 'Store', 'Storage', 'Event', 'Http', 'View', 'Router', 'Helper', 'API']);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Chuyển `config.services` dạng { name: Class } thành NamedServiceProvider[].
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* services: { Auth: AuthService, Toast: ToastService }
|
|
27
|
+
* → 2 providers, mỗi cái dependsOn ['core'], register = app.set(name, new Class(app))
|
|
28
|
+
*/
|
|
29
|
+
function servicesFromMap(map: Record<string, new (app: ApplicationInterface) => any>): ServiceProviderInterface[] {
|
|
30
|
+
const appInstance = app<ApplicationInterface>();
|
|
31
|
+
return Object.entries(map)
|
|
32
|
+
.filter(([name]) => {
|
|
33
|
+
if (SYSTEM_SERVICE_KEYS.has(name)) {
|
|
34
|
+
console.warn(`[Bootstrap] Cannot override system service "${name}" via config.services. Ignored.`);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
})
|
|
39
|
+
.map(([name, ServiceClass]) => ({
|
|
40
|
+
name,
|
|
41
|
+
dependsOn: [PROVIDER_NAMES.CORE],
|
|
42
|
+
register() {
|
|
43
|
+
appInstance.set(name, new ServiceClass(appInstance));
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Tạo danh sách providers mặc định.
|
|
50
|
+
*
|
|
51
|
+
* Hỗ trợ:
|
|
52
|
+
* - Config cho service mặc định: `config.view`, `config.router`, `config.api`
|
|
53
|
+
* - Liệt kê provider class: `config.providers = [AuthServiceProvider, NotificationProvider]`
|
|
54
|
+
* - Liệt kê provider instance: `config.providers = [new AuthServiceProvider()]`
|
|
55
|
+
* - Đăng ký service đơn giản: `config.services = { Auth: AuthService, Toast: ToastService }`
|
|
56
|
+
*
|
|
57
|
+
* System providers (core, view, router, helper, api) luôn chạy trước và không thể bị ghi đè.
|
|
58
|
+
*/
|
|
59
|
+
export function buildDefaultProviders(config: Record<string, any> = {}): NamedServiceProvider[] {
|
|
60
|
+
// Set static config cho default providers trước khi tạo instance
|
|
61
|
+
ViewServiceProvider.config = config.view || {};
|
|
62
|
+
RouteServiceProvider.config = config.router || {};
|
|
63
|
+
ApiServiceProvider.config = config.api || {};
|
|
64
|
+
const App = app<ApplicationInterface>();
|
|
65
|
+
const defaults: NamedServiceProvider[] = [
|
|
66
|
+
CoreServiceProvider,
|
|
67
|
+
ViewServiceProvider,
|
|
68
|
+
RouteServiceProvider,
|
|
69
|
+
HelperServiceProvider,
|
|
70
|
+
ApiServiceProvider,
|
|
71
|
+
].map(Cls => new Cls(App));
|
|
72
|
+
|
|
73
|
+
// config.services: { Name: Class } → auto-wrap providers
|
|
74
|
+
const serviceProviders = config.services
|
|
75
|
+
? servicesFromMap(config.services)
|
|
76
|
+
: [];
|
|
77
|
+
|
|
78
|
+
// config.providers: (ProviderClass | NamedServiceProvider)[] → instantiate classes
|
|
79
|
+
const customProviders: NamedServiceProvider[] = Array.isArray(config.providers)
|
|
80
|
+
? config.providers
|
|
81
|
+
.map((p: ProviderClass | NamedServiceProvider) =>
|
|
82
|
+
typeof p === 'function' ? new p(App) : p
|
|
83
|
+
)
|
|
84
|
+
.filter(p => {
|
|
85
|
+
if (SYSTEM_PROVIDER_NAMES.has(p.name as any)) {
|
|
86
|
+
console.warn(`[Bootstrap] Cannot override system provider "${p.name}". Ignored.`);
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
})
|
|
91
|
+
: [];
|
|
92
|
+
|
|
93
|
+
return [...defaults, ...serviceProviders, ...customProviders];
|
|
94
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { NamedServiceProvider, resolveProviderOrder, PROVIDER_NAMES } from './provider-order';
|
|
2
|
+
export type { ProviderName } from './provider-order';
|
|
3
|
+
export { ServiceProvider } from './ServiceProvider';
|
|
4
|
+
export { buildDefaultProviders } from './default-providers';
|
|
5
|
+
export { CoreServiceProvider } from './CoreServiceProvider';
|
|
6
|
+
export { ViewServiceProvider } from './ViewServiceProvider';
|
|
7
|
+
export { RouteServiceProvider } from './RouteServiceProvider';
|
|
8
|
+
export { HelperServiceProvider } from './HelperServiceProvider';
|
|
9
|
+
export { ApiServiceProvider } from './ApiServiceProvider';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import { NamedServiceProvider, resolveProviderOrder, PROVIDER_NAMES } from "./provider-order";
|
|
4
|
+
|
|
5
|
+
function provider(name: string, dependsOn: string[] = []): NamedServiceProvider {
|
|
6
|
+
return {
|
|
7
|
+
name,
|
|
8
|
+
dependsOn,
|
|
9
|
+
register() {
|
|
10
|
+
// noop for ordering test
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe("resolveProviderOrder", () => {
|
|
16
|
+
it("orders providers by dependency graph", () => {
|
|
17
|
+
const ordered = resolveProviderOrder([
|
|
18
|
+
provider("router", ["view"]),
|
|
19
|
+
provider("api", ["core"]),
|
|
20
|
+
provider("view", ["core"]),
|
|
21
|
+
provider("core")
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const names = ordered.map((item) => item.name);
|
|
25
|
+
assert.deepEqual(names, ["core", "view", "router", "api"]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("works with PROVIDER_NAMES constants", () => {
|
|
29
|
+
const ordered = resolveProviderOrder([
|
|
30
|
+
provider(PROVIDER_NAMES.ROUTER, [PROVIDER_NAMES.VIEW]),
|
|
31
|
+
provider(PROVIDER_NAMES.VIEW, [PROVIDER_NAMES.CORE]),
|
|
32
|
+
provider(PROVIDER_NAMES.CORE),
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
const names = ordered.map((p) => p.name);
|
|
36
|
+
assert.equal(names.indexOf(PROVIDER_NAMES.CORE), 0);
|
|
37
|
+
assert.ok(names.indexOf(PROVIDER_NAMES.VIEW) < names.indexOf(PROVIDER_NAMES.ROUTER));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("throws for missing dependency", () => {
|
|
41
|
+
assert.throws(
|
|
42
|
+
() => resolveProviderOrder([provider("view", ["core"])]),
|
|
43
|
+
/Missing provider dependency/
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("throws for circular dependency", () => {
|
|
48
|
+
assert.throws(
|
|
49
|
+
() => resolveProviderOrder([
|
|
50
|
+
provider("a", ["b"]),
|
|
51
|
+
provider("b", ["c"]),
|
|
52
|
+
provider("c", ["a"])
|
|
53
|
+
]),
|
|
54
|
+
/Circular service provider dependency/
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("throws for duplicate provider names", () => {
|
|
59
|
+
assert.throws(
|
|
60
|
+
() => resolveProviderOrder([
|
|
61
|
+
provider("core"),
|
|
62
|
+
provider("core")
|
|
63
|
+
]),
|
|
64
|
+
/Duplicate provider name/
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ServiceProviderInterface } from "../../contracts/ServiceProviderInterface";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tên các provider mặc định — dùng constant thay vì magic string.
|
|
5
|
+
* Custom providers có thể dùng tên khác hoặc override tên mặc định.
|
|
6
|
+
*/
|
|
7
|
+
export const PROVIDER_NAMES = {
|
|
8
|
+
CORE: 'core',
|
|
9
|
+
VIEW: 'view',
|
|
10
|
+
ROUTER: 'router',
|
|
11
|
+
HELPER: 'helper',
|
|
12
|
+
API: 'api',
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type ProviderName = typeof PROVIDER_NAMES[keyof typeof PROVIDER_NAMES];
|
|
16
|
+
|
|
17
|
+
export type NamedServiceProvider = ServiceProviderInterface & {
|
|
18
|
+
name: string;
|
|
19
|
+
dependsOn?: string[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function resolveProviderOrder(providers: ServiceProviderInterface[]): ServiceProviderInterface[] {
|
|
23
|
+
const providerMap = new Map<string, ServiceProviderInterface>();
|
|
24
|
+
for (const provider of providers) {
|
|
25
|
+
if (!provider.name) {
|
|
26
|
+
throw new Error(`[Bootstrap] Provider name is required.`);
|
|
27
|
+
}
|
|
28
|
+
if (providerMap.has(provider.name)) {
|
|
29
|
+
throw new Error(`[Bootstrap] Duplicate provider name detected: "${provider.name}".`);
|
|
30
|
+
}
|
|
31
|
+
providerMap.set(provider.name, provider);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const visited = new Set<string>();
|
|
35
|
+
const inStack = new Set<string>();
|
|
36
|
+
const ordered: ServiceProviderInterface[] = [];
|
|
37
|
+
|
|
38
|
+
const visit = (name: string): void => {
|
|
39
|
+
if (visited.has(name)) return;
|
|
40
|
+
if (inStack.has(name)) {
|
|
41
|
+
throw new Error(`[Bootstrap] Circular service provider dependency detected at "${name}".`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const provider = providerMap.get(name);
|
|
45
|
+
if (!provider) {
|
|
46
|
+
throw new Error(`[Bootstrap] Missing provider dependency: "${name}".`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
inStack.add(name);
|
|
50
|
+
for (const dep of provider.dependsOn ?? []) {
|
|
51
|
+
visit(dep);
|
|
52
|
+
}
|
|
53
|
+
inStack.delete(name);
|
|
54
|
+
|
|
55
|
+
visited.add(name);
|
|
56
|
+
ordered.push(provider);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
for (const provider of providers) {
|
|
60
|
+
if (provider.name) {
|
|
61
|
+
visit(provider.name);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return ordered;
|
|
66
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ViewCacheInterface } from "../contracts/ViewCacheInterface";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ViewCache — stores rendered view DOM for instant restore on navigation.
|
|
5
|
+
*
|
|
6
|
+
* When a user navigates away from a page, the view's DOM is detached and
|
|
7
|
+
* stored in a DocumentFragment. When navigating back, the DOM is
|
|
8
|
+
* re-attached instead of re-rendered — preserving form inputs, scroll
|
|
9
|
+
* positions, and in-progress user work.
|
|
10
|
+
*
|
|
11
|
+
* Used by the router/BlockManager to implement "keep-alive" behavior.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Router navigates away from 'home'
|
|
15
|
+
* cache.store('home', homeRootElement);
|
|
16
|
+
*
|
|
17
|
+
* // Router navigates back to 'home'
|
|
18
|
+
* const cached = cache.retrieve('home');
|
|
19
|
+
* if (cached) container.appendChild(cached); // instant restore!
|
|
20
|
+
*/
|
|
21
|
+
export class ViewCache implements ViewCacheInterface {
|
|
22
|
+
private cache: Map<string, HTMLElement | DocumentFragment> = new Map();
|
|
23
|
+
|
|
24
|
+
/** Maximum cached views (LRU eviction when exceeded) */
|
|
25
|
+
private maxSize: number;
|
|
26
|
+
|
|
27
|
+
/** Access order tracking for LRU */
|
|
28
|
+
private accessOrder: string[] = [];
|
|
29
|
+
|
|
30
|
+
constructor(maxSize: number = 10) {
|
|
31
|
+
this.maxSize = maxSize;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Store a view's DOM state */
|
|
35
|
+
store(viewId: string, element: HTMLElement | DocumentFragment): void {
|
|
36
|
+
// If already cached, update
|
|
37
|
+
if (this.cache.has(viewId)) {
|
|
38
|
+
this.cache.set(viewId, element);
|
|
39
|
+
this.touchAccess(viewId);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Evict oldest if at capacity
|
|
44
|
+
if (this.cache.size >= this.maxSize) {
|
|
45
|
+
this.evictOldest();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this.cache.set(viewId, element);
|
|
49
|
+
this.accessOrder.push(viewId);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Retrieve cached DOM — returns null if not cached */
|
|
53
|
+
retrieve(viewId: string): HTMLElement | DocumentFragment | null {
|
|
54
|
+
const cached = this.cache.get(viewId) ?? null;
|
|
55
|
+
if (cached) {
|
|
56
|
+
this.touchAccess(viewId);
|
|
57
|
+
}
|
|
58
|
+
return cached;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Check if a view is cached */
|
|
62
|
+
has(viewId: string): boolean {
|
|
63
|
+
return this.cache.has(viewId);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Remove a specific view from cache */
|
|
67
|
+
remove(viewId: string): void {
|
|
68
|
+
this.cache.delete(viewId);
|
|
69
|
+
this.accessOrder = this.accessOrder.filter(id => id !== viewId);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Clear all cached views */
|
|
73
|
+
clear(): void {
|
|
74
|
+
this.cache.clear();
|
|
75
|
+
this.accessOrder = [];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Get number of cached views */
|
|
79
|
+
get size(): number {
|
|
80
|
+
return this.cache.size;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Get all cached view IDs */
|
|
84
|
+
keys(): string[] {
|
|
85
|
+
return [...this.cache.keys()];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ─── Private ────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
/** Move viewId to end of access order (most recently used) */
|
|
91
|
+
private touchAccess(viewId: string): void {
|
|
92
|
+
this.accessOrder = this.accessOrder.filter(id => id !== viewId);
|
|
93
|
+
this.accessOrder.push(viewId);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Remove the least recently used cached view */
|
|
97
|
+
private evictOldest(): void {
|
|
98
|
+
if (this.accessOrder.length === 0) return;
|
|
99
|
+
const oldest = this.accessOrder.shift()!;
|
|
100
|
+
this.cache.delete(oldest);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ViewCache } from './ViewCache';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpService } from '../services/HttpService.js';
|
|
2
|
+
|
|
3
|
+
export interface APIClientInterface {
|
|
4
|
+
init(config: Record<string, any>): void;
|
|
5
|
+
getViewData<T = any>(uri: string): Promise<T>;
|
|
6
|
+
getSystemConfig<T = any>(): Promise<T>;
|
|
7
|
+
getSystemData<T = any>(): Promise<T>;
|
|
8
|
+
getURIData<T = any>(): Promise<T>;
|
|
9
|
+
setEndpoint(key: string, value: string): void;
|
|
10
|
+
getHttpService(): HttpService;
|
|
11
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// ─── Application Interface ───────────────────────────────────────
|
|
2
|
+
|
|
3
|
+
import { RouterInterface, ViewManagerInterface } from "./utils";
|
|
4
|
+
import type { HelperInterface } from "./HelperInterface";
|
|
5
|
+
import type { EventServiceInterface } from "./EventServiceInterface";
|
|
6
|
+
import type { HttpServiceInterface } from "./HttpServiceInterface";
|
|
7
|
+
import type { StoreServiceInterface } from "./StoreServiceInterface";
|
|
8
|
+
import type { StorageServiceInterface } from "./StorageServiceInterface";
|
|
9
|
+
import type { LoggerServiceInterface } from "./LoggerServiceInterface";
|
|
10
|
+
import { APIClientInterface } from "./ApiInterface";
|
|
11
|
+
import type { ServiceProviderInterface } from "./ServiceProviderInterface";
|
|
12
|
+
import { OneObjectType } from "../types/utils";
|
|
13
|
+
|
|
14
|
+
export interface ApplicationInterface {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
transient<T>(key: ServiceKey, value: any): this;
|
|
17
|
+
bind<T>(key: ServiceKey, value: any): this;
|
|
18
|
+
singleton<T>(key: ServiceKey, value?: any): this;
|
|
19
|
+
instance<T>(key: ServiceKey, value: T): this;
|
|
20
|
+
alias(alias: string | symbol, key: ServiceKey): this;
|
|
21
|
+
make<T>(key: ServiceKey, defaultValue?: T): T;
|
|
22
|
+
resolve<T>(key: ServiceKey, defaultValue?: T): T;
|
|
23
|
+
has(key: ServiceKey): boolean;
|
|
24
|
+
bound(key: ServiceKey): boolean;
|
|
25
|
+
register(provider: ServiceProviderInterface): this;
|
|
26
|
+
boot(): void;
|
|
27
|
+
flush(): void;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
set<T = any>(name: string, method: T, isOne?: boolean): void;
|
|
30
|
+
setMethod(name: string, method: Function, isOne?: boolean): void;
|
|
31
|
+
get<T = any>(name: string): T;
|
|
32
|
+
|
|
33
|
+
oneType?: OneObjectType;
|
|
34
|
+
|
|
35
|
+
// Service properties — set during bootstrap via App.set()
|
|
36
|
+
isInitialized: boolean;
|
|
37
|
+
isStarted: boolean;
|
|
38
|
+
View: ViewManagerInterface;
|
|
39
|
+
Router: RouterInterface;
|
|
40
|
+
Helper: HelperInterface;
|
|
41
|
+
Events: EventServiceInterface;
|
|
42
|
+
Http: HttpServiceInterface;
|
|
43
|
+
API: APIClientInterface;
|
|
44
|
+
Store: StoreServiceInterface;
|
|
45
|
+
Storage: StorageServiceInterface;
|
|
46
|
+
Logger: LoggerServiceInterface;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ─── App Factory (helper function type) ─────────────────────────
|
|
50
|
+
|
|
51
|
+
/** Type cho helper function app() — callable + có methods */
|
|
52
|
+
export interface AppFactory {
|
|
53
|
+
<T>(): T;
|
|
54
|
+
(): ApplicationInterface;
|
|
55
|
+
<T>(key: ServiceKey): T;
|
|
56
|
+
(key: ServiceKey, value: any): ApplicationInterface;
|
|
57
|
+
make<T>(name: ServiceKey): T;
|
|
58
|
+
make<T>(name: ServiceKey, defaultValue: T): T;
|
|
59
|
+
instance<T>(name: ServiceKey, value: T): ApplicationInterface;
|
|
60
|
+
resolve<T>(name: ServiceKey): T;
|
|
61
|
+
resolve<T>(name: ServiceKey, defaultValue: T): T;
|
|
62
|
+
register<T>(name: ServiceKey, factory: () => T): ApplicationInterface;
|
|
63
|
+
bind<T>(name: ServiceKey, factory: () => T): ApplicationInterface;
|
|
64
|
+
singleton<T>(name: ServiceKey, factory: () => T): ApplicationInterface;
|
|
65
|
+
has(name: ServiceKey): boolean;
|
|
66
|
+
flush(): void;
|
|
67
|
+
destroy(): void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ─── Application / DI Types ─────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
/** Định danh duy nhất cho service: string, symbol, hoặc class constructor */
|
|
73
|
+
export type ServiceKey<T = any> = string | symbol | (new (...args: any[]) => T);
|
|
74
|
+
|
|
75
|
+
/** Factory function nhận app (container) để resolve dependencies */
|
|
76
|
+
export type ServiceFactory<T> = (app: ApplicationInterface) => T;
|
|
77
|
+
|
|
78
|
+
/** Giá trị có thể bind: factory function hoặc class constructor */
|
|
79
|
+
export type ServiceBinding<T = any> = ServiceFactory<T> | (new (...args: any[]) => T);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { OneObjectType } from "../types/utils";
|
|
2
|
+
import type { ViewControllerInterface } from "./ViewControllerInterface";
|
|
3
|
+
import type { HtmlInterface, FragmentInterface, OneChildrenFactoryOutput, OneNodeInterface } from "./ElementInterface";
|
|
4
|
+
import { InitMode } from "./common";
|
|
5
|
+
|
|
6
|
+
// ─── Block / Layout Interfaces ───────────────────────────────────
|
|
7
|
+
export type BlockConstructorParams = {
|
|
8
|
+
ctx: ViewControllerInterface;
|
|
9
|
+
name: string;
|
|
10
|
+
viewId?: string | null;
|
|
11
|
+
contentRenderFactory?: BlockRenderFactory;
|
|
12
|
+
id?: string | null;
|
|
13
|
+
initMode?: InitMode;
|
|
14
|
+
};
|
|
15
|
+
export interface BlockInterface {
|
|
16
|
+
oneType: OneObjectType;
|
|
17
|
+
/** Unique block slot name (e.g. 'content', 'sidebar') */
|
|
18
|
+
name: string;
|
|
19
|
+
id: string;
|
|
20
|
+
ctx: ViewControllerInterface;
|
|
21
|
+
viewId: string | null;
|
|
22
|
+
openTag: Comment;
|
|
23
|
+
closeTag: Comment;
|
|
24
|
+
fragment: FragmentInterface | null;
|
|
25
|
+
parentElement: HtmlInterface | null;
|
|
26
|
+
domChildren: Node[];
|
|
27
|
+
isOneElement: boolean;
|
|
28
|
+
isOneBlock: boolean;
|
|
29
|
+
initMode?: InitMode;
|
|
30
|
+
/** Initialize the block (e.g. during hydration) */
|
|
31
|
+
init(): void;
|
|
32
|
+
/** Render the block's content into the parent element */
|
|
33
|
+
render(): void;
|
|
34
|
+
/** Mount the block's content into the DOM, finding matching outlets */
|
|
35
|
+
mount(mountCtx: ViewControllerInterface, parentElement: HtmlInterface): any;
|
|
36
|
+
/** Unmount the block's content from the DOM */
|
|
37
|
+
unmount(): void;
|
|
38
|
+
/** Destroy the block and clean up resources */
|
|
39
|
+
destroy(): void;
|
|
40
|
+
/** Update the block's content (e.g. on state change) */
|
|
41
|
+
update(): void;
|
|
42
|
+
/** Set the block's parent element (used for mounting) */
|
|
43
|
+
setParentElement(parentElement: HtmlInterface | null): void;
|
|
44
|
+
|
|
45
|
+
contentRenderFactory: BlockRenderFactory | null;
|
|
46
|
+
// new(params: BlockConstructorParams, ...args: any[]): BlockInterface;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface BlockOutletInterface extends OneNodeInterface {
|
|
50
|
+
oneType: OneObjectType;
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
parent: HtmlInterface | null;
|
|
54
|
+
openTag: Comment;
|
|
55
|
+
closeTag: Comment;
|
|
56
|
+
parentElement: HtmlInterface | null;
|
|
57
|
+
ctx: ViewControllerInterface;
|
|
58
|
+
initMode: InitMode;
|
|
59
|
+
isOneElement: boolean;
|
|
60
|
+
isOneBlockOutlet: boolean;
|
|
61
|
+
/** Render the outlet's markers into the parent element */
|
|
62
|
+
render(): any;
|
|
63
|
+
hydrate(): any;
|
|
64
|
+
destroy(): any;
|
|
65
|
+
start(): any;
|
|
66
|
+
stop(): any;
|
|
67
|
+
setParentElement(parentElement: HtmlInterface | null): any;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface BlockManagerInterface {
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ─── Block Types ────────────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
export type BlockRenderFactory = (parentElement: HtmlInterface) => OneChildrenFactoryOutput;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OneObjectType } from "../types/utils";
|
|
2
|
+
import type { ViewControllerInterface } from "./ViewControllerInterface";
|
|
3
|
+
import type { ViewInterface } from "./ViewInterface";
|
|
4
|
+
import type { HtmlInterface } from "./ElementInterface";
|
|
5
|
+
|
|
6
|
+
// ─── Component Interface ─────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
export interface ComponentInterface {
|
|
9
|
+
oneType: OneObjectType;
|
|
10
|
+
id: string;
|
|
11
|
+
ctx: ViewControllerInterface;
|
|
12
|
+
viewRef: ViewInterface | null;
|
|
13
|
+
parent: HtmlInterface | null;
|
|
14
|
+
data: Record<string, any>;
|
|
15
|
+
openTag: Comment;
|
|
16
|
+
closeTag: Comment;
|
|
17
|
+
stateKeys: string[];
|
|
18
|
+
subscribeFn: () => void;
|
|
19
|
+
unsubscribeFn: () => void;
|
|
20
|
+
render(): void;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
setParent(parent: HtmlInterface | null): void;
|
|
23
|
+
isOneElement: boolean;
|
|
24
|
+
isOneComponent: boolean;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|