@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
package/README.md
CHANGED
|
@@ -1,221 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @saolabs/client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Runtime TypeScript phía trình duyệt của Saola: hydration HTML do Laravel render,
|
|
4
|
+
state, component, điều hướng SPA và vòng đời tài nguyên.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
|
|
8
|
-
Saola Client is the TypeScript runtime library for building reactive single-page applications that integrate seamlessly with Laravel backends.
|
|
9
|
-
|
|
10
|
-
## Features
|
|
11
|
-
|
|
12
|
-
- ⚡ **TypeScript First**: Full TypeScript support with excellent type safety
|
|
13
|
-
- 🎨 **Reactive Views**: Built-in reactive view system with automatic state management
|
|
14
|
-
- 📦 **Modular Architecture**: Component-based architecture for scalable applications
|
|
15
|
-
- 🔄 **Hot Module Replacement**: Development watch mode with automatic compilation
|
|
16
|
-
- 🚀 **Laravel Integration**: Seamless integration with Laravel backends
|
|
17
|
-
- 📱 **SSR Support**: Server-side rendering capabilities
|
|
18
|
-
- 🎯 **Lightweight**: Minimal bundle size with tree-shaking support
|
|
19
|
-
- 🔧 **Developer Friendly**: Excellent DX with CLI tools and build utilities
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
6
|
+
## Bắt đầu
|
|
22
7
|
|
|
23
8
|
```bash
|
|
24
|
-
npm install
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# or
|
|
28
|
-
pnpm add saola-client
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Quick Start
|
|
32
|
-
|
|
33
|
-
### Basic Setup
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
import { Application, app, appContainer } from 'saola-client';
|
|
37
|
-
import { ViewController } from 'saola-client';
|
|
38
|
-
|
|
39
|
-
// Initialize your app
|
|
40
|
-
const app = new Application({
|
|
41
|
-
el: '#app',
|
|
42
|
-
debug: true
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
await app.init();
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Creating a View
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
import { ViewBase, ViewController } from 'saola-client';
|
|
52
|
-
|
|
53
|
-
export class HomeView extends ViewBase {
|
|
54
|
-
constructor() {
|
|
55
|
-
super('home', 'home-template');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
onMount() {
|
|
59
|
-
// Initialize view logic
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export class HomeController extends ViewController {
|
|
64
|
-
view = HomeView;
|
|
65
|
-
|
|
66
|
-
onLoad() {
|
|
67
|
-
// Handle view data loading
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Routing
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
import { Router } from 'saola-client';
|
|
76
|
-
|
|
77
|
-
const router = new Router();
|
|
78
|
-
|
|
79
|
-
router.register('home', HomeController);
|
|
80
|
-
router.register('about', AboutController);
|
|
81
|
-
|
|
82
|
-
router.navigate('home');
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### State Management
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
import { ViewState, StateManager } from 'saola-client';
|
|
89
|
-
|
|
90
|
-
const state = new ViewState({
|
|
91
|
-
count: 0,
|
|
92
|
-
user: null
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
state.count = 5; // Trigger reactive updates
|
|
96
|
-
state.subscribe(newState => {
|
|
97
|
-
console.log('State updated:', newState);
|
|
98
|
-
});
|
|
9
|
+
npm install @saolabs/client
|
|
10
|
+
npm install --save-dev @saolabs/builder typescript
|
|
11
|
+
composer require saola/core saola/compiler
|
|
99
12
|
```
|
|
100
13
|
|
|
101
|
-
|
|
14
|
+
Viết giao diện bằng `.sao`, để compiler sinh class View và registry. Bắt đầu với
|
|
15
|
+
[hướng dẫn component](../saola/docs/SAO_FILE.md) trong workspace hệ sinh thái.
|
|
16
|
+
Compiler PHP sinh Blade SSR; client nhận DOM và xử lý tương tác trong browser.
|
|
102
17
|
|
|
103
|
-
|
|
18
|
+
## Module và tương thích
|
|
104
19
|
|
|
105
|
-
|
|
20
|
+
Package phát hành **ESM**. Các entry công khai:
|
|
106
21
|
|
|
107
|
-
|
|
22
|
+
- `@saolabs/client`: runtime, services và kiểu dữ liệu.
|
|
23
|
+
- `@saolabs/client/plugins`: `createPlugin`, `pluginManager`.
|
|
24
|
+
- `@saolabs/client/testing`: `mount`, `mountView`, `nextFrame` và `Harness`.
|
|
108
25
|
|
|
109
|
-
```
|
|
110
|
-
import {
|
|
26
|
+
```ts
|
|
27
|
+
import { HttpService } from '@saolabs/client';
|
|
28
|
+
import { createPlugin, pluginManager } from '@saolabs/client/plugins';
|
|
111
29
|
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
});
|
|
30
|
+
const http = new HttpService();
|
|
31
|
+
pluginManager.register(createPlugin('example', () => {
|
|
32
|
+
http.setTimeout(5000);
|
|
33
|
+
})).install('example');
|
|
117
34
|
```
|
|
118
35
|
|
|
119
|
-
|
|
36
|
+
Các công cụ CommonJS dùng `await import('@saolabs/client')`; package không cam kết
|
|
37
|
+
`require()` đồng bộ. Runtime cần DOM (browser hoặc jsdom trong test), không phải
|
|
38
|
+
renderer SSR chạy trong Node. Dùng PHP compiler cho SSR Laravel.
|
|
39
|
+
Các import tương đối có đuôi `.js`; build và declaration được kiểm với NodeNext.
|
|
120
40
|
|
|
121
|
-
|
|
122
|
-
import { View, ViewController, ViewManager } from 'saola-client';
|
|
41
|
+
## Test component đã compile
|
|
123
42
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
43
|
+
```ts
|
|
44
|
+
import { mount, nextFrame } from '@saolabs/client/testing';
|
|
45
|
+
import Counter from './compiled/counter.js';
|
|
127
46
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// Create a controller
|
|
134
|
-
class MyController extends ViewController {
|
|
135
|
-
view = MyView;
|
|
136
|
-
|
|
137
|
-
onLoad() {
|
|
138
|
-
// Load data
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
#### Router
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
import { Router } from 'saola-client';
|
|
147
|
-
|
|
148
|
-
const router = new Router();
|
|
149
|
-
|
|
150
|
-
// Register routes
|
|
151
|
-
router.register('home', HomeController);
|
|
152
|
-
router.register('user/:id', UserController);
|
|
153
|
-
|
|
154
|
-
// Navigate
|
|
155
|
-
router.navigate('home');
|
|
156
|
-
router.navigate('user/123');
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Plugins
|
|
160
|
-
|
|
161
|
-
Extend Saola Client with plugins:
|
|
162
|
-
|
|
163
|
-
```typescript
|
|
164
|
-
import { PluginManager } from 'saola-client/plugins';
|
|
165
|
-
|
|
166
|
-
const pluginManager = new PluginManager();
|
|
167
|
-
|
|
168
|
-
// Register and install plugins
|
|
169
|
-
pluginManager
|
|
170
|
-
.register(myPlugin)
|
|
171
|
-
.install('myPlugin', { option: 'value' });
|
|
47
|
+
const counter = mount(Counter, {initial: 3});
|
|
48
|
+
counter.container.querySelector('button')?.click();
|
|
49
|
+
await nextFrame();
|
|
50
|
+
console.log(counter.text());
|
|
51
|
+
counter.destroy();
|
|
172
52
|
```
|
|
173
53
|
|
|
174
|
-
|
|
54
|
+
Chạy trong môi trường DOM. Với theme nạp rời, externalize `@saolabs/client` để
|
|
55
|
+
app và theme dùng cùng một runtime; xem [bootstrap](docs/BOOTSTRAP_PROVIDER_GUIDE.md).
|
|
175
56
|
|
|
176
|
-
|
|
57
|
+
## Phát triển và kiểm chứng
|
|
177
58
|
|
|
178
59
|
```bash
|
|
179
|
-
npm run build
|
|
180
|
-
npm run
|
|
181
|
-
npm
|
|
60
|
+
npm run build # ESM JS và declarations
|
|
61
|
+
npm run typecheck # Kiểm source, không emit
|
|
62
|
+
npm test # Runtime + compile-to-mount contract tests
|
|
63
|
+
npm run check-exports # Pack thật; kiểm 3 entry và types trong consumer tạm
|
|
182
64
|
```
|
|
183
65
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## Integration with Saola Compiler
|
|
191
|
-
|
|
192
|
-
Saola Client works seamlessly with [Saola Compiler](https://github.com/saolabs/saola-compiler) to compile `.one` files into Blade templates and JavaScript.
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
# Install both packages
|
|
196
|
-
npm install saola-client saola-compiler
|
|
197
|
-
|
|
198
|
-
# Use in your Laravel project
|
|
199
|
-
# The compiler will generate files that use saola-client
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Contributing
|
|
203
|
-
|
|
204
|
-
1. Fork the repository
|
|
205
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
206
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
207
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
208
|
-
5. Open a Pull Request
|
|
209
|
-
|
|
210
|
-
## License
|
|
211
|
-
|
|
212
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
213
|
-
|
|
214
|
-
## Related Projects
|
|
66
|
+
`check-exports` không publish. Nó kiểm native ESM, dynamic import từ CommonJS,
|
|
67
|
+
mount view qua package đã đóng và TypeScript NodeNext, không dùng alias source.
|
|
68
|
+
Bộ test compile fixture cần sibling `builder/`, `compiler/`, `saola/` trong
|
|
69
|
+
workspace hệ sinh thái. Thiếu builder là lỗi kiểm tra, không tự bỏ qua test.
|
|
215
70
|
|
|
216
|
-
|
|
217
|
-
- [Saola Language Support](https://github.com/saolabs/saola-language-support) - VS Code extension for .one files
|
|
71
|
+
## Tài liệu
|
|
218
72
|
|
|
219
|
-
|
|
73
|
+
- [Runtime API](docs/RUNTIME_API_SPEC.md)
|
|
74
|
+
- [Compiler contract](docs/COMPILER_CONTRACT.md)
|
|
75
|
+
- [Testing](docs/TESTING.md)
|
|
76
|
+
- [Devtools](docs/DEVTOOLS.md)
|
|
220
77
|
|
|
221
|
-
|
|
78
|
+
MIT.
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
* TypeScript Core with Optimizations
|
|
4
4
|
*/
|
|
5
5
|
export { Application } from './src/core/app/Application.js';
|
|
6
|
-
export { app } from './src/core/
|
|
6
|
+
export { app } from './src/core/helpers/app.js';
|
|
7
7
|
export { default as App } from './src/core/bootstrap/app.js';
|
|
8
|
-
export {
|
|
8
|
+
export { defineBundle, loadBundles, mergeBundles, bootBundles } from './src/core/bootstrap/bundle.js';
|
|
9
|
+
export type { SaolaBundle, MergedBundles, ViewFactory } from './src/core/contracts/BundleInterface.js';
|
|
10
|
+
export { ServiceProvider } from './src/core/bootstrap/providers/ServiceProvider.js';
|
|
11
|
+
export { PROVIDER_NAMES, resolveProviderOrder } from './src/core/bootstrap/providers/provider-order.js';
|
|
12
|
+
export type { NamedServiceProvider, ProviderName } from './src/core/bootstrap/providers/provider-order.js';
|
|
13
|
+
export type { ServiceProviderInterface } from './src/core/contracts/ServiceProviderInterface.js';
|
|
9
14
|
export { EventService } from './src/core/services/EventService.js';
|
|
10
15
|
export { HttpService } from './src/core/services/HttpService.js';
|
|
11
16
|
export { StoreService } from './src/core/services/StoreService.js';
|
|
@@ -14,7 +19,16 @@ export { LoggerService } from './src/core/services/LoggerService.js';
|
|
|
14
19
|
export { HelperService, CollectionProxy } from './src/core/services/HelperService.js';
|
|
15
20
|
export { BlockManagerService, BlockManager } from './src/core/services/BlockManager.js';
|
|
16
21
|
export { MarkerRegistry, MarkerRegistryService } from './src/core/services/MarkerRegistry.js';
|
|
22
|
+
export { PageCache, PageCacheService, detachWrapperDOM } from './src/core/services/PageCache.js';
|
|
23
|
+
export type { PageCacheEntry, PageCacheSetOptions } from './src/core/services/PageCache.js';
|
|
24
|
+
export { SectionManager, SectionManagerService } from './src/core/services/SectionManager.js';
|
|
25
|
+
export { HeadService } from './src/core/services/HeadService.js';
|
|
26
|
+
export { Devtools, devtools, inspector } from './src/core/devtools/index.js';
|
|
27
|
+
export type { DevtoolsEvent, DevtoolsEventType, DevtoolsViewNode } from './src/core/devtools/index.js';
|
|
17
28
|
export { View, ViewController, ViewManager, ViewState, StateManager, LoopContext } from './src/core/view/index.js';
|
|
29
|
+
export type { ViewUserConfig } from './src/core/view/View.js';
|
|
30
|
+
export { ResourceScope } from './src/core/view/ResourceScope.js';
|
|
31
|
+
export type { WatchCallback, WatchContext, WatchOptions, Cleanup } from './src/core/view/ResourceScope.js';
|
|
18
32
|
export { Router, ActiveRoute, useRoute, useParams, useQuery } from './src/core/routers/Router.js';
|
|
19
33
|
export { Reactive } from './src/core/elements/Reactive.js';
|
|
20
34
|
export { Block } from './src/core/elements/Block.js';
|
|
@@ -27,7 +41,7 @@ export { Output } from './src/core/elements/Output.js';
|
|
|
27
41
|
export { Wrapper } from './src/core/elements/Wrapper.js';
|
|
28
42
|
export { ElementManager } from './src/core/elements/ElementManager.js';
|
|
29
43
|
export { Dom, DomService } from './src/core/services/DomService.js';
|
|
30
|
-
export { ApiClient } from './src/core/
|
|
44
|
+
export { ApiClient } from './src/core/helpers/ApiClient.js';
|
|
31
45
|
export type { ApplicationInterface } from './src/core/contracts/ApplicationInterface.js';
|
|
32
46
|
export type { HelperInterface, CollectionProxyInterface } from './src/core/contracts/HelperInterface.js';
|
|
33
47
|
export type { EventServiceInterface } from './src/core/contracts/EventServiceInterface.js';
|
|
@@ -37,10 +51,11 @@ export type { StorageServiceInterface } from './src/core/contracts/StorageServic
|
|
|
37
51
|
export type { LoggerServiceInterface, LoggerConfig, LogLevel } from './src/core/contracts/LoggerServiceInterface.js';
|
|
38
52
|
export type { ViewInterface } from './src/core/contracts/ViewInterface.js';
|
|
39
53
|
export type { ViewControllerInterface } from './src/core/contracts/ViewControllerInterface.js';
|
|
54
|
+
export type { ViewConfigThis, ViewRuntimeConfig } from './src/core/contracts/ViewControllerInterface.js';
|
|
40
55
|
export type { ViewManagerInterface } from './src/core/contracts/ViewManagerInterface.js';
|
|
41
56
|
export type { ReactiveInterface } from './src/core/contracts/ReactiveInterface.js';
|
|
42
57
|
export type { RouterInterface } from './src/core/contracts/RouterInterface.js';
|
|
43
58
|
export type { RouteDefinition, Route, RouteMatch, RouterConfig } from './src/core/routers/Router.js';
|
|
44
|
-
export type {
|
|
45
|
-
export type { APIEndpoints } from './src/core/
|
|
59
|
+
export type { MarkerTagName } from './src/core/contracts/MarkerInterface.js';
|
|
60
|
+
export type { APIEndpoints } from './src/core/helpers/ApiClient.js';
|
|
46
61
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B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/core/
|
|
7
|
+
export { app } from './src/core/helpers/app.js';
|
|
8
8
|
export { default as App } from './src/core/bootstrap/app.js';
|
|
9
|
+
// Bundle nạp rời (theme / gói mở rộng)
|
|
10
|
+
export { defineBundle, loadBundles, mergeBundles, bootBundles } from './src/core/bootstrap/bundle.js';
|
|
11
|
+
// Service Provider — lớp base + hằng tên, để app và theme viết provider của mình.
|
|
12
|
+
// KHÔNG export thì cả tính năng "người dùng thêm provider" chỉ dùng được nội bộ.
|
|
13
|
+
export { ServiceProvider } from './src/core/bootstrap/providers/ServiceProvider.js';
|
|
14
|
+
export { PROVIDER_NAMES, resolveProviderOrder } from './src/core/bootstrap/providers/provider-order.js';
|
|
9
15
|
// Services
|
|
10
|
-
export { MarkerService } from './src/core/services/MarkerService.js';
|
|
11
16
|
export { EventService } from './src/core/services/EventService.js';
|
|
12
17
|
export { HttpService } from './src/core/services/HttpService.js';
|
|
13
18
|
export { StoreService } from './src/core/services/StoreService.js';
|
|
@@ -16,8 +21,14 @@ export { LoggerService } from './src/core/services/LoggerService.js';
|
|
|
16
21
|
export { HelperService, CollectionProxy } from './src/core/services/HelperService.js';
|
|
17
22
|
export { BlockManagerService, BlockManager } from './src/core/services/BlockManager.js';
|
|
18
23
|
export { MarkerRegistry, MarkerRegistryService } from './src/core/services/MarkerRegistry.js';
|
|
24
|
+
export { PageCache, PageCacheService, detachWrapperDOM } from './src/core/services/PageCache.js';
|
|
25
|
+
export { SectionManager, SectionManagerService } from './src/core/services/SectionManager.js';
|
|
26
|
+
export { HeadService } from './src/core/services/HeadService.js';
|
|
27
|
+
// DevTools — tắt mặc định, xem docs/DEVTOOLS.md
|
|
28
|
+
export { Devtools, devtools, inspector } from './src/core/devtools/index.js';
|
|
19
29
|
// View System
|
|
20
30
|
export { View, ViewController, ViewManager, ViewState, StateManager, LoopContext } from './src/core/view/index.js';
|
|
31
|
+
export { ResourceScope } from './src/core/view/ResourceScope.js';
|
|
21
32
|
// Router
|
|
22
33
|
export { Router, ActiveRoute, useRoute, useParams, useQuery } from './src/core/routers/Router.js';
|
|
23
34
|
// Elements
|
|
@@ -34,5 +45,5 @@ export { ElementManager } from './src/core/elements/ElementManager.js';
|
|
|
34
45
|
// DOM
|
|
35
46
|
export { Dom, DomService } from './src/core/services/DomService.js';
|
|
36
47
|
// Helpers
|
|
37
|
-
export { ApiClient } from './src/core/
|
|
48
|
+
export { ApiClient } from './src/core/helpers/ApiClient.js';
|
|
38
49
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM;AACN,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM;AACN,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAE7D,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGtG,kFAAkF;AAClF,iFAAiF;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AAIxG,WAAW;AACX,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uCA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,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAGvE,MAAM;AACN,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAEpE,UAAU;AACV,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/plugins.d.ts
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -26,19 +26,20 @@
|
|
|
26
26
|
* app.boot();
|
|
27
27
|
* const router = app.make('router');
|
|
28
28
|
*/
|
|
29
|
-
import type { ApplicationInterface, ServiceKey, ServiceFactory, ServiceBinding } from '../contracts/ApplicationInterface';
|
|
30
|
-
import type { ServiceProviderInterface } from '../contracts/ServiceProviderInterface';
|
|
31
|
-
import type { ViewManagerInterface, RouterInterface } from '../contracts/utils';
|
|
32
|
-
import type { HelperInterface } from '../contracts/HelperInterface';
|
|
33
|
-
import type { EventServiceInterface } from '../contracts/EventServiceInterface';
|
|
34
|
-
import type { HttpServiceInterface } from '../contracts/HttpServiceInterface';
|
|
35
|
-
import type { StoreServiceInterface } from '../contracts/StoreServiceInterface';
|
|
36
|
-
import type { StorageServiceInterface } from '../contracts/StorageServiceInterface';
|
|
37
|
-
import type { LoggerServiceInterface } from '../contracts/LoggerServiceInterface';
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
29
|
+
import type { ApplicationInterface, ServiceKey, ServiceFactory, ServiceBinding } from '../contracts/ApplicationInterface.js';
|
|
30
|
+
import type { ServiceProviderInterface } from '../contracts/ServiceProviderInterface.js';
|
|
31
|
+
import type { ViewManagerInterface, RouterInterface } from '../contracts/utils.js';
|
|
32
|
+
import type { HelperInterface } from '../contracts/HelperInterface.js';
|
|
33
|
+
import type { EventServiceInterface } from '../contracts/EventServiceInterface.js';
|
|
34
|
+
import type { HttpServiceInterface } from '../contracts/HttpServiceInterface.js';
|
|
35
|
+
import type { StoreServiceInterface } from '../contracts/StoreServiceInterface.js';
|
|
36
|
+
import type { StorageServiceInterface } from '../contracts/StorageServiceInterface.js';
|
|
37
|
+
import type { LoggerServiceInterface } from '../contracts/LoggerServiceInterface.js';
|
|
38
|
+
import type { HeadServiceInterface } from '../contracts/HeadServiceInterface.js';
|
|
39
|
+
import { APIClientInterface } from '../contracts/ApiInterface.js';
|
|
40
|
+
import { SaoObjectType } from '../types/utils.js';
|
|
40
41
|
export declare class Application implements ApplicationInterface {
|
|
41
|
-
readonly
|
|
42
|
+
readonly saoType: SaoObjectType;
|
|
42
43
|
isInitialized: boolean;
|
|
43
44
|
isStarted: boolean;
|
|
44
45
|
View: ViewManagerInterface;
|
|
@@ -50,6 +51,7 @@ export declare class Application implements ApplicationInterface {
|
|
|
50
51
|
Store: StoreServiceInterface;
|
|
51
52
|
Storage: StorageServiceInterface;
|
|
52
53
|
Logger: LoggerServiceInterface;
|
|
54
|
+
Head: HeadServiceInterface;
|
|
53
55
|
/** Factory bindings — mỗi lần make() gọi factory tạo instance mới */
|
|
54
56
|
private bindings;
|
|
55
57
|
/** Singleton instances — tạo một lần, reuse */
|
|
@@ -61,7 +63,7 @@ export declare class Application implements ApplicationInterface {
|
|
|
61
63
|
/** Đã boot chưa */
|
|
62
64
|
private booted;
|
|
63
65
|
private ownProperties;
|
|
64
|
-
__store: Map<
|
|
66
|
+
__store: Map<any, {
|
|
65
67
|
isOverridable: boolean;
|
|
66
68
|
value: any;
|
|
67
69
|
}>;
|
|
@@ -152,8 +154,16 @@ export declare class Application implements ApplicationInterface {
|
|
|
152
154
|
destroy(): void;
|
|
153
155
|
getBindings(): Map<ServiceKey, ServiceFactory<any>>;
|
|
154
156
|
getSingletons(): Map<ServiceKey, any>;
|
|
155
|
-
set<T = any>(name:
|
|
156
|
-
get<T = any>(name:
|
|
157
|
+
set<T = any>(name: any, value: T, isOne?: boolean): void;
|
|
158
|
+
get<T = any>(name: any): T;
|
|
159
|
+
/**
|
|
160
|
+
* Dữ liệu package PHP chia sẻ cho client theo từng request (`Saola::share()`
|
|
161
|
+
* → `APP_CONFIGS.shared` → `App.init({ shared })`). Helper JS của package đọc
|
|
162
|
+
* ở đây thay vì tự đọc `window`, để test truyền được qua config.
|
|
163
|
+
*
|
|
164
|
+
* @example App.shared('permission', { routes: [] }).routes
|
|
165
|
+
*/
|
|
166
|
+
shared<T = any>(key?: string, fallback?: T): T;
|
|
157
167
|
setMethod(name: string, method: Function, isOne?: boolean): void;
|
|
158
168
|
}
|
|
159
169
|
//# sourceMappingURL=Application.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../../src/core/app/Application.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../../src/core/app/Application.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC7H,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAC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AAC,CAAC;IAInD,aAAa,IAAI,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC;IAKrC,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI;IA0B/D,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IAgB1B;;;;;;OAMG;IACH,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC;IAM9C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAE,OAAe,GAAG,IAAI;CA2B1E"}
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
* app.boot();
|
|
27
27
|
* const router = app.make('router');
|
|
28
28
|
*/
|
|
29
|
-
import { OOTEnum } from '../types/utils';
|
|
29
|
+
import { OOTEnum } from '../types/utils.js';
|
|
30
30
|
// ─── Application ────────────────────────────────────────────────
|
|
31
31
|
export class Application {
|
|
32
32
|
constructor() {
|
|
33
|
-
this.
|
|
33
|
+
this.saoType = OOTEnum.APPLICATION;
|
|
34
34
|
/** Factory bindings — mỗi lần make() gọi factory tạo instance mới */
|
|
35
35
|
this.bindings = new Map();
|
|
36
36
|
/** Singleton instances — tạo một lần, reuse */
|
|
@@ -64,6 +64,7 @@ export class Application {
|
|
|
64
64
|
'destroy',
|
|
65
65
|
'getBindings',
|
|
66
66
|
'getSingletons',
|
|
67
|
+
'shared',
|
|
67
68
|
'__store',
|
|
68
69
|
]; // Để track dynamic properties nếu cần
|
|
69
70
|
this.__store = new Map(); // Store cho dynamic properties nếu cần
|
|
@@ -136,6 +137,18 @@ export class Application {
|
|
|
136
137
|
*/
|
|
137
138
|
instance(key, value) {
|
|
138
139
|
this.singletons.set(key, value);
|
|
140
|
+
if (typeof key === 'string' && !this.ownProperties.includes(key)) {
|
|
141
|
+
this.__store.set(key, { value, isOverridable: true });
|
|
142
|
+
Object.defineProperty(this, key, {
|
|
143
|
+
get: () => this.__store.get(key)?.value,
|
|
144
|
+
set: (newValue) => {
|
|
145
|
+
this.__store.set(key, { value: newValue, isOverridable: true });
|
|
146
|
+
this.singletons.set(key, newValue);
|
|
147
|
+
},
|
|
148
|
+
configurable: true,
|
|
149
|
+
enumerable: false,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
139
152
|
return this;
|
|
140
153
|
}
|
|
141
154
|
// ─── Alias ──────────────────────────────────────────────────
|
|
@@ -231,6 +244,13 @@ export class Application {
|
|
|
231
244
|
provider.initApplication();
|
|
232
245
|
}
|
|
233
246
|
provider.register();
|
|
247
|
+
// Đăng ký SAU khi app đã boot — plugin nạp muộn qua App.push(), hoặc
|
|
248
|
+
// provider của theme cắm vào giữa phiên. boot() vòng lặp chính đã chạy
|
|
249
|
+
// xong và có cờ chặn, nên nếu không gọi ở đây thì provider chỉ chạy nửa
|
|
250
|
+
// vòng đời: register() có, boot() không, và KHÔNG có lỗi nào phát ra.
|
|
251
|
+
if (this.booted && typeof provider.boot === 'function') {
|
|
252
|
+
provider.boot();
|
|
253
|
+
}
|
|
234
254
|
return this;
|
|
235
255
|
}
|
|
236
256
|
/**
|
|
@@ -274,29 +294,33 @@ export class Application {
|
|
|
274
294
|
return this.singletons;
|
|
275
295
|
}
|
|
276
296
|
set(name, value, isOne = false) {
|
|
277
|
-
if (this.ownProperties.includes(name)) {
|
|
278
|
-
return; // Không cho ghi đè lên thuộc tính có sẵn
|
|
279
|
-
}
|
|
280
297
|
if (this.__store.has(name) && this.__store.get(name)?.isOverridable === false) {
|
|
281
298
|
return; // Không cho ghi đè lên thuộc tính không thể override
|
|
282
299
|
}
|
|
300
|
+
const isString = typeof name === 'string';
|
|
301
|
+
if (isString && this.ownProperties.includes(name)) {
|
|
302
|
+
return; // Không cho ghi đè lên thuộc tính có sẵn
|
|
303
|
+
}
|
|
283
304
|
this.__store.set(name, { value, isOverridable: !isOne });
|
|
284
305
|
this.singletons.set(name, value); // Sync → DI container
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
306
|
+
if (isString) {
|
|
307
|
+
Object.defineProperty(this, name, {
|
|
308
|
+
get: () => this.__store.get(name)?.value,
|
|
309
|
+
set: (newValue) => {
|
|
310
|
+
if (this.__store.has(name) && this.__store.get(name)?.isOverridable === false) {
|
|
311
|
+
return; // Không cho ghi đè nếu isOverridable là false
|
|
312
|
+
}
|
|
313
|
+
this.__store.set(name, { value: newValue, isOverridable: !isOne });
|
|
314
|
+
this.singletons.set(name, newValue); // Sync → DI container
|
|
315
|
+
},
|
|
316
|
+
configurable: isOne ? false : true,
|
|
317
|
+
enumerable: false,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
297
320
|
}
|
|
298
321
|
get(name) {
|
|
299
|
-
|
|
322
|
+
const isString = typeof name === 'string';
|
|
323
|
+
if (isString && this.ownProperties.includes(name)) {
|
|
300
324
|
return this[name]; // Trả về thuộc tính có sẵn
|
|
301
325
|
}
|
|
302
326
|
// Check __store first (registered via set())
|
|
@@ -309,6 +333,19 @@ export class Application {
|
|
|
309
333
|
}
|
|
310
334
|
return undefined;
|
|
311
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* Dữ liệu package PHP chia sẻ cho client theo từng request (`Saola::share()`
|
|
338
|
+
* → `APP_CONFIGS.shared` → `App.init({ shared })`). Helper JS của package đọc
|
|
339
|
+
* ở đây thay vì tự đọc `window`, để test truyền được qua config.
|
|
340
|
+
*
|
|
341
|
+
* @example App.shared('permission', { routes: [] }).routes
|
|
342
|
+
*/
|
|
343
|
+
shared(key, fallback) {
|
|
344
|
+
const all = (this.__store.get('SharedData')?.value ?? {});
|
|
345
|
+
if (key === undefined)
|
|
346
|
+
return all;
|
|
347
|
+
return (Object.prototype.hasOwnProperty.call(all, key) ? all[key] : fallback);
|
|
348
|
+
}
|
|
312
349
|
setMethod(name, method, isOne = false) {
|
|
313
350
|
if (this.ownProperties.includes(name)) {
|
|
314
351
|
return; // Không cho ghi đè lên thuộc tính có sẵn
|