@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
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import type { HtmlInterface, SaoNodeInterface, SaoElementChildren, SaoElement, DOMElement, WrapperInterface, TextInterface, SaoChildrenFactoryOutput } from "../contracts/ElementInterface.js";
|
|
2
|
+
import type { ViewControllerInterface } from "../contracts/ViewControllerInterface.js";
|
|
3
|
+
|
|
4
|
+
/** Commit initial data; hydration discards pending notifications before subscribe. */
|
|
5
|
+
export function commitView(ctrl: ViewControllerInterface, discardPending: boolean = false): void {
|
|
6
|
+
ctrl.commitData();
|
|
7
|
+
if (discardPending) ctrl.states.__.flushNow();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Flush state + reactive queues after a lifecycle transition. */
|
|
11
|
+
export function flushView(ctrl: ViewControllerInterface): void {
|
|
12
|
+
ctrl.states.__.flushNow();
|
|
13
|
+
ctrl.flushReactiveUpdatesNow();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Start a view through its controller, then make the initial DOM snapshot current. */
|
|
17
|
+
export function activateView(ctrl: ViewControllerInterface): void {
|
|
18
|
+
ctrl.start();
|
|
19
|
+
flushView(ctrl);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Claim an already-rendered Wrapper tree without inserting or clearing DOM.
|
|
24
|
+
* Used by both route hydration and nested @include hydration.
|
|
25
|
+
*/
|
|
26
|
+
export function claimHydratedView(
|
|
27
|
+
ctrl: ViewControllerInterface,
|
|
28
|
+
root: HtmlInterface,
|
|
29
|
+
wrapper: WrapperInterface | null = ctrl.mainElement,
|
|
30
|
+
): void {
|
|
31
|
+
ctrl.setParentElement(root);
|
|
32
|
+
if (!wrapper) return;
|
|
33
|
+
wrapper.setParentElement(root);
|
|
34
|
+
const children = wrapper.render();
|
|
35
|
+
if (children && children.length > 0) hydrateElementList(root, children);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Mount danh sách children vào TRƯỚC một anchor node (RUNTIME_CONTRACT.md §2 —
|
|
40
|
+
* insertion point tường minh). Dùng cho Component (@include), và mọi chỗ cần
|
|
41
|
+
* mount content vào giữa cặp markers có sẵn.
|
|
42
|
+
*/
|
|
43
|
+
export function mountChildrenBeforeAnchor(
|
|
44
|
+
anchor: Node,
|
|
45
|
+
children: SaoChildrenFactoryOutput | SaoElementChildren,
|
|
46
|
+
parentForSao: HtmlInterface | null
|
|
47
|
+
): void {
|
|
48
|
+
const container = anchor.parentNode;
|
|
49
|
+
if (!container || !Array.isArray(children)) return;
|
|
50
|
+
const insert = (node: Node) => container.insertBefore(node, anchor);
|
|
51
|
+
|
|
52
|
+
for (const child of children) {
|
|
53
|
+
if (child === null || child === undefined) continue;
|
|
54
|
+
if (typeof child === 'string' || typeof child === 'number') {
|
|
55
|
+
insert(document.createTextNode(String(child)));
|
|
56
|
+
} else if (child instanceof Node) {
|
|
57
|
+
insert(child);
|
|
58
|
+
} else if (typeof child === 'object') {
|
|
59
|
+
if ('element' in child && (child as any).element) {
|
|
60
|
+
insert((child as any).element);
|
|
61
|
+
(child as any).render?.();
|
|
62
|
+
} else if ('openTag' in child) {
|
|
63
|
+
if ('parent' in child) (child as any).parent = parentForSao;
|
|
64
|
+
if ('parentElement' in child) (child as any).parentElement = parentForSao;
|
|
65
|
+
insert((child as any).openTag);
|
|
66
|
+
insert((child as any).closeTag);
|
|
67
|
+
(child as any).render?.();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Hydrate mode: gọi render() đệ quy trên children để tạo JS objects
|
|
75
|
+
* và claim DOM nodes, nhưng KHÔNG appendChild/insertBefore vào DOM
|
|
76
|
+
* (vì DOM đã có từ server-rendered HTML).
|
|
77
|
+
*
|
|
78
|
+
* Khác mountElementList ở chỗ: bỏ mọi thao tác DOM mutation,
|
|
79
|
+
* chỉ giữ lại phần tạo element tree + gán parent.
|
|
80
|
+
*/
|
|
81
|
+
export function hydrateElementList(root: HtmlInterface, elements: SaoElementChildren): void {
|
|
82
|
+
if (!Array.isArray(elements)) return;
|
|
83
|
+
|
|
84
|
+
for (const element of elements) {
|
|
85
|
+
if (element === null || element === undefined) continue;
|
|
86
|
+
if (typeof element === 'string' || typeof element === 'number') continue;
|
|
87
|
+
if (element instanceof Node) continue;
|
|
88
|
+
|
|
89
|
+
if (typeof element === 'object' && 'saoType' in element) {
|
|
90
|
+
const saoEl = element as SaoElement;
|
|
91
|
+
switch (saoEl.saoType) {
|
|
92
|
+
case 'Html': {
|
|
93
|
+
const html = saoEl as HtmlInterface;
|
|
94
|
+
html.render();
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case 'TextElement':
|
|
98
|
+
break;
|
|
99
|
+
case 'Output':
|
|
100
|
+
case 'Reactive':
|
|
101
|
+
case 'Fragment':
|
|
102
|
+
case 'BlockOutlet':
|
|
103
|
+
case 'Block':
|
|
104
|
+
case 'Component':
|
|
105
|
+
case 'Yield': {
|
|
106
|
+
const saoNode = saoEl as any;
|
|
107
|
+
if (typeof saoNode.setParentElement === 'function') {
|
|
108
|
+
saoNode.setParentElement(root);
|
|
109
|
+
} else {
|
|
110
|
+
if ('parent' in saoNode) saoNode.parent = root;
|
|
111
|
+
if ('parentElement' in saoNode) saoNode.parentElement = root;
|
|
112
|
+
}
|
|
113
|
+
saoNode.render();
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Mounts a list of SaoNodeInterface elements into a given root HtmlInterface.
|
|
123
|
+
* This function is responsible for appending the DOM nodes of each element
|
|
124
|
+
* to the root's DOM element and returning the list of mounted DOM nodes.
|
|
125
|
+
* @param root - The HtmlInterface to mount the elements into.
|
|
126
|
+
* @param elements - An array of SaoNodeInterface elements to be mounted.
|
|
127
|
+
* @returns An array of the mounted DOM nodes.
|
|
128
|
+
*/
|
|
129
|
+
export function mountElementList(root: HtmlInterface, elements: SaoNodeInterface[] | DOMElement[] | SaoElementChildren): Element[] {
|
|
130
|
+
const mountedNodes: Array<Element | Text | Comment | Node> = [];
|
|
131
|
+
if (Array.isArray(elements)) {
|
|
132
|
+
const rootElement = root.getElement();
|
|
133
|
+
elements.forEach((element: SaoNodeInterface | DOMElement | string | number) => {
|
|
134
|
+
if (typeof element === 'string' || typeof element === 'number') {
|
|
135
|
+
const el = document.createTextNode(element.toString());
|
|
136
|
+
rootElement.appendChild(el);
|
|
137
|
+
mountedNodes.push(el);
|
|
138
|
+
} else if (element instanceof Node) {
|
|
139
|
+
// FIX(baseline#2): raw DOM node — append trực tiếp, trước đây bị drop
|
|
140
|
+
rootElement.appendChild(element);
|
|
141
|
+
mountedNodes.push(element);
|
|
142
|
+
} else if (typeof element === 'object' && element !== null && 'saoType' in element) {
|
|
143
|
+
const saoEl = element as SaoElement;
|
|
144
|
+
switch (saoEl.saoType) {
|
|
145
|
+
case 'Wrapper':
|
|
146
|
+
const wrapper = saoEl as WrapperInterface;
|
|
147
|
+
wrapper.appendTo(root);
|
|
148
|
+
mountedNodes.push(wrapper.openTag);
|
|
149
|
+
wrapper.domChildren.forEach((node: Node) => {
|
|
150
|
+
mountedNodes.push(node);
|
|
151
|
+
});
|
|
152
|
+
mountedNodes.push(wrapper.closeTag);
|
|
153
|
+
break;
|
|
154
|
+
case 'Html':
|
|
155
|
+
const html = saoEl as HtmlInterface;
|
|
156
|
+
const htmlNode = html.render();
|
|
157
|
+
rootElement.appendChild(htmlNode);
|
|
158
|
+
mountedNodes.push(htmlNode);
|
|
159
|
+
break;
|
|
160
|
+
case 'TextElement':
|
|
161
|
+
const textElement = saoEl as TextInterface;
|
|
162
|
+
const textNode = textElement.render();
|
|
163
|
+
rootElement.appendChild(textNode);
|
|
164
|
+
mountedNodes.push(textNode);
|
|
165
|
+
break;
|
|
166
|
+
case 'Reactive':
|
|
167
|
+
case 'Output':
|
|
168
|
+
case 'Fragment':
|
|
169
|
+
case 'BlockOutlet':
|
|
170
|
+
case 'Block':
|
|
171
|
+
case 'Component':
|
|
172
|
+
case 'Yield':
|
|
173
|
+
const saoNode = saoEl as any;
|
|
174
|
+
if (typeof saoNode.setParentElement === 'function') {
|
|
175
|
+
saoNode.setParentElement(root);
|
|
176
|
+
} else {
|
|
177
|
+
if ('parent' in saoNode) {
|
|
178
|
+
saoNode.parent = root;
|
|
179
|
+
}
|
|
180
|
+
if ('parentElement' in saoNode) {
|
|
181
|
+
saoNode.parentElement = root;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
saoNode.render();
|
|
185
|
+
if (saoNode.openTag) {
|
|
186
|
+
mountedNodes.push(saoNode.openTag);
|
|
187
|
+
}
|
|
188
|
+
if (saoEl.saoType === 'Fragment' && Array.isArray(saoNode.nodes)) {
|
|
189
|
+
saoNode.nodes.forEach((node: Node) => {
|
|
190
|
+
mountedNodes.push(node);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (saoNode.closeTag) {
|
|
194
|
+
mountedNodes.push(saoNode.closeTag);
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
default:
|
|
198
|
+
//
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return mountedNodes as any;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function mountElementListBefore(root: HtmlInterface, elements: SaoNodeInterface[] | DOMElement[] | SaoElementChildren): Element[] {
|
|
208
|
+
const mountedNodes: Array<Element | Text | Comment | Node> = [];
|
|
209
|
+
if (Array.isArray(elements)) {
|
|
210
|
+
const rootElement = root.getElement();
|
|
211
|
+
elements.forEach((element: SaoNodeInterface | DOMElement | string | number) => {
|
|
212
|
+
if (typeof element === 'string' || typeof element === 'number') {
|
|
213
|
+
const el = document.createTextNode(element.toString());
|
|
214
|
+
rootElement.appendChild(el);
|
|
215
|
+
mountedNodes.push(el);
|
|
216
|
+
} else if (element instanceof Node) {
|
|
217
|
+
// FIX(baseline#2): raw DOM node — append trực tiếp, trước đây bị drop
|
|
218
|
+
rootElement.appendChild(element);
|
|
219
|
+
mountedNodes.push(element);
|
|
220
|
+
} else if (typeof element === 'object' && element !== null && 'saoType' in element) {
|
|
221
|
+
const saoEl = element as SaoElement;
|
|
222
|
+
switch (saoEl.saoType) {
|
|
223
|
+
case 'Wrapper':
|
|
224
|
+
const wrapper = saoEl as WrapperInterface;
|
|
225
|
+
wrapper.appendTo(root);
|
|
226
|
+
mountedNodes.push(wrapper.openTag);
|
|
227
|
+
wrapper.domChildren.forEach((node: Node) => {
|
|
228
|
+
mountedNodes.push(node);
|
|
229
|
+
});
|
|
230
|
+
mountedNodes.push(wrapper.closeTag);
|
|
231
|
+
break;
|
|
232
|
+
case 'Html':
|
|
233
|
+
const html = saoEl as HtmlInterface;
|
|
234
|
+
const htmlNode = html.render();
|
|
235
|
+
rootElement.appendChild(htmlNode);
|
|
236
|
+
mountedNodes.push(htmlNode);
|
|
237
|
+
break;
|
|
238
|
+
case 'TextElement':
|
|
239
|
+
const textElement = saoEl as TextInterface;
|
|
240
|
+
const textNode = textElement.render();
|
|
241
|
+
rootElement.appendChild(textNode);
|
|
242
|
+
mountedNodes.push(textNode);
|
|
243
|
+
break;
|
|
244
|
+
case 'Reactive':
|
|
245
|
+
case 'Output':
|
|
246
|
+
case 'Fragment':
|
|
247
|
+
case 'BlockOutlet':
|
|
248
|
+
case 'Block':
|
|
249
|
+
case 'Component':
|
|
250
|
+
case 'Yield':
|
|
251
|
+
const saoNode = saoEl as any;
|
|
252
|
+
if (typeof saoNode.setParentElement === 'function') {
|
|
253
|
+
saoNode.setParentElement(root);
|
|
254
|
+
} else {
|
|
255
|
+
if ('parent' in saoNode) {
|
|
256
|
+
saoNode.parent = root;
|
|
257
|
+
}
|
|
258
|
+
if ('parentElement' in saoNode) {
|
|
259
|
+
saoNode.parentElement = root;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
saoNode.render();
|
|
263
|
+
if (saoNode.openTag) {
|
|
264
|
+
mountedNodes.push(saoNode.openTag);
|
|
265
|
+
}
|
|
266
|
+
if (saoEl.saoType === 'Fragment' && Array.isArray(saoNode.nodes)) {
|
|
267
|
+
saoNode.nodes.forEach((node: Node) => {
|
|
268
|
+
mountedNodes.push(node);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
if (saoNode.closeTag) {
|
|
272
|
+
mountedNodes.push(saoNode.closeTag);
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
default:
|
|
276
|
+
//
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
return mountedNodes as any;
|
|
283
|
+
}
|