@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,210 @@
|
|
|
1
|
+
import type { BlockInterface, BlockManagerInterface, BlockOutletInterface, BlockRenderFactory } from "../contracts/BlockInterface";
|
|
2
|
+
import type { HtmlInterface } from "../contracts/ElementInterface";
|
|
3
|
+
import type { ViewControllerInterface } from "../contracts/ViewControllerInterface";
|
|
4
|
+
import { Block } from "../elements/Block";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* BlockManager — manages all block slots in a layout view.
|
|
8
|
+
*
|
|
9
|
+
* Responsibilities:
|
|
10
|
+
* - Register block slots declared by @useBlock(name) in layout
|
|
11
|
+
* - Track which blocks exist and their active state
|
|
12
|
+
* - Coordinate mounting/unmounting when router navigates
|
|
13
|
+
* - Provide block state info (active viewId, cached views, etc.)
|
|
14
|
+
*
|
|
15
|
+
* Lifecycle:
|
|
16
|
+
* 1. Layout view creates BlockManager
|
|
17
|
+
* 2. Layout's render() calls manager.register('content', parentEl) for each @useBlock
|
|
18
|
+
* 3. Router calls manager.mount('content', viewId, factory) on navigation
|
|
19
|
+
* 4. On browser back/forward, router calls mount with previous viewId
|
|
20
|
+
* → Block restores cached DOM instead of re-rendering
|
|
21
|
+
* 5. When layout deactivates, manager.unmountAll() hides all content
|
|
22
|
+
*/
|
|
23
|
+
export class BlockManagerService implements BlockManagerInterface {
|
|
24
|
+
blocks: Map<string, BlockInterface> = new Map();
|
|
25
|
+
blockOutlets: Map<string, BlockOutletInterface> = new Map();
|
|
26
|
+
activeBlocks: Map<string, BlockInterface> = new Map();
|
|
27
|
+
listeners: Map<string, ((block: BlockInterface) => void)[]> = new Map();
|
|
28
|
+
|
|
29
|
+
/** Tracks children mounted into each outlet for cleanup */
|
|
30
|
+
private mountedChildren: Map<string, any[]> = new Map();
|
|
31
|
+
|
|
32
|
+
constructor() {}
|
|
33
|
+
|
|
34
|
+
add(block: BlockInterface): void {
|
|
35
|
+
const key = block.name + (block.viewId ?? '');
|
|
36
|
+
if (!this.blocks.has(key)) {
|
|
37
|
+
this.blocks.set(key, block);
|
|
38
|
+
}
|
|
39
|
+
this.active(block.name, block.viewId ?? '');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
active(name: string, viewId: string): void {
|
|
43
|
+
const key = name + viewId;
|
|
44
|
+
const block = this.blocks.get(key);
|
|
45
|
+
if (block) {
|
|
46
|
+
this.activeBlocks.set(name, block);
|
|
47
|
+
const listeners = this.listeners.get(name);
|
|
48
|
+
if (listeners) {
|
|
49
|
+
listeners.forEach(fn => fn(block));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
subscribe(name: string, callback: (block: BlockInterface) => void): () => void {
|
|
55
|
+
if (!this.listeners.has(name)) {
|
|
56
|
+
this.listeners.set(name, []);
|
|
57
|
+
}
|
|
58
|
+
this.listeners.get(name)!.push(callback);
|
|
59
|
+
return () => this.unsubscribe(name, callback);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
unsubscribe(name: string, callback?: (block: BlockInterface) => void): void {
|
|
63
|
+
if (!this.listeners.has(name)) return;
|
|
64
|
+
if (!callback) {
|
|
65
|
+
this.listeners.delete(name);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const listeners = this.listeners.get(name);
|
|
69
|
+
if (listeners) {
|
|
70
|
+
this.listeners.set(name, listeners.filter(fn => fn !== callback));
|
|
71
|
+
if (this.listeners.get(name)!.length === 0) {
|
|
72
|
+
this.listeners.delete(name);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
addOutlet(key: string, outlet: BlockOutletInterface): void {
|
|
78
|
+
if (!this.blockOutlets.has(key)) {
|
|
79
|
+
this.blockOutlets.set(key, outlet);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
hasOutlet(key: string): boolean {
|
|
84
|
+
return this.blockOutlets.has(key);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
getOutlet(key: string): BlockOutletInterface | undefined {
|
|
88
|
+
return this.blockOutlets.get(key);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Mount all registered blocks into their corresponding outlets.
|
|
93
|
+
* Called by ViewManager after layout + page views are both rendered.
|
|
94
|
+
*
|
|
95
|
+
* Iterates activeBlocks by name, finds matching outlet (keyed by
|
|
96
|
+
* viewId:blockName), and inserts block content between outlet markers.
|
|
97
|
+
*/
|
|
98
|
+
mountAll(): void {
|
|
99
|
+
for (const [name, block] of this.activeBlocks) {
|
|
100
|
+
// Try to find an outlet that matches this block name
|
|
101
|
+
for (const [outletKey, outlet] of this.blockOutlets) {
|
|
102
|
+
if (outletKey.endsWith(`:${name}`) || outlet.name === name) {
|
|
103
|
+
if (block.contentRenderFactory) {
|
|
104
|
+
this.mountBlockIntoOutlet(block, outlet);
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Mount a single block's content into an outlet.
|
|
114
|
+
* Content is rendered and inserted between the outlet's open/close markers.
|
|
115
|
+
*/
|
|
116
|
+
private mountBlockIntoOutlet(block: BlockInterface, outlet: BlockOutletInterface): void {
|
|
117
|
+
if (!outlet.parentElement?.element) return;
|
|
118
|
+
|
|
119
|
+
const parentEl = outlet.parentElement.element;
|
|
120
|
+
const children: any[] = [];
|
|
121
|
+
|
|
122
|
+
// Render block content using the factory
|
|
123
|
+
const content = block.contentRenderFactory!(block.ctx as any);
|
|
124
|
+
|
|
125
|
+
if (!Array.isArray(content)) return;
|
|
126
|
+
|
|
127
|
+
// Insert each child between outlet markers
|
|
128
|
+
for (const child of content) {
|
|
129
|
+
if (typeof child === 'string' || typeof child === 'number') {
|
|
130
|
+
const textNode = document.createTextNode(String(child));
|
|
131
|
+
parentEl.insertBefore(textNode, outlet.closeTag);
|
|
132
|
+
} else if (child && typeof child === 'object') {
|
|
133
|
+
if ('element' in child) {
|
|
134
|
+
// HtmlInterface, TextInterface
|
|
135
|
+
parentEl.insertBefore(child.element, outlet.closeTag);
|
|
136
|
+
children.push(child);
|
|
137
|
+
child.render();
|
|
138
|
+
} else if ('openTag' in child) {
|
|
139
|
+
// Reactive, Fragment, Output — set parent, render
|
|
140
|
+
if ('parent' in child) {
|
|
141
|
+
(child as any).parent = outlet.parentElement;
|
|
142
|
+
}
|
|
143
|
+
if ('parentElement' in child) {
|
|
144
|
+
(child as any).parentElement = outlet.parentElement;
|
|
145
|
+
}
|
|
146
|
+
children.push(child);
|
|
147
|
+
child.render();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Track mounted children for cleanup
|
|
153
|
+
this.mountedChildren.set(outlet.name, children);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Clear content from a specific outlet (for page swap).
|
|
158
|
+
* Removes all DOM nodes between a named outlet's markers.
|
|
159
|
+
*/
|
|
160
|
+
clearOutlet(name: string): void {
|
|
161
|
+
// Find outlet by name
|
|
162
|
+
for (const [key, outlet] of this.blockOutlets) {
|
|
163
|
+
if (outlet.name === name) {
|
|
164
|
+
// Destroy tracked children first
|
|
165
|
+
const children = this.mountedChildren.get(name) || [];
|
|
166
|
+
if (children) {
|
|
167
|
+
for (const child of children) {
|
|
168
|
+
if ('destroy' in child && typeof child.destroy === 'function') {
|
|
169
|
+
child.destroy();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
this.mountedChildren.delete(name);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Remove any remaining DOM nodes between markers
|
|
176
|
+
let current = outlet.openTag.nextSibling;
|
|
177
|
+
while (current && current !== outlet.closeTag) {
|
|
178
|
+
const next = current.nextSibling;
|
|
179
|
+
current.remove();
|
|
180
|
+
current = next;
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Clear all outlets (for full layout teardown).
|
|
189
|
+
*/
|
|
190
|
+
clearAllOutlets(): void {
|
|
191
|
+
for (const [key, outlet] of this.blockOutlets) {
|
|
192
|
+
this.clearOutlet(outlet.name);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Full cleanup — destroy all blocks, outlets, listeners.
|
|
198
|
+
*/
|
|
199
|
+
destroy(): void {
|
|
200
|
+
this.clearAllOutlets();
|
|
201
|
+
this.blocks.clear();
|
|
202
|
+
this.blockOutlets.clear();
|
|
203
|
+
this.activeBlocks.clear();
|
|
204
|
+
this.listeners.clear();
|
|
205
|
+
this.mountedChildren.clear();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export const BlockManager = new BlockManagerService();
|
|
210
|
+
export default BlockManager;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { app } from "../hellpers/app";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class DomService {
|
|
5
|
+
private container: HTMLTemplateElement;
|
|
6
|
+
constructor() {
|
|
7
|
+
this.container = document.createElement('template');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
parse(html: string): Node[]{
|
|
11
|
+
this.container.innerHTML = html;
|
|
12
|
+
const content = this.container.content;
|
|
13
|
+
this.container.innerHTML = ''; // Clear template content to free memory
|
|
14
|
+
return Array.from(content.childNodes);
|
|
15
|
+
}
|
|
16
|
+
create(tagName: string, options?: ElementCreationOptions): HTMLElement {
|
|
17
|
+
return document.createElement(tagName, options);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export const Dom = app(DomService);
|
|
26
|
+
export default Dom;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventService — Pub/Sub event bus.
|
|
3
|
+
*
|
|
4
|
+
* Supports:
|
|
5
|
+
* - Single event: on('click', fn)
|
|
6
|
+
* - Multiple events: on(['click', 'hover'], fn) — fn called once per emit batch
|
|
7
|
+
* - Space-separated: on('click hover', fn)
|
|
8
|
+
* - Object syntax: on({ click: fn1, hover: fn2 })
|
|
9
|
+
* - Once: once('click', fn)
|
|
10
|
+
*
|
|
11
|
+
* Not a singleton — register via DI:
|
|
12
|
+
* app.singleton('event', EventService);
|
|
13
|
+
* app.make<EventService>('event').on('route:change', fn);
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// ─── Types ──────────────────────────────────────────────────────
|
|
17
|
+
|
|
18
|
+
export type EventCallback = (...args: any[]) => void;
|
|
19
|
+
|
|
20
|
+
interface SingleListener {
|
|
21
|
+
callback: EventCallback;
|
|
22
|
+
once: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface MultiListener {
|
|
26
|
+
events: Set<string>;
|
|
27
|
+
callback: EventCallback;
|
|
28
|
+
once: boolean;
|
|
29
|
+
called: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ─── EventService ───────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
export class EventService {
|
|
35
|
+
|
|
36
|
+
static instances: Map<any, EventService> = new Map();
|
|
37
|
+
|
|
38
|
+
static getInstance(key: any = 'default'): EventService {
|
|
39
|
+
if (!EventService.instances.has(key)) {
|
|
40
|
+
EventService.instances.set(key, new EventService());
|
|
41
|
+
}
|
|
42
|
+
return EventService.instances.get(key)!;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static instance(key: any = 'default'): EventService {
|
|
46
|
+
return EventService.getInstance(key);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static removeInstance(key: any = 'default'): void {
|
|
50
|
+
EventService.instances.delete(key);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
private listeners = new Map<string, SingleListener[]>();
|
|
55
|
+
private multiListeners: MultiListener[] = [];
|
|
56
|
+
|
|
57
|
+
// ─── Subscribe ──────────────────────────────────────────────
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Subscribe to events. Returns unsubscribe function.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* event.on('save', (data) => { ... });
|
|
64
|
+
* event.on(['save', 'update'], (data) => { ... });
|
|
65
|
+
* event.on('save update', (data) => { ... });
|
|
66
|
+
* event.on({ save: fn1, update: fn2 });
|
|
67
|
+
*/
|
|
68
|
+
on(
|
|
69
|
+
event: string | string[] | Record<string, EventCallback>,
|
|
70
|
+
callback?: EventCallback | boolean,
|
|
71
|
+
once: boolean = false,
|
|
72
|
+
): () => void {
|
|
73
|
+
// Object syntax: on({ click: fn1, hover: fn2 })
|
|
74
|
+
if (typeof event === 'object' && !Array.isArray(event)) {
|
|
75
|
+
const unsubs: Array<() => void> = [];
|
|
76
|
+
for (const [name, fn] of Object.entries(event)) {
|
|
77
|
+
if (typeof fn === 'function') {
|
|
78
|
+
unsubs.push(this.on(name, fn, callback === true));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return () => unsubs.forEach((u) => u());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Space-separated → array
|
|
85
|
+
if (typeof event === 'string' && event.includes(' ')) {
|
|
86
|
+
event = event.split(/\s+/).filter(Boolean);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Array of events — multi-listener (fires once per emit batch)
|
|
90
|
+
if (Array.isArray(event)) {
|
|
91
|
+
const events = new Set(event.filter((e) => typeof e === 'string'));
|
|
92
|
+
if (events.size === 0) return () => { };
|
|
93
|
+
|
|
94
|
+
const listener: MultiListener = {
|
|
95
|
+
events,
|
|
96
|
+
callback: callback as EventCallback,
|
|
97
|
+
once,
|
|
98
|
+
called: false,
|
|
99
|
+
};
|
|
100
|
+
this.multiListeners.push(listener);
|
|
101
|
+
|
|
102
|
+
return () => {
|
|
103
|
+
const idx = this.multiListeners.indexOf(listener);
|
|
104
|
+
if (idx !== -1) this.multiListeners.splice(idx, 1);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Single event
|
|
109
|
+
if (typeof event !== 'string' || typeof callback !== 'function') return () => { };
|
|
110
|
+
|
|
111
|
+
if (!this.listeners.has(event)) {
|
|
112
|
+
this.listeners.set(event, []);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const listener: SingleListener = { callback, once };
|
|
116
|
+
this.listeners.get(event)!.push(listener);
|
|
117
|
+
|
|
118
|
+
return () => this.off(event as string, callback as EventCallback);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Subscribe once — auto-unsubscribe after first call */
|
|
122
|
+
once(
|
|
123
|
+
event: string | string[] | Record<string, EventCallback>,
|
|
124
|
+
callback?: EventCallback,
|
|
125
|
+
): () => void {
|
|
126
|
+
return this.on(event, callback, true);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ─── Unsubscribe ────────────────────────────────────────────
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Unsubscribe from events.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* event.off('save'); // remove all listeners for 'save'
|
|
136
|
+
* event.off('save', fn); // remove specific listener
|
|
137
|
+
* event.off(['save', 'update']);
|
|
138
|
+
* event.off({ save: fn1 });
|
|
139
|
+
*/
|
|
140
|
+
off(
|
|
141
|
+
event: string | string[] | Record<string, EventCallback>,
|
|
142
|
+
callback?: EventCallback,
|
|
143
|
+
): void {
|
|
144
|
+
// Object syntax
|
|
145
|
+
if (typeof event === 'object' && !Array.isArray(event)) {
|
|
146
|
+
for (const [name, fn] of Object.entries(event)) {
|
|
147
|
+
this.off(name, fn);
|
|
148
|
+
}
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Space-separated
|
|
153
|
+
if (typeof event === 'string' && event.includes(' ')) {
|
|
154
|
+
event = event.split(/\s+/).filter(Boolean);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Array
|
|
158
|
+
if (Array.isArray(event)) {
|
|
159
|
+
const eventSet = new Set(event);
|
|
160
|
+
this.multiListeners = this.multiListeners.filter((l) => {
|
|
161
|
+
if (callback && l.callback !== callback) return true;
|
|
162
|
+
return ![...l.events].some((e) => eventSet.has(e));
|
|
163
|
+
});
|
|
164
|
+
event.forEach((e) => this.off(e, callback));
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Single event
|
|
169
|
+
if (typeof event !== 'string') return;
|
|
170
|
+
|
|
171
|
+
if (!callback) {
|
|
172
|
+
this.listeners.delete(event);
|
|
173
|
+
} else {
|
|
174
|
+
const list = this.listeners.get(event);
|
|
175
|
+
if (list) {
|
|
176
|
+
const filtered = list.filter((l) => l.callback !== callback);
|
|
177
|
+
filtered.length > 0
|
|
178
|
+
? this.listeners.set(event, filtered)
|
|
179
|
+
: this.listeners.delete(event);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// ─── Emit ───────────────────────────────────────────────────
|
|
185
|
+
|
|
186
|
+
/** Emit event with arguments */
|
|
187
|
+
emit(event: string, ...args: any[]): void {
|
|
188
|
+
// Reset multi-listener flags
|
|
189
|
+
this.multiListeners.forEach((l) => (l.called = false));
|
|
190
|
+
|
|
191
|
+
// Single listeners
|
|
192
|
+
const list = this.listeners.get(event);
|
|
193
|
+
if (list) {
|
|
194
|
+
const snapshot = [...list];
|
|
195
|
+
const toRemove: SingleListener[] = [];
|
|
196
|
+
|
|
197
|
+
for (const listener of snapshot) {
|
|
198
|
+
try {
|
|
199
|
+
listener.callback(...args);
|
|
200
|
+
} catch (err) {
|
|
201
|
+
console.error(`[EventService] Error in listener for "${event}":`, err);
|
|
202
|
+
}
|
|
203
|
+
if (listener.once) toRemove.push(listener);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (toRemove.length) {
|
|
207
|
+
this.listeners.set(
|
|
208
|
+
event,
|
|
209
|
+
list.filter((l) => !toRemove.includes(l)),
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Multi listeners
|
|
215
|
+
const multiToRemove: MultiListener[] = [];
|
|
216
|
+
for (const listener of this.multiListeners) {
|
|
217
|
+
if (listener.events.has(event) && !listener.called) {
|
|
218
|
+
listener.called = true;
|
|
219
|
+
try {
|
|
220
|
+
listener.callback(...args);
|
|
221
|
+
} catch (err) {
|
|
222
|
+
console.error(`[EventService] Error in multi-event listener:`, err);
|
|
223
|
+
}
|
|
224
|
+
if (listener.once) multiToRemove.push(listener);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (multiToRemove.length) {
|
|
229
|
+
this.multiListeners = this.multiListeners.filter((l) => !multiToRemove.includes(l));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ─── Utility ────────────────────────────────────────────────
|
|
234
|
+
|
|
235
|
+
/** Remove all listeners */
|
|
236
|
+
clear(): void {
|
|
237
|
+
this.listeners.clear();
|
|
238
|
+
this.multiListeners = [];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Listener count for a specific event */
|
|
242
|
+
listenerCount(event: string): number {
|
|
243
|
+
const single = this.listeners.get(event)?.length ?? 0;
|
|
244
|
+
const multi = this.multiListeners.filter((l) => l.events.has(event)).length;
|
|
245
|
+
return single + multi;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** Check if event has listeners */
|
|
249
|
+
hasListeners(event: string): boolean {
|
|
250
|
+
return this.listenerCount(event) > 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Get all registered event names */
|
|
254
|
+
eventNames(): string[] {
|
|
255
|
+
const names = new Set<string>(this.listeners.keys());
|
|
256
|
+
for (const l of this.multiListeners) {
|
|
257
|
+
l.events.forEach((e) => names.add(e));
|
|
258
|
+
}
|
|
259
|
+
return [...names];
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Destroy — alias for clear */
|
|
263
|
+
destroy(): void {
|
|
264
|
+
this.clear();
|
|
265
|
+
}
|
|
266
|
+
}
|