@saolabs/client 1.0.0 → 1.1.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 +52 -195
- package/dist/index.d.ts +20 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/plugins.d.ts +2 -2
- package/dist/plugins.js +2 -2
- package/dist/src/core/app/Application.d.ts +25 -15
- package/dist/src/core/app/Application.d.ts.map +1 -1
- package/dist/src/core/app/Application.js +55 -18
- package/dist/src/core/app/Application.js.map +1 -1
- package/dist/src/core/bootstrap/app.d.ts +1 -1
- package/dist/src/core/bootstrap/app.d.ts.map +1 -1
- package/dist/src/core/bootstrap/app.js +77 -4
- package/dist/src/core/bootstrap/app.js.map +1 -1
- package/dist/src/core/bootstrap/bundle.d.ts +41 -0
- package/dist/src/core/bootstrap/bundle.d.ts.map +1 -0
- package/dist/src/core/bootstrap/bundle.js +98 -0
- package/dist/src/core/bootstrap/bundle.js.map +1 -0
- package/dist/src/core/bootstrap/providers/ApiServiceProvider.d.ts +1 -1
- package/dist/src/core/bootstrap/providers/ApiServiceProvider.d.ts.map +1 -1
- package/dist/src/core/bootstrap/providers/ApiServiceProvider.js +3 -3
- package/dist/src/core/bootstrap/providers/ApiServiceProvider.js.map +1 -1
- package/dist/src/core/bootstrap/providers/CoreServiceProvider.d.ts +1 -1
- package/dist/src/core/bootstrap/providers/CoreServiceProvider.d.ts.map +1 -1
- package/dist/src/core/bootstrap/providers/CoreServiceProvider.js +11 -8
- package/dist/src/core/bootstrap/providers/CoreServiceProvider.js.map +1 -1
- package/dist/src/core/bootstrap/providers/HelperServiceProvider.d.ts +3 -1
- package/dist/src/core/bootstrap/providers/HelperServiceProvider.d.ts.map +1 -1
- package/dist/src/core/bootstrap/providers/HelperServiceProvider.js +8 -3
- package/dist/src/core/bootstrap/providers/HelperServiceProvider.js.map +1 -1
- package/dist/src/core/bootstrap/providers/RouteServiceProvider.d.ts +2 -1
- package/dist/src/core/bootstrap/providers/RouteServiceProvider.d.ts.map +1 -1
- package/dist/src/core/bootstrap/providers/RouteServiceProvider.js +14 -4
- package/dist/src/core/bootstrap/providers/RouteServiceProvider.js.map +1 -1
- package/dist/src/core/bootstrap/providers/ServiceProvider.d.ts +4 -4
- package/dist/src/core/bootstrap/providers/ServiceProvider.d.ts.map +1 -1
- package/dist/src/core/bootstrap/providers/ServiceProvider.js +5 -5
- package/dist/src/core/bootstrap/providers/ServiceProvider.js.map +1 -1
- package/dist/src/core/bootstrap/providers/ViewServiceProvider.d.ts +1 -1
- package/dist/src/core/bootstrap/providers/ViewServiceProvider.d.ts.map +1 -1
- package/dist/src/core/bootstrap/providers/ViewServiceProvider.js +3 -3
- package/dist/src/core/bootstrap/providers/ViewServiceProvider.js.map +1 -1
- package/dist/src/core/bootstrap/providers/default-providers.d.ts +1 -1
- package/dist/src/core/bootstrap/providers/default-providers.d.ts.map +1 -1
- package/dist/src/core/bootstrap/providers/default-providers.js +44 -11
- package/dist/src/core/bootstrap/providers/default-providers.js.map +1 -1
- package/dist/src/core/bootstrap/providers/index.d.ts +9 -9
- package/dist/src/core/bootstrap/providers/index.d.ts.map +1 -1
- package/dist/src/core/bootstrap/providers/index.js +8 -8
- package/dist/src/core/bootstrap/providers/index.js.map +1 -1
- package/dist/src/core/bootstrap/providers/provider-order.d.ts +1 -1
- package/dist/src/core/bootstrap/providers/provider-order.d.ts.map +1 -1
- package/dist/src/core/bootstrap/ssr.d.ts +47 -0
- package/dist/src/core/bootstrap/ssr.d.ts.map +1 -0
- package/dist/src/core/bootstrap/ssr.js +129 -0
- package/dist/src/core/bootstrap/ssr.js.map +1 -0
- package/dist/src/core/cache/ViewCache.d.ts +1 -1
- package/dist/src/core/cache/ViewCache.d.ts.map +1 -1
- package/dist/src/core/cache/index.d.ts +1 -1
- package/dist/src/core/cache/index.d.ts.map +1 -1
- package/dist/src/core/cache/index.js +1 -1
- package/dist/src/core/cache/index.js.map +1 -1
- package/dist/src/core/contracts/ApplicationInterface.d.ts +15 -11
- package/dist/src/core/contracts/ApplicationInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/BlockInterface.d.ts +10 -10
- package/dist/src/core/contracts/BlockInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/BundleInterface.d.ts +38 -0
- package/dist/src/core/contracts/BundleInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/BundleInterface.js +2 -0
- package/dist/src/core/contracts/BundleInterface.js.map +1 -0
- package/dist/src/core/contracts/ComponentInterface.d.ts +7 -6
- package/dist/src/core/contracts/ComponentInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/ElementInterface.d.ts +91 -27
- package/dist/src/core/contracts/ElementInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/HeadServiceInterface.d.ts +37 -0
- package/dist/src/core/contracts/HeadServiceInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/HeadServiceInterface.js +3 -0
- package/dist/src/core/contracts/HeadServiceInterface.js.map +1 -0
- package/dist/src/core/contracts/HelperInterface.d.ts +9 -1
- package/dist/src/core/contracts/HelperInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/HttpServiceInterface.d.ts +3 -0
- package/dist/src/core/contracts/HttpServiceInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/MarkerInterface.d.ts +29 -44
- package/dist/src/core/contracts/MarkerInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/ReactiveInterface.d.ts +9 -9
- package/dist/src/core/contracts/ReactiveInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/RouterInterface.d.ts +5 -2
- package/dist/src/core/contracts/RouterInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/SectionInterface.d.ts +48 -0
- package/dist/src/core/contracts/SectionInterface.d.ts.map +1 -0
- package/dist/src/core/contracts/SectionInterface.js +2 -0
- package/dist/src/core/contracts/SectionInterface.js.map +1 -0
- package/dist/src/core/contracts/ServiceProviderInterface.d.ts +3 -3
- package/dist/src/core/contracts/ServiceProviderInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/ViewControllerInterface.d.ts +116 -15
- package/dist/src/core/contracts/ViewControllerInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/ViewInterface.d.ts +31 -5
- package/dist/src/core/contracts/ViewInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/ViewManagerInterface.d.ts +47 -5
- package/dist/src/core/contracts/ViewManagerInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/ViewStateInterface.d.ts +39 -2
- package/dist/src/core/contracts/ViewStateInterface.d.ts.map +1 -1
- package/dist/src/core/contracts/common.d.ts +3 -3
- package/dist/src/core/contracts/common.js +3 -3
- package/dist/src/core/contracts/utils.d.ts +19 -19
- package/dist/src/core/contracts/utils.d.ts.map +1 -1
- package/dist/src/core/contracts/views.d.ts +1 -22
- package/dist/src/core/contracts/views.d.ts.map +1 -1
- package/dist/src/core/devtools/hook.d.ts +66 -0
- package/dist/src/core/devtools/hook.d.ts.map +1 -0
- package/dist/src/core/devtools/hook.js +114 -0
- package/dist/src/core/devtools/hook.js.map +1 -0
- package/dist/src/core/devtools/index.d.ts +34 -0
- package/dist/src/core/devtools/index.d.ts.map +1 -0
- package/dist/src/core/devtools/index.js +33 -0
- package/dist/src/core/devtools/index.js.map +1 -0
- package/dist/src/core/devtools/inspector.d.ts +31 -0
- package/dist/src/core/devtools/inspector.d.ts.map +1 -0
- package/dist/src/core/devtools/inspector.js +249 -0
- package/dist/src/core/devtools/inspector.js.map +1 -0
- package/dist/src/core/elements/Block.d.ts +9 -7
- package/dist/src/core/elements/Block.d.ts.map +1 -1
- package/dist/src/core/elements/Block.js +33 -9
- package/dist/src/core/elements/Block.js.map +1 -1
- package/dist/src/core/elements/BlockOutlet.d.ts +19 -8
- package/dist/src/core/elements/BlockOutlet.d.ts.map +1 -1
- package/dist/src/core/elements/BlockOutlet.js +57 -13
- package/dist/src/core/elements/BlockOutlet.js.map +1 -1
- package/dist/src/core/elements/Component.d.ts +83 -11
- package/dist/src/core/elements/Component.d.ts.map +1 -1
- package/dist/src/core/elements/Component.js +334 -13
- package/dist/src/core/elements/Component.js.map +1 -1
- package/dist/src/core/elements/ForeachSlotCache.d.ts +95 -0
- package/dist/src/core/elements/ForeachSlotCache.d.ts.map +1 -0
- package/dist/src/core/elements/ForeachSlotCache.js +149 -0
- package/dist/src/core/elements/ForeachSlotCache.js.map +1 -0
- package/dist/src/core/elements/Fragment.d.ts +19 -13
- package/dist/src/core/elements/Fragment.d.ts.map +1 -1
- package/dist/src/core/elements/Fragment.js +43 -20
- package/dist/src/core/elements/Fragment.js.map +1 -1
- package/dist/src/core/elements/Html.d.ts +89 -12
- package/dist/src/core/elements/Html.d.ts.map +1 -1
- package/dist/src/core/elements/Html.js +707 -106
- package/dist/src/core/elements/Html.js.map +1 -1
- package/dist/src/core/elements/Output.d.ts +34 -10
- package/dist/src/core/elements/Output.d.ts.map +1 -1
- package/dist/src/core/elements/Output.js +141 -26
- package/dist/src/core/elements/Output.js.map +1 -1
- package/dist/src/core/elements/Reactive.d.ts +85 -14
- package/dist/src/core/elements/Reactive.d.ts.map +1 -1
- package/dist/src/core/elements/Reactive.js +315 -41
- package/dist/src/core/elements/Reactive.js.map +1 -1
- package/dist/src/core/elements/TextElement.d.ts +11 -7
- package/dist/src/core/elements/TextElement.d.ts.map +1 -1
- package/dist/src/core/elements/TextElement.js +18 -11
- package/dist/src/core/elements/TextElement.js.map +1 -1
- package/dist/src/core/elements/Wrapper.d.ts +24 -13
- package/dist/src/core/elements/Wrapper.d.ts.map +1 -1
- package/dist/src/core/elements/Wrapper.js +65 -8
- package/dist/src/core/elements/Wrapper.js.map +1 -1
- package/dist/src/core/elements/Yield.d.ts +10 -9
- package/dist/src/core/elements/Yield.d.ts.map +1 -1
- package/dist/src/core/elements/Yield.js +31 -19
- package/dist/src/core/elements/Yield.js.map +1 -1
- package/dist/src/core/elements/helpers.d.ts +7 -7
- package/dist/src/core/elements/helpers.d.ts.map +1 -1
- package/dist/src/core/elements/helpers.js +4 -4
- package/dist/src/core/elements/index.d.ts +12 -11
- package/dist/src/core/elements/index.d.ts.map +1 -1
- package/dist/src/core/elements/index.js +12 -11
- package/dist/src/core/elements/index.js.map +1 -1
- package/dist/src/core/elements/reconcileChildren.d.ts +7 -0
- package/dist/src/core/elements/reconcileChildren.d.ts.map +1 -0
- package/dist/src/core/elements/reconcileChildren.js +74 -0
- package/dist/src/core/elements/reconcileChildren.js.map +1 -0
- package/dist/src/core/helpers/ApiClient.d.ts.map +1 -0
- package/dist/src/core/{hellpers → helpers}/ApiClient.js +10 -1
- package/dist/src/core/helpers/ApiClient.js.map +1 -0
- package/dist/src/core/helpers/app.d.ts +3 -0
- package/dist/src/core/helpers/app.d.ts.map +1 -0
- package/dist/src/core/{hellpers → helpers}/app.js +11 -1
- package/dist/src/core/helpers/app.js.map +1 -0
- package/dist/src/core/helpers/transition.d.ts +34 -0
- package/dist/src/core/helpers/transition.d.ts.map +1 -0
- package/dist/src/core/helpers/transition.js +118 -0
- package/dist/src/core/helpers/transition.js.map +1 -0
- package/dist/src/core/{hellpers → helpers}/utils.d.ts +2 -2
- package/dist/src/core/helpers/utils.d.ts.map +1 -0
- package/dist/src/core/{hellpers → helpers}/utils.js +4 -4
- package/dist/src/core/helpers/utils.js.map +1 -0
- package/dist/src/core/helpers/view.d.ts +39 -0
- package/dist/src/core/helpers/view.d.ts.map +1 -0
- package/dist/src/core/helpers/view.js +286 -0
- package/dist/src/core/helpers/view.js.map +1 -0
- package/dist/src/core/routers/Router.d.ts +108 -7
- package/dist/src/core/routers/Router.d.ts.map +1 -1
- package/dist/src/core/routers/Router.js +444 -68
- package/dist/src/core/routers/Router.js.map +1 -1
- package/dist/src/core/routers/index.d.ts +2 -2
- package/dist/src/core/routers/index.d.ts.map +1 -1
- package/dist/src/core/routers/index.js +1 -1
- package/dist/src/core/routers/index.js.map +1 -1
- package/dist/src/core/services/AssetManager.d.ts +112 -0
- package/dist/src/core/services/AssetManager.d.ts.map +1 -0
- package/dist/src/core/services/AssetManager.js +361 -0
- package/dist/src/core/services/AssetManager.js.map +1 -0
- package/dist/src/core/services/BlockManager.d.ts +73 -2
- package/dist/src/core/services/BlockManager.d.ts.map +1 -1
- package/dist/src/core/services/BlockManager.js +270 -48
- package/dist/src/core/services/BlockManager.js.map +1 -1
- package/dist/src/core/services/DomService.js +3 -3
- package/dist/src/core/services/DomService.js.map +1 -1
- package/dist/src/core/services/HeadService.d.ts +24 -0
- package/dist/src/core/services/HeadService.d.ts.map +1 -0
- package/dist/src/core/services/HeadService.js +120 -0
- package/dist/src/core/services/HeadService.js.map +1 -0
- package/dist/src/core/services/HelperService.d.ts +14 -3
- package/dist/src/core/services/HelperService.d.ts.map +1 -1
- package/dist/src/core/services/HelperService.js +32 -2
- package/dist/src/core/services/HelperService.js.map +1 -1
- package/dist/src/core/services/HttpService.d.ts +8 -0
- package/dist/src/core/services/HttpService.d.ts.map +1 -1
- package/dist/src/core/services/HttpService.js +121 -47
- package/dist/src/core/services/HttpService.js.map +1 -1
- package/dist/src/core/services/MarkerRegistry.d.ts +51 -8
- package/dist/src/core/services/MarkerRegistry.d.ts.map +1 -1
- package/dist/src/core/services/MarkerRegistry.js +135 -14
- package/dist/src/core/services/MarkerRegistry.js.map +1 -1
- package/dist/src/core/services/PageCache.d.ts +101 -0
- package/dist/src/core/services/PageCache.d.ts.map +1 -0
- package/dist/src/core/services/PageCache.js +184 -0
- package/dist/src/core/services/PageCache.js.map +1 -0
- package/dist/src/core/services/SectionManager.d.ts +100 -0
- package/dist/src/core/services/SectionManager.d.ts.map +1 -0
- package/dist/src/core/services/SectionManager.js +408 -0
- package/dist/src/core/services/SectionManager.js.map +1 -0
- package/dist/src/core/services/StorageService.js +1 -1
- package/dist/src/core/services/TranslationService.d.ts +21 -0
- package/dist/src/core/services/TranslationService.d.ts.map +1 -0
- package/dist/src/core/services/TranslationService.js +95 -0
- package/dist/src/core/services/TranslationService.js.map +1 -0
- package/dist/src/core/services/index.d.ts +11 -8
- package/dist/src/core/services/index.d.ts.map +1 -1
- package/dist/src/core/services/index.js +11 -8
- package/dist/src/core/services/index.js.map +1 -1
- package/dist/src/core/types/utils.d.ts +8 -8
- package/dist/src/core/types/utils.d.ts.map +1 -1
- package/dist/src/core/view/LoopContext.d.ts +21 -1
- package/dist/src/core/view/LoopContext.d.ts.map +1 -1
- package/dist/src/core/view/LoopContext.js +36 -0
- package/dist/src/core/view/LoopContext.js.map +1 -1
- package/dist/src/core/view/ResourceScope.d.ts +38 -0
- package/dist/src/core/view/ResourceScope.d.ts.map +1 -0
- package/dist/src/core/view/ResourceScope.js +167 -0
- package/dist/src/core/view/ResourceScope.js.map +1 -0
- package/dist/src/core/view/Section.d.ts +17 -32
- package/dist/src/core/view/Section.d.ts.map +1 -1
- package/dist/src/core/view/Section.js +14 -55
- package/dist/src/core/view/Section.js.map +1 -1
- package/dist/src/core/view/View.d.ts +43 -7
- package/dist/src/core/view/View.d.ts.map +1 -1
- package/dist/src/core/view/View.js +22 -4
- package/dist/src/core/view/View.js.map +1 -1
- package/dist/src/core/view/ViewController.d.ts +313 -40
- package/dist/src/core/view/ViewController.d.ts.map +1 -1
- package/dist/src/core/view/ViewController.js +1002 -147
- package/dist/src/core/view/ViewController.js.map +1 -1
- package/dist/src/core/view/ViewManager.d.ts +318 -27
- package/dist/src/core/view/ViewManager.d.ts.map +1 -1
- package/dist/src/core/view/ViewManager.js +1199 -258
- package/dist/src/core/view/ViewManager.js.map +1 -1
- package/dist/src/core/view/ViewState.d.ts +185 -6
- package/dist/src/core/view/ViewState.d.ts.map +1 -1
- package/dist/src/core/view/ViewState.js +851 -123
- package/dist/src/core/view/ViewState.js.map +1 -1
- package/dist/src/core/view/index.d.ts +5 -5
- package/dist/src/core/view/index.d.ts.map +1 -1
- package/dist/src/core/view/index.js +5 -5
- package/dist/src/core/view/index.js.map +1 -1
- package/dist/src/testing/index.d.ts +69 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +140 -0
- package/dist/src/testing/index.js.map +1 -0
- package/index.ts +29 -5
- package/package.json +30 -21
- package/plugins.ts +2 -2
- package/src/core/app/Application.ts +72 -31
- package/src/core/bootstrap/app.ts +84 -6
- package/src/core/bootstrap/bundle.ts +101 -0
- package/src/core/bootstrap/providers/ApiServiceProvider.ts +4 -4
- package/src/core/bootstrap/providers/CoreServiceProvider.ts +14 -8
- package/src/core/bootstrap/providers/HelperServiceProvider.ts +8 -3
- package/src/core/bootstrap/providers/RouteServiceProvider.ts +15 -4
- package/src/core/bootstrap/providers/ServiceProvider.ts +8 -8
- package/src/core/bootstrap/providers/ViewServiceProvider.ts +3 -3
- package/src/core/bootstrap/providers/default-providers.ts +51 -16
- package/src/core/bootstrap/providers/index.ts +9 -9
- package/src/core/bootstrap/providers/provider-order.test.ts +16 -27
- package/src/core/bootstrap/providers/provider-order.ts +1 -1
- package/src/core/bootstrap/ssr.ts +141 -0
- package/src/core/cache/ViewCache.ts +1 -1
- package/src/core/cache/index.ts +1 -1
- package/src/core/contracts/ApplicationInterface.ts +15 -11
- package/src/core/contracts/BlockInterface.ts +18 -18
- package/src/core/contracts/BundleInterface.ts +40 -0
- package/src/core/contracts/ComponentInterface.ts +7 -6
- package/src/core/contracts/ElementInterface.ts +95 -27
- package/src/core/contracts/HeadServiceInterface.ts +41 -0
- package/src/core/contracts/HelperInterface.ts +9 -1
- package/src/core/contracts/HttpServiceInterface.ts +3 -0
- package/src/core/contracts/MarkerInterface.ts +22 -49
- package/src/core/contracts/ReactiveInterface.ts +9 -9
- package/src/core/contracts/RouterInterface.ts +5 -2
- package/src/core/contracts/SectionInterface.ts +49 -0
- package/src/core/contracts/ServiceProviderInterface.ts +3 -3
- package/src/core/contracts/ViewControllerInterface.ts +124 -16
- package/src/core/contracts/ViewInterface.ts +34 -5
- package/src/core/contracts/ViewManagerInterface.ts +40 -5
- package/src/core/contracts/ViewStateInterface.ts +39 -2
- package/src/core/contracts/common.ts +3 -3
- package/src/core/contracts/utils.ts +19 -19
- package/src/core/contracts/views.ts +2 -22
- package/src/core/devtools/hook.ts +142 -0
- package/src/core/devtools/index.ts +38 -0
- package/src/core/devtools/inspector.ts +270 -0
- package/src/core/elements/Block.ts +43 -21
- package/src/core/elements/BlockOutlet.ts +61 -21
- package/src/core/elements/Component.ts +352 -18
- package/src/core/elements/ElementManager.ts +9 -9
- package/src/core/elements/ForeachSlotCache.ts +170 -0
- package/src/core/elements/Fragment.ts +50 -32
- package/src/core/elements/Html.ts +696 -117
- package/src/core/elements/Output.ts +147 -30
- package/src/core/elements/Reactive.ts +329 -52
- package/src/core/elements/TextElement.ts +25 -16
- package/src/core/elements/Wrapper.ts +84 -18
- package/src/core/elements/Yield.ts +35 -24
- package/src/core/elements/helpers.ts +12 -12
- package/src/core/elements/index.ts +25 -24
- package/src/core/elements/reconcileChildren.ts +70 -0
- package/src/core/{hellpers → helpers}/ApiClient.ts +8 -1
- package/src/core/{hellpers → helpers}/app.ts +13 -2
- package/src/core/helpers/transition.ts +127 -0
- package/src/core/{hellpers → helpers}/utils.ts +4 -4
- package/src/core/helpers/view.ts +283 -0
- package/src/core/routers/Router.ts +458 -64
- package/src/core/routers/index.ts +2 -2
- package/src/core/services/AssetManager.ts +387 -0
- package/src/core/services/BlockManager.ts +272 -50
- package/src/core/services/DomService.ts +3 -3
- package/src/core/services/HeadService.ts +124 -0
- package/src/core/services/HelperService.ts +34 -4
- package/src/core/services/HttpService.ts +116 -55
- package/src/core/services/MarkerRegistry.ts +142 -16
- package/src/core/services/PageCache.ts +239 -0
- package/src/core/services/SectionManager.ts +387 -0
- package/src/core/services/StorageService.ts +1 -1
- package/src/core/services/TranslationService.ts +91 -0
- package/src/core/services/index.ts +11 -8
- package/src/core/types/utils.ts +8 -8
- package/src/core/view/LoopContext.ts +38 -1
- package/src/core/view/ResourceScope.ts +174 -0
- package/src/core/view/Section.ts +21 -68
- package/src/core/view/View.ts +57 -8
- package/src/core/view/ViewController.ts +1070 -186
- package/src/core/view/ViewManager.ts +1346 -272
- package/src/core/view/ViewState.ts +834 -116
- package/src/core/view/index.ts +5 -5
- package/src/testing/index.ts +184 -0
- package/dist/src/core/hellpers/ApiClient.d.ts.map +0 -1
- package/dist/src/core/hellpers/ApiClient.js.map +0 -1
- package/dist/src/core/hellpers/app.d.ts +0 -3
- package/dist/src/core/hellpers/app.d.ts.map +0 -1
- package/dist/src/core/hellpers/app.js.map +0 -1
- package/dist/src/core/hellpers/utils.d.ts.map +0 -1
- package/dist/src/core/hellpers/utils.js.map +0 -1
- package/dist/src/core/services/MarkerService.d.ts +0 -299
- package/dist/src/core/services/MarkerService.d.ts.map +0 -1
- package/dist/src/core/services/MarkerService.js +0 -723
- package/dist/src/core/services/MarkerService.js.map +0 -1
- package/src/core/services/MarkerService.ts +0 -923
- /package/dist/src/core/{hellpers → helpers}/ApiClient.d.ts +0 -0
|
@@ -1,39 +1,45 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ViewControllerInterface } from "./ViewControllerInterface";
|
|
3
|
-
import type { ReactiveInterface } from "./ReactiveInterface";
|
|
1
|
+
import type { SaoObjectType } from "../types/utils.js";
|
|
2
|
+
import type { ViewControllerInterface } from "./ViewControllerInterface.js";
|
|
3
|
+
import type { ReactiveInterface } from "./ReactiveInterface.js";
|
|
4
4
|
|
|
5
5
|
// ─── Element Interfaces ──────────────────────────────────────────
|
|
6
6
|
|
|
7
7
|
/** Base for any renderable node in the tree */
|
|
8
|
-
export interface
|
|
9
|
-
|
|
8
|
+
export interface SaoNodeInterface {
|
|
9
|
+
saoType: SaoObjectType;
|
|
10
10
|
parent: HtmlInterface | null;
|
|
11
11
|
render(): void;
|
|
12
12
|
destroy(): void;
|
|
13
|
-
|
|
13
|
+
isSaoElement: boolean;
|
|
14
14
|
setParentElement(parent: HtmlInterface | null): void;
|
|
15
15
|
[key: string]: any;
|
|
16
16
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/** Native HTML element wrapper */
|
|
20
|
-
export interface HtmlInterface extends
|
|
20
|
+
export interface HtmlInterface extends SaoNodeInterface {
|
|
21
21
|
element: HTMLElement;
|
|
22
22
|
domChildren: Node[];
|
|
23
23
|
[key: string]: any;
|
|
24
|
+
clearHTML(): void;
|
|
25
|
+
appendElement(element: HTMLElement | Comment | Text): void;
|
|
26
|
+
getElement(): HTMLElement;
|
|
27
|
+
renderChildren(): SaoElementChildren;
|
|
28
|
+
render(): HTMLElement;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
/** Text node wrapper */
|
|
27
|
-
export interface TextInterface extends
|
|
32
|
+
export interface TextInterface extends SaoNodeInterface {
|
|
28
33
|
element: Text;
|
|
29
34
|
text: string;
|
|
30
35
|
|
|
31
36
|
|
|
32
37
|
domChildren: Node[];
|
|
33
38
|
update(newText: string): void;
|
|
39
|
+
render(): HTMLElement | Text | Comment;
|
|
34
40
|
}
|
|
35
41
|
|
|
36
|
-
export interface OutputInterface extends
|
|
42
|
+
export interface OutputInterface extends SaoNodeInterface {
|
|
37
43
|
ctx: ViewControllerInterface;
|
|
38
44
|
parent: HtmlInterface | null;
|
|
39
45
|
stateKeys: string[];
|
|
@@ -43,12 +49,11 @@ export interface OutputInterface extends OneNodeInterface {
|
|
|
43
49
|
[key: string]: any;
|
|
44
50
|
}
|
|
45
51
|
|
|
46
|
-
export interface YieldInterface extends
|
|
52
|
+
export interface YieldInterface extends SaoNodeInterface {
|
|
47
53
|
ctx: ViewControllerInterface;
|
|
48
54
|
parent: HtmlInterface | null;
|
|
49
55
|
name: string;
|
|
50
|
-
|
|
51
|
-
setContentFactory(factory: () => OneChildrenFactoryOutput): void;
|
|
56
|
+
defaultValue: string;
|
|
52
57
|
openTag: Comment;
|
|
53
58
|
closeTag: Comment;
|
|
54
59
|
domChildren: Node[];
|
|
@@ -56,40 +61,84 @@ export interface YieldInterface extends OneNodeInterface {
|
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
/** Fragment — renders multiple root nodes into a parent without a wrapping tag */
|
|
59
|
-
export interface FragmentInterface extends
|
|
64
|
+
export interface FragmentInterface extends SaoNodeInterface {
|
|
60
65
|
nodes: Node[];
|
|
61
66
|
domChildren: Node[];
|
|
62
67
|
[key: string]: any;
|
|
63
68
|
|
|
64
69
|
}
|
|
65
70
|
/** Wrapper — renders multiple root nodes into a parent without a wrapping tag */
|
|
66
|
-
export interface WrapperInterface extends
|
|
71
|
+
export interface WrapperInterface extends SaoNodeInterface {
|
|
67
72
|
nodes: Node[];
|
|
68
73
|
domChildren: Node[];
|
|
69
74
|
[key: string]: any;
|
|
75
|
+
/** Render — chạy childrenFactory, trả về danh sách children đã tạo. */
|
|
76
|
+
render(): SaoElementChildren;
|
|
77
|
+
appendTo(parent: HtmlInterface): void;
|
|
78
|
+
mountTo(parent: HtmlInterface): void;
|
|
79
|
+
clear(): void;
|
|
80
|
+
setChildrenFactory(factory: SaoChildrenFactory): void;
|
|
81
|
+
children: SaoElementChildren;
|
|
82
|
+
openTag: Comment;
|
|
83
|
+
closeTag: Comment;
|
|
84
|
+
|
|
70
85
|
}
|
|
71
86
|
|
|
72
87
|
// ─── Element Config Types ────────────────────────────────────────
|
|
73
88
|
|
|
74
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Contract chuẩn (RUNTIME_CONTRACT.md §1.1): type = 'static' | 'binding'.
|
|
91
|
+
* 'value' giữ làm legacy alias của 'static' đến v0.2.
|
|
92
|
+
*/
|
|
93
|
+
export type BindingConfigType = 'static' | 'binding' | 'value';
|
|
94
|
+
|
|
95
|
+
export type SaoElementConfig = {
|
|
96
|
+
/** Marker-free content for HTML RCDATA elements (textarea/title). */
|
|
97
|
+
content?: {
|
|
98
|
+
factory: () => any;
|
|
99
|
+
stateKeys?: string[];
|
|
100
|
+
},
|
|
75
101
|
attrs?: {
|
|
76
102
|
[key: string]: {
|
|
77
|
-
type:
|
|
103
|
+
type: BindingConfigType;
|
|
78
104
|
value?: any;
|
|
79
105
|
stateKeys?: string[];
|
|
80
106
|
factory?: () => any;
|
|
107
|
+
/** `@yield(name, ...)` used as the whole attribute value — no static stateKeys
|
|
108
|
+
* (the section it resolves to is only known at runtime), so Html subscribes to
|
|
109
|
+
* SectionManager by name instead. */
|
|
110
|
+
yieldName?: string;
|
|
81
111
|
}
|
|
82
112
|
},
|
|
83
113
|
props?: {
|
|
84
114
|
[key: string]: {
|
|
85
|
-
type:
|
|
115
|
+
type: BindingConfigType;
|
|
86
116
|
value?: any;
|
|
87
117
|
stateKeys?: string[];
|
|
88
118
|
factory?: () => any;
|
|
89
119
|
}
|
|
90
120
|
},
|
|
91
121
|
events?: {
|
|
92
|
-
[key: string]:
|
|
122
|
+
[key: string]: SaoElementEventHandler;
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* `@click.prevent.stop(...)` — bucket RIÊNG cạnh `events` để shape
|
|
126
|
+
* `events: {click: [...]}` (contract sẵn có) không đổi; view compile trước
|
|
127
|
+
* khi có modifier không có key này và chạy y nguyên.
|
|
128
|
+
*/
|
|
129
|
+
eventModifiers?: {
|
|
130
|
+
[key: string]: EventModifier[];
|
|
131
|
+
},
|
|
132
|
+
/** `@bind(key)`/`@val(key)` — two-way binding, own bucket (sibling of attrs/props/events). */
|
|
133
|
+
bind?: {
|
|
134
|
+
key: string;
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* `@transition('fade')` — tiền tố class enter/leave (`fade-enter-from`, ...).
|
|
138
|
+
* Bucket riêng như `bind`/`eventModifiers`; vắng mặt = hành vi cũ y nguyên.
|
|
139
|
+
*/
|
|
140
|
+
transition?: {
|
|
141
|
+
name: string;
|
|
93
142
|
},
|
|
94
143
|
classes?: {
|
|
95
144
|
[className: string]: {
|
|
@@ -99,14 +148,15 @@ export type OneElementConfig = {
|
|
|
99
148
|
factory?: () => boolean;
|
|
100
149
|
}
|
|
101
150
|
} | Array<{
|
|
102
|
-
|
|
151
|
+
/** 'dynamic' = factory trả về TÊN class (`class="language-{{ lang }}"`), không có `value`. */
|
|
152
|
+
type: 'static' | 'binding' | 'dynamic';
|
|
103
153
|
value?: string;
|
|
104
154
|
stateKeys?: string[];
|
|
105
|
-
factory?: () => boolean;
|
|
155
|
+
factory?: () => boolean | string;
|
|
106
156
|
}>,
|
|
107
157
|
styles?: {
|
|
108
158
|
[prop: string]: {
|
|
109
|
-
type:
|
|
159
|
+
type: BindingConfigType;
|
|
110
160
|
value?: string;
|
|
111
161
|
stateKeys?: string[];
|
|
112
162
|
factory?: () => string;
|
|
@@ -115,7 +165,7 @@ export type OneElementConfig = {
|
|
|
115
165
|
[key: string]: any;
|
|
116
166
|
}
|
|
117
167
|
|
|
118
|
-
export type HtmlElementConfig =
|
|
168
|
+
export type HtmlElementConfig = SaoElementConfig & {
|
|
119
169
|
ctx: ViewControllerInterface;
|
|
120
170
|
parentElement?: HtmlInterface | null;
|
|
121
171
|
parent?: HtmlInterface | null;
|
|
@@ -123,18 +173,36 @@ export type HtmlElementConfig = OneElementConfig & {
|
|
|
123
173
|
|
|
124
174
|
// ─── Event Handler ──────────────────────────────────────────────
|
|
125
175
|
|
|
126
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Modifier của `@click.prevent.stop(...)`. Phải khớp `EVENT_MODIFIERS` trong
|
|
178
|
+
* `compiler/src/sao2js/template_ast.py` — compiler chỉ emit tên trong tập đó.
|
|
179
|
+
*/
|
|
180
|
+
export type EventModifier = 'prevent' | 'stop' | 'self' | 'once';
|
|
181
|
+
|
|
182
|
+
export type SaoElementEventHandler = Array<{
|
|
127
183
|
handler: string | ((event: Event) => any);
|
|
128
184
|
params?: (any | ((event: Event) => any[]))[];
|
|
129
185
|
} | ((event: Event) => any)>;
|
|
130
186
|
|
|
187
|
+
export type SaoElement = WrapperInterface | HtmlInterface | ReactiveInterface | TextInterface | FragmentInterface;
|
|
188
|
+
export type DOMElement = HTMLElement | SVGElement | DocumentFragment | Text | Comment;
|
|
131
189
|
// ─── Children Types ─────────────────────────────────────────────
|
|
132
190
|
|
|
133
191
|
/** All possible rendered child node types */
|
|
134
|
-
export type
|
|
192
|
+
export type SaoElementChildren = Array<SaoElement | SaoNodeInterface | DOMElement>;
|
|
135
193
|
|
|
136
|
-
/** What a children factory can return (before mounting)
|
|
137
|
-
|
|
194
|
+
/** What a children factory can return (before mounting).
|
|
195
|
+
* SaoNodeInterface bao phủ các marker-based element (Output, Component, Block...)
|
|
196
|
+
* mà compiled output vẫn trả về trong children factories. */
|
|
197
|
+
export type SaoChildrenFactoryOutput = Array<SaoElement | SaoNodeInterface | DOMElement | string | number | null | undefined>;
|
|
138
198
|
|
|
139
199
|
/** Factory function that produces children given parent element */
|
|
140
|
-
export type
|
|
200
|
+
export type SaoChildrenFactory = (parentElement: HtmlInterface | null) => SaoChildrenFactoryOutput;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Lazy payload passed from a parent component to one ChildrenNode placeholder.
|
|
204
|
+
* A factory is deliberately not executed while component data is resolved; the
|
|
205
|
+
* child view invokes it only when its render traversal reaches the placeholder.
|
|
206
|
+
*/
|
|
207
|
+
export type SaoChildrenSlotFactory = SaoChildrenFactory;
|
|
208
|
+
export type SaoChildrenSlotContent = SaoChildrenSlotFactory | string | number | null | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// ─── Head Service Interface ───────────────────────────────────────
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `'page'` (default) — reverts to whatever was there before on the next
|
|
5
|
+
* `resetPage()` (called once per SPA navigation), so a tag set by page A
|
|
6
|
+
* never leaks into page B.
|
|
7
|
+
* `'persistent'` — survives navigation (site-wide defaults, e.g. a global
|
|
8
|
+
* robots directive or a fixed title suffix set once at boot).
|
|
9
|
+
*/
|
|
10
|
+
export type HeadTagScope = 'page' | 'persistent';
|
|
11
|
+
|
|
12
|
+
export interface HeadTagOptions {
|
|
13
|
+
scope?: HeadTagScope;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface HeadLinkOptions extends HeadTagOptions {
|
|
17
|
+
/** Extra attributes beyond rel/href — e.g. { hreflang: 'vi' } for alternate links. */
|
|
18
|
+
attrs?: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* HeadService — manages `<head>` tags (title, meta, link, JSON-LD) directly
|
|
23
|
+
* against `document`, independent of any View/ViewController. Registered in
|
|
24
|
+
* the DI container as `App.Head` / `app('Head')` so any code — a view's
|
|
25
|
+
* render, a route guard, an async data callback, app bootstrap — can call it.
|
|
26
|
+
*/
|
|
27
|
+
export interface HeadServiceInterface {
|
|
28
|
+
setTitle(title: string, options?: HeadTagOptions): void;
|
|
29
|
+
/** `<meta name="{name}" content="{content}">` — description, keywords, robots, viewport... */
|
|
30
|
+
setMeta(name: string, content: string, options?: HeadTagOptions): void;
|
|
31
|
+
/** `<meta property="{property}" content="{content}">` — Open Graph / Twitter card tags. */
|
|
32
|
+
setMetaProperty(property: string, content: string, options?: HeadTagOptions): void;
|
|
33
|
+
/** `<link rel="{rel}" href="{href}" ...attrs>` — canonical, alternate/hreflang, etc. */
|
|
34
|
+
setLink(rel: string, href: string, options?: HeadLinkOptions): void;
|
|
35
|
+
/** `<script type="application/ld+json">` — structured data, keyed by `id` (multiple blocks allowed). */
|
|
36
|
+
setJsonLd(id: string, data: Record<string, any>, options?: HeadTagOptions): void;
|
|
37
|
+
/** Revert one managed key immediately, regardless of its scope. */
|
|
38
|
+
unset(key: string): void;
|
|
39
|
+
/** Revert every `'page'`-scoped tag to its pre-managed state. Called once per navigation. */
|
|
40
|
+
resetPage(): void;
|
|
41
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// ─── Collection Proxy Interface ─────────────────────────────────
|
|
2
2
|
|
|
3
|
-
import { ApplicationInterface } from "./ApplicationInterface";
|
|
3
|
+
import { ApplicationInterface } from "./ApplicationInterface.js";
|
|
4
4
|
|
|
5
5
|
export interface CollectionProxyInterface {
|
|
6
6
|
all(): any[];
|
|
@@ -52,6 +52,14 @@ export interface CollectionProxyInterface {
|
|
|
52
52
|
// ─── Helper Interface ───────────────────────────────────────────
|
|
53
53
|
|
|
54
54
|
export interface HelperInterface {
|
|
55
|
+
initTranslations(config: import('../services/TranslationService.js').TranslationConfig): void;
|
|
56
|
+
getLocale(): string;
|
|
57
|
+
setLocale(locale: string): void;
|
|
58
|
+
__(key: string, replace?: Record<string, any>, locale?: string): string;
|
|
59
|
+
trans(key: string, replace?: Record<string, any>, locale?: string): string;
|
|
60
|
+
lang(key: string, replace?: Record<string, any>, locale?: string): string;
|
|
61
|
+
choice(key: string, count: number, replace?: Record<string, any>, locale?: string): string;
|
|
62
|
+
trans_choice(key: string, count: number, replace?: Record<string, any>, locale?: string): string;
|
|
55
63
|
[key: string]: any;
|
|
56
64
|
|
|
57
65
|
// ─── App / Service Container ─────────────────────────────────
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export interface HttpRequestConfig extends RequestInit {
|
|
4
4
|
headers?: Record<string, string>;
|
|
5
5
|
timeout?: number;
|
|
6
|
+
dedupe?: 'cancel-previous' | 'parallel';
|
|
7
|
+
requestKey?: string;
|
|
6
8
|
[key: string]: any;
|
|
7
9
|
}
|
|
8
10
|
|
|
@@ -45,6 +47,7 @@ export interface HttpServiceInterface {
|
|
|
45
47
|
cancelAll(): void;
|
|
46
48
|
/** Cancel a specific pending request */
|
|
47
49
|
cancel(url: string, method?: string): void;
|
|
50
|
+
cancelKey(identity: string, method?: string): void;
|
|
48
51
|
|
|
49
52
|
/** Destroy — cancel all + clear interceptors */
|
|
50
53
|
destroy(): void;
|
|
@@ -24,54 +24,27 @@ export type MarkerTagName =
|
|
|
24
24
|
// ─── MarkerRegistry Service ─────────────────────────────────────
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
attributes?: MarkupAttributes;
|
|
50
|
-
options?: MarkupQueryOptions;
|
|
51
|
-
index?: number;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* RegistryTag Query Options
|
|
56
|
-
*/
|
|
57
|
-
export interface RegistryTagQueryOptions {
|
|
58
|
-
tag?: string;
|
|
59
|
-
id?: string;
|
|
60
|
-
attributes?: Record<string, any>;
|
|
61
|
-
multiple?: boolean;
|
|
62
|
-
}
|
|
27
|
+
export interface MarkerRegistryInterface {
|
|
28
|
+
shortcut(tag: string): string;
|
|
29
|
+
fullTag(shortcut: string): string;
|
|
30
|
+
registerShortcut(tag: string, short: string): void;
|
|
31
|
+
register(tag: string, id?: string, attributes?: Record<string, any>): string;
|
|
32
|
+
createMarkerStart(tag: string, id?: string): Comment;
|
|
33
|
+
createMarkerEnd(tag: string, id?: string): Comment;
|
|
34
|
+
get(key: string): MarkerRegistryRecord | null;
|
|
35
|
+
getByTagAndId(tag: string, id: string): MarkerRegistryRecord | null;
|
|
36
|
+
has(key: string): boolean;
|
|
37
|
+
remove(key: string): boolean;
|
|
38
|
+
getByTag(tag: string): MarkerRegistryRecord[];
|
|
39
|
+
all(): Map<string, MarkerRegistryRecord>;
|
|
40
|
+
clear(): void;
|
|
41
|
+
size: number;
|
|
42
|
+
openComment(tag: string, id?: string): string;
|
|
43
|
+
closeComment(tag: string, id?: string): string;
|
|
44
|
+
parseComment(text: string): { tag: string; id: string; isClose: boolean } | null
|
|
45
|
+
/** Claim cặp marker SSR theo O(1) qua index (null = server không render vùng này) */
|
|
46
|
+
claim(tag: string, id: string, scope?: Element | null): { open: Comment; close: Comment } | null;
|
|
47
|
+
/** Bỏ index marker — gọi đầu mỗi lượt hydrate */
|
|
48
|
+
invalidateIndex(): void;
|
|
63
49
|
|
|
64
|
-
/**
|
|
65
|
-
* RegistryTagData
|
|
66
|
-
*/
|
|
67
|
-
export interface RegistryTagData {
|
|
68
|
-
systemPrefix: string;
|
|
69
|
-
tag: string;
|
|
70
|
-
id: string;
|
|
71
|
-
key: string;
|
|
72
|
-
attributes?: Record<string, any>;
|
|
73
|
-
nodes: Array<Node>;
|
|
74
50
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export type RegistryIDOrAttributes = string | Record<string, any> | undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ViewControllerInterface } from "./ViewControllerInterface";
|
|
3
|
-
import type { HtmlInterface,
|
|
1
|
+
import type { SaoObjectType } from "../types/utils.js";
|
|
2
|
+
import type { ViewControllerInterface } from "./ViewControllerInterface.js";
|
|
3
|
+
import type { HtmlInterface, SaoChildrenFactoryOutput, SaoElementChildren, SaoNodeInterface } from "./ElementInterface.js";
|
|
4
4
|
|
|
5
5
|
// ─── Reactive Interface ──────────────────────────────────────────
|
|
6
6
|
|
|
7
7
|
/** Reactive region bounded by comment markers — re-renders when deps change */
|
|
8
|
-
export interface ReactiveInterface extends
|
|
9
|
-
|
|
8
|
+
export interface ReactiveInterface extends SaoNodeInterface {
|
|
9
|
+
saoType: SaoObjectType;
|
|
10
10
|
id: string;
|
|
11
11
|
type: string;
|
|
12
12
|
ctx: ViewControllerInterface;
|
|
@@ -15,24 +15,24 @@ export interface ReactiveInterface extends OneNodeInterface {
|
|
|
15
15
|
parentReactive: ReactiveInterface | null;
|
|
16
16
|
openTag: Comment;
|
|
17
17
|
closeTag: Comment;
|
|
18
|
-
children:
|
|
18
|
+
children: SaoElementChildren;
|
|
19
19
|
unsubscribe: () => void;
|
|
20
20
|
childrenFactory: ReactiveChildrenFactory;
|
|
21
21
|
setChildrenFactory(factory: ReactiveChildrenFactory): void;
|
|
22
22
|
setStateKeys(stateKeys: string[]): void;
|
|
23
23
|
render(): void;
|
|
24
24
|
destroy(): void;
|
|
25
|
-
|
|
25
|
+
isSaoElement: boolean;
|
|
26
26
|
isOneReactive: boolean;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// ─── Reactive Types ──────────────────────────────────────────────
|
|
30
30
|
|
|
31
31
|
/** Function called by Reactive to produce DOM content between markers */
|
|
32
|
-
export type ReactiveRenderFn = (ctx: ViewControllerInterface, parentElement: HtmlInterface | null) =>
|
|
32
|
+
export type ReactiveRenderFn = (ctx: ViewControllerInterface, parentElement: HtmlInterface | null) => SaoChildrenFactoryOutput;
|
|
33
33
|
|
|
34
34
|
/** Factory function for reactive children rendering */
|
|
35
|
-
export type ReactiveChildrenFactory = (parentReactive: ReactiveInterface, parentElement: HtmlInterface | null) =>
|
|
35
|
+
export type ReactiveChildrenFactory = (parentReactive: ReactiveInterface, parentElement: HtmlInterface | null) => SaoChildrenFactoryOutput;
|
|
36
36
|
|
|
37
37
|
/** Reactive configuration */
|
|
38
38
|
export type ReactiveConfig = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ViewManagerInterface } from "./ViewManagerInterface";
|
|
1
|
+
import type { ViewManagerInterface } from "./ViewManagerInterface.js";
|
|
2
2
|
|
|
3
3
|
// ─── Router Interface ────────────────────────────────────────────
|
|
4
4
|
|
|
@@ -18,6 +18,8 @@ export interface ActiveRouteInterface {
|
|
|
18
18
|
$query: Record<string, any>;
|
|
19
19
|
$params: Record<string, any>;
|
|
20
20
|
$urlPath: string;
|
|
21
|
+
/** Request URI = path + query (không gồm hash) — cache key phía ViewManager */
|
|
22
|
+
$uri?: string;
|
|
21
23
|
$fragment: string;
|
|
22
24
|
new(route: RouteInterface, urlPath: string, fragment: string): ActiveRouteInterface;
|
|
23
25
|
setQuery(query: Record<string, any>): void;
|
|
@@ -52,7 +54,8 @@ export interface RouterInterface {
|
|
|
52
54
|
getCurrentRoute(): ActiveRouteInterface | null;
|
|
53
55
|
/** Navigation guards */
|
|
54
56
|
beforeEach(guard: (to: ActiveRouteInterface, from: ActiveRouteInterface, urlPath: string) => boolean | Promise<boolean>): this;
|
|
55
|
-
|
|
57
|
+
/** Đăng ký hook sau điều hướng; trả về hàm huỷ đăng ký. Nhiều hook cùng sống được. */
|
|
58
|
+
afterEach(hook: (to: ActiveRouteInterface, from: ActiveRouteInterface) => void): () => void;
|
|
56
59
|
/** Start listening to URL changes */
|
|
57
60
|
start(skipInitial?: boolean): void;
|
|
58
61
|
/** Stop listening */
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SaoElementChildren, SaoObjectType } from "../types/utils.js";
|
|
2
|
+
import type { ViewControllerInterface } from "./ViewControllerInterface.js";
|
|
3
|
+
import type { HtmlInterface, FragmentInterface, SaoChildrenFactoryOutput, SaoNodeInterface } from "./ElementInterface.js";
|
|
4
|
+
import { InitMode } from "./common.js";
|
|
5
|
+
|
|
6
|
+
export type SectionItemType = 'static' | 'dynamic' | 'async' | 'reactive';
|
|
7
|
+
export type SectionContentType = 'text' | 'html'
|
|
8
|
+
export type SectionContentRenderer = (parentElement?: HtmlInterface | null | undefined) => string | SaoElementChildren;
|
|
9
|
+
export type SectionConstruvtorArgs = {
|
|
10
|
+
ctx?: ViewControllerInterface | null;
|
|
11
|
+
name: string;
|
|
12
|
+
type: SectionItemType;
|
|
13
|
+
contentType?: SectionContentType;
|
|
14
|
+
stateKeys?: string[];
|
|
15
|
+
renderFactory: SectionContentRenderer;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
export interface SectionInterface {
|
|
19
|
+
ctx? : ViewControllerInterface | null;
|
|
20
|
+
/** Owning view instance — mirrors Block/BlockOutlet keying (`name` + `viewId`). */
|
|
21
|
+
viewId?: string | null;
|
|
22
|
+
name: string;
|
|
23
|
+
type: SectionItemType;
|
|
24
|
+
contentType?: SectionContentType;
|
|
25
|
+
stateKeys?: string[];
|
|
26
|
+
renderFactory?: SectionContentRenderer;
|
|
27
|
+
}
|
|
28
|
+
export interface SectionManagerInterface {
|
|
29
|
+
sections: Map<string, SectionInterface>;
|
|
30
|
+
subscribers: Map<string, ((section: SectionInterface) => void)[]>;
|
|
31
|
+
add(section: SectionInterface): void;
|
|
32
|
+
subscribe(name: string, callback: (section: SectionInterface) => void): () => void;
|
|
33
|
+
unsubscribe(name: string, callback?: (section: SectionInterface) => void): void;
|
|
34
|
+
/** Register a @yield(...) marker so mountViewSections() can find it by name. */
|
|
35
|
+
addYield(id: string, yieldEl: any): void;
|
|
36
|
+
/** Resolve the current value of a named section synchronously — used by `this.yieldContent()` in attribute/prop bindings. */
|
|
37
|
+
resolve(name: string, defaultValue?: any): any;
|
|
38
|
+
/** Mount sections owned by one controller (page or layout) into their matching yields. Mirrors BlockManagerService.mountViewBlocks(). */
|
|
39
|
+
mountViewSections(viewId: string): void;
|
|
40
|
+
/** Hydrate counterpart — claim SSR content, no DOM insertion, only (re)subscribe. */
|
|
41
|
+
hydrateViewSections(viewId: string): void;
|
|
42
|
+
startAll(): void;
|
|
43
|
+
stopAll(): void;
|
|
44
|
+
unmountView(viewId: string): void;
|
|
45
|
+
removeYieldsOfView(viewId: string): void;
|
|
46
|
+
/** Revert every page-scoped head tag (title/meta) before mounting a new page's chain. */
|
|
47
|
+
resetPageHead(): void;
|
|
48
|
+
destroy(): void;
|
|
49
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ApplicationInterface } from "./ApplicationInterface";
|
|
1
|
+
import { SaoObjectType } from "../types/utils.js";
|
|
2
|
+
import type { ApplicationInterface } from "./ApplicationInterface.js";
|
|
3
3
|
|
|
4
4
|
/** Service Provider — register() đăng ký, boot() khởi động */
|
|
5
5
|
export interface ServiceProviderInterface {
|
|
6
|
-
|
|
6
|
+
saoType?: SaoObjectType;
|
|
7
7
|
name: string;
|
|
8
8
|
dependsOn?: string[];
|
|
9
9
|
initApplication?(App?: ApplicationInterface): void;
|