piral-core 1.0.0-pre.2296 → 1.0.1-beta.5640
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/LICENSE +1 -1
- package/README.md +12 -4
- package/app.codegen +36 -0
- package/app.codegen.d.ts +29 -0
- package/dist/codegen.js +5308 -0
- package/esm/Piral.d.ts +4 -4
- package/esm/Piral.js +8 -11
- package/esm/Piral.js.map +1 -1
- package/esm/PiralContext.d.ts +21 -0
- package/esm/PiralContext.js +34 -0
- package/esm/PiralContext.js.map +1 -0
- package/esm/RootListener.d.ts +2 -0
- package/esm/RootListener.js +23 -0
- package/esm/RootListener.js.map +1 -0
- package/esm/actions/app.d.ts +7 -4
- package/esm/actions/app.js +24 -14
- package/esm/actions/app.js.map +1 -1
- package/esm/actions/components.js +5 -6
- package/esm/actions/components.js.map +1 -1
- package/esm/actions/data.js +16 -17
- package/esm/actions/data.js.map +1 -1
- package/esm/actions/define.js +2 -3
- package/esm/actions/define.js.map +1 -1
- package/esm/actions/portal.d.ts +2 -0
- package/esm/actions/portal.js +9 -4
- package/esm/actions/portal.js.map +1 -1
- package/esm/actions/state.js +7 -4
- package/esm/actions/state.js.map +1 -1
- package/esm/components/ErrorBoundary.d.ts +14 -31
- package/esm/components/ErrorBoundary.js +22 -28
- package/esm/components/ErrorBoundary.js.map +1 -1
- package/esm/components/ExtensionSlot.d.ts +1 -0
- package/esm/components/ExtensionSlot.js +34 -11
- package/esm/components/ExtensionSlot.js.map +1 -1
- package/esm/components/ForeignComponentContainer.d.ts +19 -0
- package/esm/components/ForeignComponentContainer.js +46 -0
- package/esm/components/ForeignComponentContainer.js.map +1 -0
- package/esm/components/Mediator.js +15 -12
- package/esm/components/Mediator.js.map +1 -1
- package/esm/components/PiralGlobals.d.ts +6 -0
- package/esm/components/PiralGlobals.js +13 -0
- package/esm/components/PiralGlobals.js.map +1 -0
- package/esm/components/PiralRoutes.d.ts +5 -0
- package/esm/components/PiralRoutes.js +6 -11
- package/esm/components/PiralRoutes.js.map +1 -1
- package/esm/components/PiralSuspense.d.ts +5 -0
- package/esm/components/PiralSuspense.js +8 -0
- package/esm/components/PiralSuspense.js.map +1 -0
- package/esm/components/PiralView.d.ts +10 -1
- package/esm/components/PiralView.js +12 -25
- package/esm/components/PiralView.js.map +1 -1
- package/esm/components/PortalRenderer.d.ts +5 -0
- package/esm/components/PortalRenderer.js +7 -0
- package/esm/components/PortalRenderer.js.map +1 -0
- package/esm/components/ResponsiveLayout.d.ts +9 -1
- package/esm/components/ResponsiveLayout.js +5 -13
- package/esm/components/ResponsiveLayout.js.map +1 -1
- package/esm/components/SwitchErrorInfo.js +12 -10
- package/esm/components/SwitchErrorInfo.js.map +1 -1
- package/esm/components/components.d.ts +18 -6
- package/esm/components/components.js +21 -9
- package/esm/components/components.js.map +1 -1
- package/esm/components/index.d.ts +4 -10
- package/esm/components/index.js +4 -10
- package/esm/components/index.js.map +1 -1
- package/esm/components/wrapComponent.d.ts +7 -0
- package/esm/components/wrapComponent.js +42 -0
- package/esm/components/wrapComponent.js.map +1 -0
- package/esm/createInstance.d.ts +2 -2
- package/esm/createInstance.js +34 -30
- package/esm/createInstance.js.map +1 -1
- package/esm/defaults/DefaultErrorInfo.js +10 -0
- package/esm/defaults/DefaultErrorInfo.js.map +1 -0
- package/esm/{components → defaults}/DefaultLayout.js +1 -4
- package/esm/defaults/DefaultLayout.js.map +1 -0
- package/esm/{components/DefaultLoader.js → defaults/DefaultLoadingIndicator.js} +2 -2
- package/esm/defaults/DefaultLoadingIndicator.js.map +1 -0
- package/esm/defaults/DefaultRouteSwitch_v5.d.ts +3 -0
- package/esm/defaults/DefaultRouteSwitch_v5.js +11 -0
- package/esm/defaults/DefaultRouteSwitch_v5.js.map +1 -0
- package/esm/defaults/DefaultRouteSwitch_v6.d.ts +3 -0
- package/esm/defaults/DefaultRouteSwitch_v6.js +15 -0
- package/esm/defaults/DefaultRouteSwitch_v6.js.map +1 -0
- package/esm/defaults/DefaultRouter_v5.d.ts +3 -0
- package/esm/defaults/DefaultRouter_v5.js +7 -0
- package/esm/defaults/DefaultRouter_v5.js.map +1 -0
- package/esm/defaults/DefaultRouter_v6.d.ts +3 -0
- package/esm/defaults/DefaultRouter_v6.js +7 -0
- package/esm/defaults/DefaultRouter_v6.js.map +1 -0
- package/esm/defaults/navigator_none.d.ts +5 -0
- package/esm/defaults/navigator_none.js +30 -0
- package/esm/defaults/navigator_none.js.map +1 -0
- package/esm/defaults/navigator_v5.d.ts +6 -0
- package/esm/defaults/navigator_v5.js +81 -0
- package/esm/defaults/navigator_v5.js.map +1 -0
- package/esm/defaults/navigator_v6.d.ts +6 -0
- package/esm/defaults/navigator_v6.js +77 -0
- package/esm/defaults/navigator_v6.js.map +1 -0
- package/esm/helpers.d.ts +12 -26
- package/esm/helpers.js +14 -72
- package/esm/helpers.js.map +1 -1
- package/esm/hooks/action.js +2 -3
- package/esm/hooks/action.js.map +1 -1
- package/esm/hooks/actions.js +1 -1
- package/esm/hooks/actions.js.map +1 -1
- package/esm/hooks/globalState.d.ts +7 -0
- package/esm/hooks/globalState.js +10 -8
- package/esm/hooks/globalState.js.map +1 -1
- package/esm/hooks/index.d.ts +2 -5
- package/esm/hooks/index.js +2 -5
- package/esm/hooks/index.js.map +1 -1
- package/esm/hooks/media.js +8 -7
- package/esm/hooks/media.js.map +1 -1
- package/esm/hooks/piletApi.d.ts +7 -0
- package/esm/hooks/piletApi.js +14 -0
- package/esm/hooks/piletApi.js.map +1 -0
- package/esm/hooks/routes.d.ts +2 -0
- package/esm/hooks/routes.js +11 -0
- package/esm/hooks/routes.js.map +1 -0
- package/esm/hooks/setter.js +3 -2
- package/esm/hooks/setter.js.map +1 -1
- package/esm/hooks/sharedData.js +2 -2
- package/esm/hooks/sharedData.js.map +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/index.js.map +1 -1
- package/esm/modules/api.d.ts +2 -5
- package/esm/modules/api.js +9 -69
- package/esm/modules/api.js.map +1 -1
- package/esm/modules/core.d.ts +3 -0
- package/esm/modules/core.js +50 -0
- package/esm/modules/core.js.map +1 -0
- package/esm/modules/dependencies.d.ts +5 -6
- package/esm/modules/dependencies.js +9 -24
- package/esm/modules/dependencies.js.map +1 -1
- package/esm/modules/element.d.ts +5 -0
- package/esm/modules/element.js +169 -0
- package/esm/modules/element.js.map +1 -0
- package/esm/modules/index.d.ts +1 -0
- package/esm/modules/index.js +1 -0
- package/esm/modules/index.js.map +1 -1
- package/esm/setters/SetComponent.js +11 -0
- package/esm/setters/SetComponent.js.map +1 -0
- package/esm/setters/SetError.js +11 -0
- package/esm/setters/SetError.js.map +1 -0
- package/esm/setters/SetErrors.js +9 -0
- package/esm/setters/SetErrors.js.map +1 -0
- package/esm/setters/SetLayout.js +9 -0
- package/esm/setters/SetLayout.js.map +1 -0
- package/esm/setters/SetProvider.js +11 -0
- package/esm/setters/SetProvider.js.map +1 -0
- package/esm/setters/SetRedirect.js +12 -0
- package/esm/setters/SetRedirect.js.map +1 -0
- package/{lib/components → esm/setters}/SetRoute.d.ts +6 -2
- package/esm/setters/SetRoute.js +11 -0
- package/esm/setters/SetRoute.js.map +1 -0
- package/esm/setters/index.d.ts +7 -0
- package/esm/setters/index.js +8 -0
- package/esm/setters/index.js.map +1 -0
- package/esm/state/createActions.d.ts +2 -2
- package/esm/state/createActions.js +8 -12
- package/esm/state/createActions.js.map +1 -1
- package/esm/state/createGlobalState.d.ts +1 -2
- package/esm/state/createGlobalState.js +9 -34
- package/esm/state/createGlobalState.js.map +1 -1
- package/esm/state/stateContext.js +1 -1
- package/esm/state/stateContext.js.map +1 -1
- package/esm/state/withApi.d.ts +1 -1
- package/esm/state/withApi.js +19 -104
- package/esm/state/withApi.js.map +1 -1
- package/esm/tools/codegen.d.ts +21 -0
- package/esm/tools/codegen.js +145 -0
- package/esm/tools/codegen.js.map +1 -0
- package/esm/tools/debugger.d.ts +4 -0
- package/esm/tools/debugger.js +54 -0
- package/esm/tools/debugger.js.map +1 -0
- package/esm/tools/emulator.d.ts +3 -0
- package/esm/tools/emulator.js +11 -0
- package/esm/tools/emulator.js.map +1 -0
- package/esm/types/api.d.ts +34 -9
- package/esm/types/common.d.ts +11 -11
- package/esm/types/components.d.ts +74 -8
- package/esm/types/config.d.ts +24 -17
- package/esm/types/data.d.ts +2 -2
- package/esm/types/extension.d.ts +31 -4
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/index.js.map +1 -1
- package/esm/types/instance.d.ts +26 -4
- package/esm/types/layout.d.ts +3 -3
- package/esm/types/navigation.d.ts +94 -0
- package/esm/types/navigation.js +2 -0
- package/esm/types/navigation.js.map +1 -0
- package/esm/types/plugin.d.ts +1 -14
- package/esm/types/state.d.ts +66 -27
- package/esm/types/utils.d.ts +1 -1
- package/esm/utils/compare.d.ts +1 -1
- package/esm/utils/compare.js +24 -7
- package/esm/utils/compare.js.map +1 -1
- package/esm/utils/data.js +6 -7
- package/esm/utils/data.js.map +1 -1
- package/esm/utils/extension.d.ts +16 -0
- package/esm/utils/extension.js +37 -0
- package/esm/utils/extension.js.map +1 -0
- package/esm/utils/foreign.d.ts +7 -2
- package/esm/utils/foreign.js +20 -9
- package/esm/utils/foreign.js.map +1 -1
- package/esm/utils/guid.js +3 -3
- package/esm/utils/guid.js.map +1 -1
- package/esm/utils/helpers.d.ts +11 -8
- package/esm/utils/helpers.js +29 -18
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/index.d.ts +3 -1
- package/esm/utils/index.js +3 -1
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/media.js +8 -8
- package/esm/utils/media.js.map +1 -1
- package/esm/utils/state.d.ts +57 -0
- package/esm/utils/state.js +83 -0
- package/esm/utils/state.js.map +1 -0
- package/esm/utils/storage.js +13 -14
- package/esm/utils/storage.js.map +1 -1
- package/lib/Piral.d.ts +4 -4
- package/lib/Piral.js +11 -13
- package/lib/Piral.js.map +1 -1
- package/lib/PiralContext.d.ts +21 -0
- package/lib/PiralContext.js +38 -0
- package/lib/PiralContext.js.map +1 -0
- package/lib/RootListener.d.ts +2 -0
- package/lib/RootListener.js +27 -0
- package/lib/RootListener.js.map +1 -0
- package/lib/actions/app.d.ts +7 -4
- package/lib/actions/app.js +27 -16
- package/lib/actions/app.js.map +1 -1
- package/lib/actions/components.js +5 -6
- package/lib/actions/components.js.map +1 -1
- package/lib/actions/data.js +17 -18
- package/lib/actions/data.js.map +1 -1
- package/lib/actions/define.js +2 -3
- package/lib/actions/define.js.map +1 -1
- package/lib/actions/index.js +1 -1
- package/lib/actions/portal.d.ts +2 -0
- package/lib/actions/portal.js +12 -5
- package/lib/actions/portal.js.map +1 -1
- package/lib/actions/state.js +7 -4
- package/lib/actions/state.js.map +1 -1
- package/lib/components/ErrorBoundary.d.ts +14 -31
- package/lib/components/ErrorBoundary.js +23 -28
- package/lib/components/ErrorBoundary.js.map +1 -1
- package/lib/components/ExtensionSlot.d.ts +1 -0
- package/lib/components/ExtensionSlot.js +37 -14
- package/lib/components/ExtensionSlot.js.map +1 -1
- package/lib/components/ForeignComponentContainer.d.ts +19 -0
- package/lib/components/ForeignComponentContainer.js +50 -0
- package/lib/components/ForeignComponentContainer.js.map +1 -0
- package/lib/components/Mediator.js +18 -14
- package/lib/components/Mediator.js.map +1 -1
- package/lib/components/PiralGlobals.d.ts +6 -0
- package/lib/components/PiralGlobals.js +17 -0
- package/lib/components/PiralGlobals.js.map +1 -0
- package/lib/components/PiralRoutes.d.ts +5 -0
- package/lib/components/PiralRoutes.js +8 -12
- package/lib/components/PiralRoutes.js.map +1 -1
- package/lib/components/PiralSuspense.d.ts +5 -0
- package/lib/components/PiralSuspense.js +12 -0
- package/lib/components/PiralSuspense.js.map +1 -0
- package/lib/components/PiralView.d.ts +10 -1
- package/lib/components/PiralView.js +15 -27
- package/lib/components/PiralView.js.map +1 -1
- package/lib/components/PortalRenderer.d.ts +5 -0
- package/lib/components/PortalRenderer.js +11 -0
- package/lib/components/PortalRenderer.js.map +1 -0
- package/lib/components/ResponsiveLayout.d.ts +9 -1
- package/lib/components/ResponsiveLayout.js +7 -14
- package/lib/components/ResponsiveLayout.js.map +1 -1
- package/lib/components/SwitchErrorInfo.js +15 -12
- package/lib/components/SwitchErrorInfo.js.map +1 -1
- package/lib/components/components.d.ts +18 -6
- package/lib/components/components.js +24 -12
- package/lib/components/components.js.map +1 -1
- package/lib/components/index.d.ts +4 -10
- package/lib/components/index.js +5 -11
- package/lib/components/index.js.map +1 -1
- package/lib/components/wrapComponent.d.ts +7 -0
- package/lib/components/wrapComponent.js +46 -0
- package/lib/components/wrapComponent.js.map +1 -0
- package/lib/createInstance.d.ts +2 -2
- package/lib/createInstance.js +40 -36
- package/lib/createInstance.js.map +1 -1
- package/lib/defaults/DefaultErrorInfo.js +14 -0
- package/lib/defaults/DefaultErrorInfo.js.map +1 -0
- package/lib/{components → defaults}/DefaultLayout.js +3 -5
- package/lib/defaults/DefaultLayout.js.map +1 -0
- package/lib/{components/DefaultLoader.js → defaults/DefaultLoadingIndicator.js} +4 -3
- package/lib/defaults/DefaultLoadingIndicator.js.map +1 -0
- package/lib/defaults/DefaultRouteSwitch_v5.d.ts +3 -0
- package/lib/defaults/DefaultRouteSwitch_v5.js +15 -0
- package/lib/defaults/DefaultRouteSwitch_v5.js.map +1 -0
- package/lib/defaults/DefaultRouteSwitch_v6.d.ts +3 -0
- package/lib/defaults/DefaultRouteSwitch_v6.js +19 -0
- package/lib/defaults/DefaultRouteSwitch_v6.js.map +1 -0
- package/lib/defaults/DefaultRouter_v5.d.ts +3 -0
- package/lib/defaults/DefaultRouter_v5.js +11 -0
- package/lib/defaults/DefaultRouter_v5.js.map +1 -0
- package/lib/defaults/DefaultRouter_v6.d.ts +3 -0
- package/lib/defaults/DefaultRouter_v6.js +11 -0
- package/lib/defaults/DefaultRouter_v6.js.map +1 -0
- package/lib/defaults/navigator_none.d.ts +5 -0
- package/lib/defaults/navigator_none.js +37 -0
- package/lib/defaults/navigator_none.js.map +1 -0
- package/lib/defaults/navigator_v5.d.ts +6 -0
- package/lib/defaults/navigator_v5.js +88 -0
- package/lib/defaults/navigator_v5.js.map +1 -0
- package/lib/defaults/navigator_v6.d.ts +6 -0
- package/lib/defaults/navigator_v6.js +84 -0
- package/lib/defaults/navigator_v6.js.map +1 -0
- package/lib/helpers.d.ts +12 -26
- package/lib/helpers.js +15 -75
- package/lib/helpers.js.map +1 -1
- package/lib/hooks/action.js +2 -3
- package/lib/hooks/action.js.map +1 -1
- package/lib/hooks/actions.js +4 -4
- package/lib/hooks/actions.js.map +1 -1
- package/lib/hooks/globalState.d.ts +7 -0
- package/lib/hooks/globalState.js +14 -11
- package/lib/hooks/globalState.js.map +1 -1
- package/lib/hooks/index.d.ts +2 -5
- package/lib/hooks/index.js +3 -6
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/media.js +10 -9
- package/lib/hooks/media.js.map +1 -1
- package/lib/hooks/piletApi.d.ts +7 -0
- package/lib/hooks/piletApi.js +18 -0
- package/lib/hooks/piletApi.js.map +1 -0
- package/lib/hooks/routes.d.ts +2 -0
- package/lib/hooks/routes.js +15 -0
- package/lib/hooks/routes.js.map +1 -0
- package/lib/hooks/setter.js +4 -3
- package/lib/hooks/setter.js.map +1 -1
- package/lib/hooks/sharedData.js +3 -3
- package/lib/hooks/sharedData.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/modules/api.d.ts +2 -5
- package/lib/modules/api.js +12 -75
- package/lib/modules/api.js.map +1 -1
- package/lib/modules/core.d.ts +3 -0
- package/lib/modules/core.js +54 -0
- package/lib/modules/core.js.map +1 -0
- package/lib/modules/dependencies.d.ts +5 -6
- package/lib/modules/dependencies.js +12 -27
- package/lib/modules/dependencies.js.map +1 -1
- package/lib/modules/element.d.ts +5 -0
- package/lib/modules/element.js +173 -0
- package/lib/modules/element.js.map +1 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -1
- package/lib/modules/index.js.map +1 -1
- package/lib/setters/SetComponent.js +15 -0
- package/lib/setters/SetComponent.js.map +1 -0
- package/lib/setters/SetError.js +15 -0
- package/lib/setters/SetError.js.map +1 -0
- package/lib/setters/SetErrors.js +13 -0
- package/lib/setters/SetErrors.js.map +1 -0
- package/lib/setters/SetLayout.js +13 -0
- package/lib/setters/SetLayout.js.map +1 -0
- package/lib/{components → setters}/SetProvider.js +4 -5
- package/lib/setters/SetProvider.js.map +1 -0
- package/lib/setters/SetRedirect.js +16 -0
- package/lib/setters/SetRedirect.js.map +1 -0
- package/{esm/components → lib/setters}/SetRoute.d.ts +6 -2
- package/lib/setters/SetRoute.js +15 -0
- package/lib/setters/SetRoute.js.map +1 -0
- package/lib/setters/index.d.ts +7 -0
- package/lib/setters/index.js +11 -0
- package/lib/setters/index.js.map +1 -0
- package/lib/state/createActions.d.ts +2 -2
- package/lib/state/createActions.js +9 -13
- package/lib/state/createActions.js.map +1 -1
- package/lib/state/createGlobalState.d.ts +1 -2
- package/lib/state/createGlobalState.js +9 -34
- package/lib/state/createGlobalState.js.map +1 -1
- package/lib/state/index.js +1 -1
- package/lib/state/stateContext.js +1 -1
- package/lib/state/stateContext.js.map +1 -1
- package/lib/state/withApi.d.ts +1 -1
- package/lib/state/withApi.js +20 -105
- package/lib/state/withApi.js.map +1 -1
- package/lib/tools/codegen.d.ts +21 -0
- package/lib/tools/codegen.js +152 -0
- package/lib/tools/codegen.js.map +1 -0
- package/lib/tools/debugger.d.ts +4 -0
- package/lib/tools/debugger.js +58 -0
- package/lib/tools/debugger.js.map +1 -0
- package/lib/tools/emulator.d.ts +3 -0
- package/lib/tools/emulator.js +15 -0
- package/lib/tools/emulator.js.map +1 -0
- package/lib/types/api.d.ts +34 -9
- package/lib/types/common.d.ts +11 -11
- package/lib/types/components.d.ts +74 -8
- package/lib/types/config.d.ts +24 -17
- package/lib/types/data.d.ts +2 -2
- package/lib/types/extension.d.ts +31 -4
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +2 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/instance.d.ts +26 -4
- package/lib/types/layout.d.ts +3 -3
- package/lib/types/navigation.d.ts +94 -0
- package/lib/types/navigation.js +3 -0
- package/lib/types/navigation.js.map +1 -0
- package/lib/types/plugin.d.ts +1 -14
- package/lib/types/state.d.ts +66 -27
- package/lib/types/utils.d.ts +1 -1
- package/lib/utils/compare.d.ts +1 -1
- package/lib/utils/compare.js +26 -9
- package/lib/utils/compare.js.map +1 -1
- package/lib/utils/data.js +6 -7
- package/lib/utils/data.js.map +1 -1
- package/lib/utils/extension.d.ts +16 -0
- package/lib/utils/extension.js +42 -0
- package/lib/utils/extension.js.map +1 -0
- package/lib/utils/foreign.d.ts +7 -2
- package/lib/utils/foreign.js +25 -12
- package/lib/utils/foreign.js.map +1 -1
- package/lib/utils/guid.js +3 -3
- package/lib/utils/guid.js.map +1 -1
- package/lib/utils/helpers.d.ts +11 -8
- package/lib/utils/helpers.js +31 -18
- package/lib/utils/helpers.js.map +1 -1
- package/lib/utils/index.d.ts +3 -1
- package/lib/utils/index.js +7 -2
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/media.js +7 -7
- package/lib/utils/media.js.map +1 -1
- package/lib/utils/react.js +1 -1
- package/lib/utils/react.js.map +1 -1
- package/lib/utils/state.d.ts +57 -0
- package/lib/utils/state.js +94 -0
- package/lib/utils/state.js.map +1 -0
- package/lib/utils/storage.js +11 -12
- package/lib/utils/storage.js.map +1 -1
- package/package.json +51 -20
- package/src/Piral.test.tsx +7 -16
- package/src/Piral.tsx +12 -11
- package/src/PiralContext.tsx +43 -0
- package/src/RootListener.test.tsx +46 -0
- package/src/RootListener.tsx +26 -0
- package/src/actions/app.test.ts +114 -44
- package/src/actions/app.ts +33 -23
- package/src/actions/components.test.ts +11 -11
- package/src/actions/components.ts +5 -33
- package/src/actions/data.test.ts +50 -50
- package/src/actions/define.test.ts +2 -2
- package/src/actions/portal.test.ts +62 -17
- package/src/actions/portal.ts +19 -1
- package/src/actions/state.test.ts +3 -3
- package/src/actions/state.ts +8 -4
- package/src/components/ErrorBoundary.tsx +22 -49
- package/src/components/ExtensionSlot.test.tsx +115 -30
- package/src/components/ExtensionSlot.tsx +57 -18
- package/src/components/ForeignComponentContainer.test.tsx +100 -0
- package/src/components/ForeignComponentContainer.tsx +63 -0
- package/src/components/Mediator.test.tsx +16 -14
- package/src/components/Mediator.tsx +17 -9
- package/src/components/PiralGlobals.tsx +16 -0
- package/src/components/PiralRoutes.test.tsx +65 -57
- package/src/components/PiralRoutes.tsx +10 -17
- package/src/components/PiralSuspense.tsx +19 -0
- package/src/components/PiralView-server.test.tsx +61 -0
- package/src/components/PiralView.test.tsx +27 -26
- package/src/components/PiralView.tsx +28 -35
- package/src/components/PortalRenderer.tsx +12 -0
- package/src/components/ResponsiveLayout.test.tsx +18 -37
- package/src/components/ResponsiveLayout.tsx +18 -15
- package/src/components/SwitchErrorInfo.test.tsx +36 -0
- package/src/components/SwitchErrorInfo.tsx +5 -1
- package/src/components/components.tsx +20 -6
- package/src/components/index.ts +4 -10
- package/src/components/wrapComponent.tsx +74 -0
- package/src/createInstance.test.tsx +10 -0
- package/src/createInstance.tsx +19 -14
- package/src/{components → defaults}/DefaultErrorInfo.test.tsx +15 -18
- package/src/{components → defaults}/DefaultErrorInfo.tsx +2 -3
- package/src/defaults/DefaultLayout.test.tsx +23 -0
- package/src/defaults/DefaultLoadingIndicator.test.tsx +10 -0
- package/src/defaults/DefaultRouteSwitch_v5.tsx +15 -0
- package/src/defaults/DefaultRouteSwitch_v6.tsx +20 -0
- package/src/defaults/DefaultRouter_v5.tsx +8 -0
- package/src/defaults/DefaultRouter_v6.tsx +8 -0
- package/src/defaults/navigator_none.tsx +35 -0
- package/src/defaults/navigator_v5.tsx +99 -0
- package/src/defaults/navigator_v6.tsx +96 -0
- package/src/helpers.test.tsx +30 -49
- package/src/helpers.tsx +31 -108
- package/src/hooks/action.ts +2 -3
- package/src/hooks/globalState.ts +10 -9
- package/src/hooks/index.ts +2 -5
- package/src/hooks/media.ts +2 -1
- package/src/hooks/piletApi.ts +14 -0
- package/src/hooks/routes.ts +14 -0
- package/src/hooks/setter-server.test.ts +22 -0
- package/src/hooks/setter.test.ts +18 -0
- package/src/hooks/setter.ts +2 -1
- package/src/index.tsx +3 -1
- package/src/modules/api.test.ts +15 -26
- package/src/modules/api.ts +3 -66
- package/src/modules/core.test.ts +148 -0
- package/src/modules/core.ts +52 -0
- package/src/modules/dependencies.test.ts +16 -5
- package/src/modules/dependencies.ts +13 -31
- package/src/modules/element-server.test.ts +29 -0
- package/src/modules/element.test.ts +67 -0
- package/src/modules/element.ts +212 -0
- package/src/modules/index.ts +1 -0
- package/src/{components → setters}/SetComponent.test.tsx +9 -8
- package/src/{components → setters}/SetComponent.tsx +2 -2
- package/src/{components → setters}/SetError.test.tsx +9 -8
- package/src/{components → setters}/SetError.tsx +2 -2
- package/src/{components → setters}/SetErrors.test.tsx +9 -8
- package/src/{components → setters}/SetLayout.test.tsx +9 -8
- package/src/{components → setters}/SetProvider.test.tsx +9 -8
- package/src/{components → setters}/SetProvider.tsx +2 -2
- package/src/{components → setters}/SetRedirect.test.tsx +9 -8
- package/src/{components → setters}/SetRedirect.tsx +4 -4
- package/src/{components → setters}/SetRoute.test.tsx +9 -8
- package/src/{components → setters}/SetRoute.tsx +7 -4
- package/src/setters/index.ts +7 -0
- package/src/state/createActions.test.ts +2 -2
- package/src/state/createActions.ts +5 -3
- package/src/state/createGlobalState.test.ts +55 -54
- package/src/state/createGlobalState.ts +4 -28
- package/src/state/withApi.test.tsx +87 -40
- package/src/state/withApi.tsx +31 -165
- package/src/tools/codegen.ts +193 -0
- package/src/tools/debugger.ts +84 -0
- package/src/tools/emulator.ts +13 -0
- package/src/types/api.ts +47 -10
- package/src/types/components.ts +76 -7
- package/src/types/config.ts +23 -17
- package/src/types/extension.ts +38 -5
- package/src/types/index.ts +1 -0
- package/src/types/instance.ts +28 -4
- package/src/types/navigation.ts +101 -0
- package/src/types/plugin.ts +1 -15
- package/src/types/state.ts +65 -25
- package/src/types/utils.ts +1 -1
- package/src/utils/compare.test.ts +15 -15
- package/src/utils/compare.ts +23 -3
- package/src/utils/extension.test.tsx +21 -0
- package/src/utils/extension.tsx +48 -0
- package/src/utils/foreign.test.ts +29 -11
- package/src/utils/foreign.ts +34 -7
- package/src/utils/guid.test.ts +6 -1
- package/src/utils/helpers.test.ts +52 -0
- package/src/utils/helpers.ts +22 -8
- package/src/utils/index.ts +4 -1
- package/src/utils/media-server.test.ts +13 -0
- package/src/utils/media.ts +2 -2
- package/src/utils/state.test.ts +37 -0
- package/src/utils/state.ts +131 -0
- package/dependencies.codegen +0 -9
- package/dependencies.codegen.native.js +0 -2
- package/esm/components/DefaultErrorInfo.js +0 -12
- package/esm/components/DefaultErrorInfo.js.map +0 -1
- package/esm/components/DefaultLayout.js.map +0 -1
- package/esm/components/DefaultLoader.js.map +0 -1
- package/esm/components/SetComponent.js +0 -12
- package/esm/components/SetComponent.js.map +0 -1
- package/esm/components/SetError.js +0 -12
- package/esm/components/SetError.js.map +0 -1
- package/esm/components/SetErrors.js +0 -10
- package/esm/components/SetErrors.js.map +0 -1
- package/esm/components/SetLayout.js +0 -10
- package/esm/components/SetLayout.js.map +0 -1
- package/esm/components/SetProvider.js +0 -12
- package/esm/components/SetProvider.js.map +0 -1
- package/esm/components/SetRedirect.js +0 -14
- package/esm/components/SetRedirect.js.map +0 -1
- package/esm/components/SetRoute.js +0 -12
- package/esm/components/SetRoute.js.map +0 -1
- package/esm/hooks/debounce.d.ts +0 -8
- package/esm/hooks/debounce.js +0 -18
- package/esm/hooks/debounce.js.map +0 -1
- package/esm/hooks/lockBodyScroll.d.ts +0 -6
- package/esm/hooks/lockBodyScroll.js +0 -13
- package/esm/hooks/lockBodyScroll.js.map +0 -1
- package/esm/hooks/onClickOutside.d.ts +0 -8
- package/esm/hooks/onClickOutside.js +0 -23
- package/esm/hooks/onClickOutside.js.map +0 -1
- package/esm/hooks/onScreenVisible.d.ts +0 -11
- package/esm/hooks/onScreenVisible.js +0 -28
- package/esm/hooks/onScreenVisible.js.map +0 -1
- package/esm/hooks/promise.d.ts +0 -13
- package/esm/hooks/promise.js +0 -21
- package/esm/hooks/promise.js.map +0 -1
- package/esm/utils/events.d.ts +0 -3
- package/esm/utils/events.js +0 -35
- package/esm/utils/events.js.map +0 -1
- package/lib/components/DefaultErrorInfo.js +0 -15
- package/lib/components/DefaultErrorInfo.js.map +0 -1
- package/lib/components/DefaultLayout.js.map +0 -1
- package/lib/components/DefaultLoader.js.map +0 -1
- package/lib/components/SetComponent.js +0 -16
- package/lib/components/SetComponent.js.map +0 -1
- package/lib/components/SetError.js +0 -16
- package/lib/components/SetError.js.map +0 -1
- package/lib/components/SetErrors.js +0 -14
- package/lib/components/SetErrors.js.map +0 -1
- package/lib/components/SetLayout.js +0 -14
- package/lib/components/SetLayout.js.map +0 -1
- package/lib/components/SetProvider.js.map +0 -1
- package/lib/components/SetRedirect.js +0 -18
- package/lib/components/SetRedirect.js.map +0 -1
- package/lib/components/SetRoute.js +0 -16
- package/lib/components/SetRoute.js.map +0 -1
- package/lib/hooks/debounce.d.ts +0 -8
- package/lib/hooks/debounce.js +0 -22
- package/lib/hooks/debounce.js.map +0 -1
- package/lib/hooks/lockBodyScroll.d.ts +0 -6
- package/lib/hooks/lockBodyScroll.js +0 -17
- package/lib/hooks/lockBodyScroll.js.map +0 -1
- package/lib/hooks/onClickOutside.d.ts +0 -8
- package/lib/hooks/onClickOutside.js +0 -27
- package/lib/hooks/onClickOutside.js.map +0 -1
- package/lib/hooks/onScreenVisible.d.ts +0 -11
- package/lib/hooks/onScreenVisible.js +0 -32
- package/lib/hooks/onScreenVisible.js.map +0 -1
- package/lib/hooks/promise.d.ts +0 -13
- package/lib/hooks/promise.js +0 -25
- package/lib/hooks/promise.js.map +0 -1
- package/lib/utils/events.d.ts +0 -3
- package/lib/utils/events.js +0 -39
- package/lib/utils/events.js.map +0 -1
- package/src/components/DefaultLayout.test.tsx +0 -23
- package/src/components/DefaultLoader.test.tsx +0 -10
- package/src/hooks/debounce.test.ts +0 -67
- package/src/hooks/debounce.ts +0 -19
- package/src/hooks/globalState.test.ts +0 -47
- package/src/hooks/lockBodyScroll.test.ts +0 -24
- package/src/hooks/lockBodyScroll.ts +0 -13
- package/src/hooks/onClickOutside.test.ts +0 -113
- package/src/hooks/onClickOutside.ts +0 -25
- package/src/hooks/onScreenVisible.test.ts +0 -68
- package/src/hooks/onScreenVisible.ts +0 -28
- package/src/hooks/promise.test.ts +0 -76
- package/src/hooks/promise.ts +0 -35
- package/src/utils/events.test.ts +0 -65
- package/src/utils/events.ts +0 -39
- package/esm/{components → defaults}/DefaultErrorInfo.d.ts +0 -0
- package/esm/{components → defaults}/DefaultLayout.d.ts +0 -0
- package/esm/{components/DefaultLoader.d.ts → defaults/DefaultLoadingIndicator.d.ts} +0 -0
- package/esm/{components → setters}/SetComponent.d.ts +0 -0
- package/esm/{components → setters}/SetError.d.ts +0 -0
- package/esm/{components → setters}/SetErrors.d.ts +0 -0
- package/esm/{components → setters}/SetLayout.d.ts +0 -0
- package/esm/{components → setters}/SetProvider.d.ts +0 -0
- package/esm/{components → setters}/SetRedirect.d.ts +0 -0
- package/lib/{components → defaults}/DefaultErrorInfo.d.ts +0 -0
- package/lib/{components → defaults}/DefaultLayout.d.ts +0 -0
- package/lib/{components/DefaultLoader.d.ts → defaults/DefaultLoadingIndicator.d.ts} +0 -0
- package/lib/{components → setters}/SetComponent.d.ts +0 -0
- package/lib/{components → setters}/SetError.d.ts +0 -0
- package/lib/{components → setters}/SetErrors.d.ts +0 -0
- package/lib/{components → setters}/SetLayout.d.ts +0 -0
- package/lib/{components → setters}/SetProvider.d.ts +0 -0
- package/lib/{components → setters}/SetRedirect.d.ts +0 -0
- package/src/{components → defaults}/DefaultLayout.tsx +1 -1
- /package/src/{components/DefaultLoader.tsx → defaults/DefaultLoadingIndicator.tsx} +0 -0
- /package/src/{components → setters}/SetErrors.tsx +0 -0
- /package/src/{components → setters}/SetLayout.tsx +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
import type { RouteComponentProps } from 'react-router';
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { RouteComponentProps, SwitchProps } from 'react-router';
|
|
3
3
|
import type { FirstParametersOf, UnionOf } from './common';
|
|
4
4
|
import type { PiralCustomErrors, PiralCustomComponentConverters } from './custom';
|
|
5
|
+
import type { NavigationApi } from './navigation';
|
|
5
6
|
import type { LayoutType } from './layout';
|
|
6
7
|
/**
|
|
7
8
|
* Mapping of available component converters.
|
|
@@ -30,7 +31,19 @@ export interface HtmlComponent<TProps> {
|
|
|
30
31
|
* The context to be transported into the generic components.
|
|
31
32
|
*/
|
|
32
33
|
export interface ComponentContext {
|
|
33
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The router-independent navigation API.
|
|
36
|
+
*/
|
|
37
|
+
navigation: NavigationApi;
|
|
38
|
+
/**
|
|
39
|
+
* The internal router object.
|
|
40
|
+
* @deprecated Exposes internals that can change at any time.
|
|
41
|
+
*/
|
|
42
|
+
router: any;
|
|
43
|
+
/**
|
|
44
|
+
* The public path of the application.
|
|
45
|
+
*/
|
|
46
|
+
publicPath: string;
|
|
34
47
|
}
|
|
35
48
|
/**
|
|
36
49
|
* Generic definition of a framework-independent component.
|
|
@@ -41,25 +54,28 @@ export interface ForeignComponent<TProps> {
|
|
|
41
54
|
* @param element The container hosting the element.
|
|
42
55
|
* @param props The props to transport.
|
|
43
56
|
* @param ctx The associated context.
|
|
57
|
+
* @param locals The local state of this component instance.
|
|
44
58
|
*/
|
|
45
|
-
mount(element: HTMLElement, props: TProps, ctx: ComponentContext): void;
|
|
59
|
+
mount(element: HTMLElement, props: TProps, ctx: ComponentContext, locals: Record<string, any>): void;
|
|
46
60
|
/**
|
|
47
61
|
* Called when the component should be updated.
|
|
48
62
|
* @param element The container hosting the element.
|
|
49
63
|
* @param props The props to transport.
|
|
50
64
|
* @param ctx The associated context.
|
|
65
|
+
* @param locals The local state of this component instance.
|
|
51
66
|
*/
|
|
52
|
-
update?(element: HTMLElement, props: TProps, ctx: ComponentContext): void;
|
|
67
|
+
update?(element: HTMLElement, props: TProps, ctx: ComponentContext, locals: Record<string, any>): void;
|
|
53
68
|
/**
|
|
54
69
|
* Called when a component is unmounted.
|
|
55
70
|
* @param element The container that was hosting the element.
|
|
71
|
+
* @param locals The local state of this component instance.
|
|
56
72
|
*/
|
|
57
|
-
unmount?(element: HTMLElement): void;
|
|
73
|
+
unmount?(element: HTMLElement, locals: Record<string, any>): void;
|
|
58
74
|
}
|
|
59
75
|
/**
|
|
60
76
|
* Possible shapes for a component.
|
|
61
77
|
*/
|
|
62
|
-
export
|
|
78
|
+
export type AnyComponent<T> = ComponentType<T> | FirstParametersOf<ComponentConverters<T>>;
|
|
63
79
|
/**
|
|
64
80
|
* The error used when a route cannot be resolved.
|
|
65
81
|
*/
|
|
@@ -81,6 +97,10 @@ export interface PageErrorInfoProps extends RouteComponentProps {
|
|
|
81
97
|
* The provided error details.
|
|
82
98
|
*/
|
|
83
99
|
error: any;
|
|
100
|
+
/**
|
|
101
|
+
* The name of the pilet emitting the error.
|
|
102
|
+
*/
|
|
103
|
+
pilet?: string;
|
|
84
104
|
}
|
|
85
105
|
/**
|
|
86
106
|
* The error used when the app could not be loaded.
|
|
@@ -107,6 +127,10 @@ export interface ExtensionErrorInfoProps {
|
|
|
107
127
|
* The provided error details.
|
|
108
128
|
*/
|
|
109
129
|
error: any;
|
|
130
|
+
/**
|
|
131
|
+
* The name of the pilet emitting the error.
|
|
132
|
+
*/
|
|
133
|
+
pilet?: string;
|
|
110
134
|
}
|
|
111
135
|
/**
|
|
112
136
|
* The error used when the exact type is unknown.
|
|
@@ -120,6 +144,10 @@ export interface UnknownErrorInfoProps {
|
|
|
120
144
|
* The provided error details.
|
|
121
145
|
*/
|
|
122
146
|
error: any;
|
|
147
|
+
/**
|
|
148
|
+
* The name of the pilet emitting the error.
|
|
149
|
+
*/
|
|
150
|
+
pilet?: string;
|
|
123
151
|
}
|
|
124
152
|
/**
|
|
125
153
|
* Map of all error types to their respective props.
|
|
@@ -149,7 +177,7 @@ export interface Errors extends PiralCustomErrors {
|
|
|
149
177
|
/**
|
|
150
178
|
* The props for the ErrorInfo component.
|
|
151
179
|
*/
|
|
152
|
-
export
|
|
180
|
+
export type ErrorInfoProps = UnionOf<Errors>;
|
|
153
181
|
/**
|
|
154
182
|
* The props of a Loading indicator component.
|
|
155
183
|
*/
|
|
@@ -163,9 +191,47 @@ export interface LayoutProps {
|
|
|
163
191
|
* The currently selected layout type.
|
|
164
192
|
*/
|
|
165
193
|
currentLayout: LayoutType;
|
|
194
|
+
/**
|
|
195
|
+
* The page's content.
|
|
196
|
+
*/
|
|
197
|
+
children: ReactNode;
|
|
166
198
|
}
|
|
167
199
|
/**
|
|
168
200
|
* The props of a Router component.
|
|
169
201
|
*/
|
|
170
202
|
export interface RouterProps {
|
|
203
|
+
/**
|
|
204
|
+
* The content to be rendered inside the router.
|
|
205
|
+
*/
|
|
206
|
+
children?: ReactNode;
|
|
207
|
+
/**
|
|
208
|
+
* The public path to use.
|
|
209
|
+
*/
|
|
210
|
+
publicPath: string;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Represents a path in the app registration.
|
|
214
|
+
*/
|
|
215
|
+
export interface AppPath {
|
|
216
|
+
/**
|
|
217
|
+
* The exact path to use.
|
|
218
|
+
*/
|
|
219
|
+
path: string;
|
|
220
|
+
/**
|
|
221
|
+
* The component to register for this path.
|
|
222
|
+
*/
|
|
223
|
+
Component: ComponentType<RouteComponentProps>;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The props of the RouteSwitch component.
|
|
227
|
+
*/
|
|
228
|
+
export interface RouteSwitchProps extends SwitchProps {
|
|
229
|
+
/**
|
|
230
|
+
* The component that should be used in case nothing was found.
|
|
231
|
+
*/
|
|
232
|
+
NotFound: ComponentType<RouteComponentProps>;
|
|
233
|
+
/**
|
|
234
|
+
* The component to register for the different paths.
|
|
235
|
+
*/
|
|
236
|
+
paths: Array<AppPath>;
|
|
171
237
|
}
|
package/lib/types/config.d.ts
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import type { PiletRequester,
|
|
1
|
+
import type { PiletRequester, PiletLoadingStrategy, PiletLoader, Pilet, AvailableDependencies, CustomSpecLoaders, DefaultLoaderConfig, PiletApiCreator } from 'piral-base';
|
|
2
|
+
import { DebuggerExtensionOptions } from 'piral-debug-utils';
|
|
2
3
|
import type { NestedPartial } from './common';
|
|
3
4
|
import type { PiralPlugin } from './plugin';
|
|
4
5
|
import type { GlobalState, GlobalStateContext, PiralDefineActions } from './state';
|
|
5
|
-
export { PiletLoadingStrategy,
|
|
6
|
+
export { PiletLoadingStrategy, PiletRequester, AvailableDependencies };
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* Definition for customizing the shared dependencies.
|
|
8
9
|
*/
|
|
9
|
-
export interface
|
|
10
|
-
/**
|
|
11
|
-
* The callback for defining how a dependency will be fetched.
|
|
12
|
-
*/
|
|
13
|
-
fetchDependency?: PiletDependencyFetcher;
|
|
10
|
+
export interface DependencySelector {
|
|
14
11
|
/**
|
|
15
|
-
*
|
|
12
|
+
* Selects the dependencies to share from the currently available dependencies.
|
|
13
|
+
* @param currentDependencies The currently available dependencies.
|
|
14
|
+
* @default currentDependencies All current dependencies are shared
|
|
15
|
+
* @returns The dependencies selected to be shared.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
(currentDependencies: AvailableDependencies): AvailableDependencies;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The configuration for loading the pilets of the Piral instance.
|
|
21
|
+
*/
|
|
22
|
+
export interface PiralPiletConfiguration {
|
|
18
23
|
/**
|
|
19
24
|
* Function to load the modules asynchronously, e.g., from a server 🚚.
|
|
20
25
|
*/
|
|
@@ -31,6 +36,10 @@ export interface PiralPiletConfiguration {
|
|
|
31
36
|
* Optionally, configures the default loader.
|
|
32
37
|
*/
|
|
33
38
|
loaderConfig?: DefaultLoaderConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Optionally, configures explicitly what dependencies are shared.
|
|
41
|
+
*/
|
|
42
|
+
shareDependencies?: DependencySelector;
|
|
34
43
|
/**
|
|
35
44
|
* Determines that pilets are loaded asynchronously, essentially showing the
|
|
36
45
|
* app right away without waiting for the pilets to load and evaluate.
|
|
@@ -42,12 +51,6 @@ export interface PiralPiletConfiguration {
|
|
|
42
51
|
* This can be used for customization or for debugging purposes.
|
|
43
52
|
*/
|
|
44
53
|
availablePilets?: Array<Pilet>;
|
|
45
|
-
/**
|
|
46
|
-
* Optionally provides a function to extend the API creator with some additional
|
|
47
|
-
* functionality.
|
|
48
|
-
* @deprecated Use plugins instead.
|
|
49
|
-
*/
|
|
50
|
-
extendApi?: PiralPlugin | Array<PiralPlugin>;
|
|
51
54
|
/**
|
|
52
55
|
* Extends the Piral instance with additional capabilities.
|
|
53
56
|
*/
|
|
@@ -80,8 +83,12 @@ export interface PiralStateConfiguration {
|
|
|
80
83
|
* Optionally, sets up some initial custom actions ⚡️.
|
|
81
84
|
*/
|
|
82
85
|
actions?: PiralDefineActions;
|
|
86
|
+
/**
|
|
87
|
+
* Optionally, sets up additional configuration for the debug tooling 🤖.
|
|
88
|
+
*/
|
|
89
|
+
debug?: DebuggerExtensionOptions;
|
|
83
90
|
}
|
|
84
91
|
/**
|
|
85
92
|
* The configuration to be used in the Piral instance.
|
|
86
93
|
*/
|
|
87
|
-
export
|
|
94
|
+
export type PiralConfiguration = PiralPiletConfiguration & PiralStateConfiguration;
|
package/lib/types/data.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface SharedData<TValue = any> {
|
|
|
10
10
|
/**
|
|
11
11
|
* Defines the potential targets when storing data.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type DataStoreTarget = 'memory' | 'local' | 'remote';
|
|
14
14
|
/**
|
|
15
15
|
* Defines the custom options for storing data.
|
|
16
16
|
*/
|
|
@@ -27,7 +27,7 @@ export interface CustomDataStoreOptions {
|
|
|
27
27
|
/**
|
|
28
28
|
* Defines the options to be used for storing data.
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
30
|
+
export type DataStoreOptions = DataStoreTarget | CustomDataStoreOptions;
|
|
31
31
|
/**
|
|
32
32
|
* Defines the shape of a shared data item.
|
|
33
33
|
*/
|
package/lib/types/extension.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import type { PiralCustomExtensionSlotMap } from './custom';
|
|
3
|
+
import type { ExtensionRegistration } from './state';
|
|
3
4
|
/**
|
|
4
5
|
* The mapping of the existing (known) extension slots.
|
|
5
6
|
*/
|
|
@@ -9,16 +10,38 @@ export interface PiralExtensionSlotMap extends PiralCustomExtensionSlotMap {
|
|
|
9
10
|
* The basic props for defining an extension slot.
|
|
10
11
|
*/
|
|
11
12
|
export interface BaseExtensionSlotProps<TName, TParams> {
|
|
13
|
+
/**
|
|
14
|
+
* The children to transport, if any.
|
|
15
|
+
*/
|
|
16
|
+
children?: ReactNode;
|
|
12
17
|
/**
|
|
13
18
|
* Defines what should be rendered when no components are available
|
|
14
19
|
* for the specified extension.
|
|
15
20
|
*/
|
|
16
|
-
empty?():
|
|
21
|
+
empty?(): ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Determines if the `render` function should be called in case no
|
|
24
|
+
* components are available for the specified extension.
|
|
25
|
+
*
|
|
26
|
+
* If true, `empty` will be called and returned from the slot.
|
|
27
|
+
* If false, `render` will be called with the result of calling `empty`.
|
|
28
|
+
* The result of calling `render` will then be returned from the slot.
|
|
29
|
+
*/
|
|
30
|
+
emptySkipsRender?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Defines the order of the components to render.
|
|
33
|
+
* May be more convient than using `render` w.r.t. ordering extensions
|
|
34
|
+
* by their supplied metadata.
|
|
35
|
+
* @param extensions The registered extensions.
|
|
36
|
+
* @returns The ordered extensions.
|
|
37
|
+
*/
|
|
38
|
+
order?(extensions: Array<ExtensionRegistration>): Array<ExtensionRegistration>;
|
|
17
39
|
/**
|
|
18
40
|
* Defines how the provided nodes should be rendered.
|
|
19
41
|
* @param nodes The rendered extension nodes.
|
|
42
|
+
* @returns The rendered nodes, i.e., an ReactElement.
|
|
20
43
|
*/
|
|
21
|
-
render?(nodes: Array<
|
|
44
|
+
render?(nodes: Array<ReactNode>): ReactElement<any, any> | null;
|
|
22
45
|
/**
|
|
23
46
|
* The custom parameters for the given extension.
|
|
24
47
|
*/
|
|
@@ -28,7 +51,11 @@ export interface BaseExtensionSlotProps<TName, TParams> {
|
|
|
28
51
|
*/
|
|
29
52
|
name: TName;
|
|
30
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Gives the extension params shape for the given extension slot name.
|
|
56
|
+
*/
|
|
57
|
+
export type ExtensionParams<TName> = TName extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[TName] : TName extends string ? any : TName;
|
|
31
58
|
/**
|
|
32
59
|
* The props for defining an extension slot.
|
|
33
60
|
*/
|
|
34
|
-
export
|
|
61
|
+
export type ExtensionSlotProps<TName = string> = BaseExtensionSlotProps<TName extends string ? TName : string, ExtensionParams<TName>>;
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./api"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./common"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./components"), exports);
|
|
@@ -10,6 +10,7 @@ tslib_1.__exportStar(require("./data"), exports);
|
|
|
10
10
|
tslib_1.__exportStar(require("./extension"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./instance"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./layout"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./navigation"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./plugin"), exports);
|
|
14
15
|
tslib_1.__exportStar(require("./state"), exports);
|
|
15
16
|
tslib_1.__exportStar(require("./utils"), exports);
|
package/lib/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,mDAAyB;AACzB,uDAA6B;AAC7B,mDAAyB;AACzB,mDAAyB;AACzB,iDAAuB;AACvB,sDAA4B;AAC5B,qDAA2B;AAC3B,mDAAyB;AACzB,mDAAyB;AACzB,kDAAwB;AACxB,kDAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,mDAAyB;AACzB,uDAA6B;AAC7B,mDAAyB;AACzB,mDAAyB;AACzB,iDAAuB;AACvB,sDAA4B;AAC5B,qDAA2B;AAC3B,mDAAyB;AACzB,uDAA6B;AAC7B,mDAAyB;AACzB,kDAAwB;AACxB,kDAAwB"}
|
package/lib/types/instance.d.ts
CHANGED
|
@@ -1,24 +1,46 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import type { PiletApi, PiletApiCreator, LoadPiletsOptions, EventEmitter } from 'piral-base';
|
|
2
3
|
import type { GlobalStateContext } from './state';
|
|
3
4
|
import type { LayoutBreakpoints } from './layout';
|
|
5
|
+
import type { PiralConfiguration } from './config';
|
|
4
6
|
/**
|
|
5
|
-
* The props of the Piral
|
|
7
|
+
* The props of the Piral context.
|
|
6
8
|
*/
|
|
7
|
-
export interface
|
|
9
|
+
export interface PiralContextProps {
|
|
8
10
|
/**
|
|
9
11
|
* The specific Piral instance to be used.
|
|
10
12
|
*/
|
|
11
13
|
instance?: PiralInstance;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The props of the Piral component.
|
|
18
|
+
*/
|
|
19
|
+
export interface PiralProps extends PiralContextProps {
|
|
12
20
|
/**
|
|
13
21
|
* The custom breakpoints for the different layout modi.
|
|
14
22
|
*/
|
|
15
23
|
breakpoints?: LayoutBreakpoints;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
|
-
* The
|
|
19
|
-
|
|
26
|
+
* The options for creating a new PiralInstance object.
|
|
27
|
+
*/
|
|
28
|
+
export interface PiralInstanceOptions extends PiralConfiguration {
|
|
29
|
+
/**
|
|
30
|
+
* Defines the id of this instance. Used in case of multiple instances.
|
|
31
|
+
*/
|
|
32
|
+
id?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The PiralInstance object, which is an event emitter with some other
|
|
36
|
+
* utilities and helper. This object is the source for the React
|
|
37
|
+
* functional component (`Piral`).
|
|
20
38
|
*/
|
|
21
39
|
export interface PiralInstance extends EventEmitter {
|
|
40
|
+
/**
|
|
41
|
+
* The id of the Piral instance.
|
|
42
|
+
*/
|
|
43
|
+
id: string;
|
|
22
44
|
/**
|
|
23
45
|
* The global state context instance.
|
|
24
46
|
*/
|
package/lib/types/layout.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The mapping of breakpoints to layout type index.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type LayoutBreakpoints = [string, string, string];
|
|
5
5
|
/**
|
|
6
6
|
* The different known layout types.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type LayoutType = 'mobile' | 'tablet' | 'desktop';
|
|
9
9
|
/**
|
|
10
10
|
* The mapping of the layout types to breakpoint index.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type LayoutTypes = [LayoutType, LayoutType, LayoutType];
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Disposable } from './utils';
|
|
2
|
+
export type NavigationAction = 'POP' | 'PUSH' | 'REPLACE';
|
|
3
|
+
export interface NavigationLocation {
|
|
4
|
+
/**
|
|
5
|
+
* The fully qualified URL incl. the origin and base path.
|
|
6
|
+
*/
|
|
7
|
+
href: string;
|
|
8
|
+
/**
|
|
9
|
+
* The location.pathname property is a string that contains an initial "/"
|
|
10
|
+
* followed by the remainder of the URL up to the ?.
|
|
11
|
+
*/
|
|
12
|
+
pathname: string;
|
|
13
|
+
/**
|
|
14
|
+
* The location.search property is a string that contains an initial "?"
|
|
15
|
+
* followed by the key=value pairs in the query string. If there are no
|
|
16
|
+
* parameters, this value may be the empty string (i.e. '').
|
|
17
|
+
*/
|
|
18
|
+
search: string;
|
|
19
|
+
/**
|
|
20
|
+
* The location.hash property is a string that contains an initial "#"
|
|
21
|
+
* followed by fragment identifier of the URL. If there is no fragment
|
|
22
|
+
* identifier, this value may be the empty string (i.e. '').
|
|
23
|
+
*/
|
|
24
|
+
hash: string;
|
|
25
|
+
/**
|
|
26
|
+
* The location.state property is a user-supplied State object that is
|
|
27
|
+
* associated with this location. This can be a useful place to store
|
|
28
|
+
* any information you do not want to put in the URL, e.g. session-specific
|
|
29
|
+
* data.
|
|
30
|
+
*/
|
|
31
|
+
state: unknown;
|
|
32
|
+
/**
|
|
33
|
+
* The location.key property is a unique string associated with this location.
|
|
34
|
+
* On the initial location, this will be the string default. On all subsequent
|
|
35
|
+
* locations, this string will be a unique identifier.
|
|
36
|
+
*/
|
|
37
|
+
key?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface NavigationListener {
|
|
40
|
+
(update: NavigationUpdate): void;
|
|
41
|
+
}
|
|
42
|
+
export interface NavigationBlocker {
|
|
43
|
+
(tx: NavigationTransition): void;
|
|
44
|
+
}
|
|
45
|
+
export interface NavigationUpdate {
|
|
46
|
+
action: NavigationAction;
|
|
47
|
+
location: NavigationLocation;
|
|
48
|
+
}
|
|
49
|
+
export interface NavigationTransition extends NavigationUpdate {
|
|
50
|
+
retry?(): void;
|
|
51
|
+
}
|
|
52
|
+
export interface NavigationApi {
|
|
53
|
+
/**
|
|
54
|
+
* Pushes a new location onto the history stack.
|
|
55
|
+
*/
|
|
56
|
+
push(target: string, state?: any): void;
|
|
57
|
+
/**
|
|
58
|
+
* Replaces the current location with another.
|
|
59
|
+
*/
|
|
60
|
+
replace(target: string, state?: any): void;
|
|
61
|
+
/**
|
|
62
|
+
* Changes the current index in the history stack by a given delta.
|
|
63
|
+
*/
|
|
64
|
+
go(n: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Prevents changes to the history stack from happening.
|
|
67
|
+
* This is useful when you want to prevent the user navigating
|
|
68
|
+
* away from the current page, for example when they have some
|
|
69
|
+
* unsaved data on the current page.
|
|
70
|
+
* @param blocker The function being called with a transition request.
|
|
71
|
+
* @returns The disposable for stopping the block.
|
|
72
|
+
*/
|
|
73
|
+
block(blocker: NavigationBlocker): Disposable;
|
|
74
|
+
/**
|
|
75
|
+
* Starts listening for location changes and calls the given
|
|
76
|
+
* callback with an Update when it does.
|
|
77
|
+
* @param listener The function being called when the route changes.
|
|
78
|
+
* @returns The disposable for stopping the block.
|
|
79
|
+
*/
|
|
80
|
+
listen(listener: NavigationListener): Disposable;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the current navigation / application path.
|
|
83
|
+
*/
|
|
84
|
+
path: string;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the current navigation path incl. search and hash parts.
|
|
87
|
+
*/
|
|
88
|
+
url: string;
|
|
89
|
+
/**
|
|
90
|
+
* The original router behind the navigation. Don't depend on this
|
|
91
|
+
* as the implementation is router specific and may change over time.
|
|
92
|
+
*/
|
|
93
|
+
router: any;
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/types/navigation.ts"],"names":[],"mappings":""}
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
+
import type { PiletApiExtender } from 'piral-base';
|
|
1
2
|
import type { PiletApi } from './api';
|
|
2
3
|
import type { GlobalStateContext } from './state';
|
|
3
|
-
import type { PiletMetadata } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
* Shape to be used by a Pilet API extension that requires other
|
|
6
|
-
* APIs or some metadata to work properly.
|
|
7
|
-
*/
|
|
8
|
-
export interface PiletApiExtender<T> {
|
|
9
|
-
/**
|
|
10
|
-
* Extends the base API of a module with new functionality.
|
|
11
|
-
* @param api The API created by the base layer.
|
|
12
|
-
* @param target The target the API is created for.
|
|
13
|
-
* @returns The extended API.
|
|
14
|
-
*/
|
|
15
|
-
(api: PiletApi, target: PiletMetadata): T;
|
|
16
|
-
}
|
|
17
4
|
/**
|
|
18
5
|
* Shape to be used by a plugin used in the Piral instance.
|
|
19
6
|
*/
|