piral-core 1.0.0-pre.2217 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +4 -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 -68
- 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 +37 -10
- 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 -74
- 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 +37 -10
- 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 +55 -18
- 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 -65
- 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 +50 -11
- 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,22 +1,45 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { isfunc } from 'piral-base';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { wrapComponent } from './wrapComponent';
|
|
4
|
+
import { useGlobalState, useGlobalStateContext } from '../hooks';
|
|
5
|
+
import { defaultRender, none } from '../utils';
|
|
6
|
+
const wrapper = ({ children }) => defaultRender(children);
|
|
7
|
+
const renderExtensions = [
|
|
8
|
+
{
|
|
9
|
+
component: (props) => {
|
|
10
|
+
const context = useGlobalStateContext();
|
|
11
|
+
const converters = context.converters;
|
|
12
|
+
const piral = context.apis._;
|
|
13
|
+
const { component, props: args } = props.params;
|
|
14
|
+
const Component = React.useMemo(() => wrapComponent(converters, component, { piral }, wrapper), [component]);
|
|
15
|
+
return React.createElement(Component, Object.assign({}, args));
|
|
16
|
+
},
|
|
17
|
+
defaults: {},
|
|
18
|
+
pilet: '',
|
|
19
|
+
reference: {
|
|
20
|
+
displayName: 'AnyComponent',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
function defaultOrder(extensions) {
|
|
25
|
+
return extensions;
|
|
26
|
+
}
|
|
6
27
|
/**
|
|
7
28
|
* The extension slot component to be used when the available
|
|
8
29
|
* extensions of a given name should be rendered at a specific
|
|
9
30
|
* location.
|
|
10
31
|
*/
|
|
11
32
|
export function ExtensionSlot(props) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
33
|
+
const { name, render = defaultRender, empty, params, children, emptySkipsRender = false, order = defaultOrder, } = props;
|
|
34
|
+
const extensions = useGlobalState((s) => (name ? s.registry.extensions[name] || none : renderExtensions));
|
|
35
|
+
const isEmpty = extensions.length === 0 && isfunc(empty);
|
|
36
|
+
const content = isEmpty
|
|
15
37
|
? [defaultRender(empty(), 'empty')]
|
|
16
|
-
: extensions.map(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
38
|
+
: order(extensions).map(({ component: Component, reference, defaults = {} }, i) => (React.createElement(Component, { key: `${(reference === null || reference === void 0 ? void 0 : reference.displayName) || '_'}${i}`, children: children, params: Object.assign(Object.assign({}, defaults), params) })));
|
|
39
|
+
if (isEmpty && emptySkipsRender) {
|
|
40
|
+
return content[0];
|
|
41
|
+
}
|
|
42
|
+
return render(content);
|
|
20
43
|
}
|
|
21
|
-
ExtensionSlot.displayName =
|
|
44
|
+
ExtensionSlot.displayName = `ExtensionSlot`;
|
|
22
45
|
//# sourceMappingURL=ExtensionSlot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtensionSlot.js","sourceRoot":"","sources":["../../src/components/ExtensionSlot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExtensionSlot.js","sourceRoot":"","sources":["../../src/components/ExtensionSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAG/C,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAE1D,MAAM,gBAAgB,GAA4B;IAChD;QACE,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;YACxC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;YACtC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;YAChD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;YAC7G,OAAO,oBAAC,SAAS,oBAAK,IAAI,EAAI,CAAC;QACjC,CAAC;QACD,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,SAAS,EAAE;YACT,WAAW,EAAE,cAAc;SAC5B;KACF;CACF,CAAC;AAEF,SAAS,YAAY,CAAC,UAAwC;IAC5D,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAmB,KAA4B;IAC1E,MAAM,EACJ,IAAI,EACJ,MAAM,GAAG,aAAa,EACtB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,gBAAgB,GAAG,KAAK,EACxB,KAAK,GAAG,YAAY,GACrB,GAAG,KAAK,CAAC;IACV,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1G,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,OAAO;QACrB,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAC/E,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,KAAI,GAAG,GAAG,CAAC,EAAE,EAC3C,QAAQ,EAAE,QAAQ,EAClB,MAAM,kCACD,QAAQ,GACR,MAAM,IAEX,CACH,CAAC,CAAC;IAEP,IAAI,OAAO,IAAI,gBAAgB,EAAE;QAC/B,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;KACnB;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;AACzB,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ForeignComponent, BaseComponentProps, ComponentContext } from '../types';
|
|
3
|
+
interface ForeignComponentContainerProps<T> {
|
|
4
|
+
$portalId: string;
|
|
5
|
+
$component: ForeignComponent<T>;
|
|
6
|
+
$context: ComponentContext;
|
|
7
|
+
innerProps: T & BaseComponentProps;
|
|
8
|
+
}
|
|
9
|
+
export declare class ForeignComponentContainer<T> extends React.Component<ForeignComponentContainerProps<T>> {
|
|
10
|
+
private locals?;
|
|
11
|
+
private current?;
|
|
12
|
+
private previous?;
|
|
13
|
+
private setNode;
|
|
14
|
+
componentDidMount(): void;
|
|
15
|
+
componentDidUpdate(): void;
|
|
16
|
+
componentWillUnmount(): void;
|
|
17
|
+
render(): JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { isfunc } from 'piral-base';
|
|
3
|
+
export class ForeignComponentContainer extends React.Component {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.locals = {};
|
|
7
|
+
this.setNode = (node) => {
|
|
8
|
+
this.current = node;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
componentDidMount() {
|
|
12
|
+
const { current } = this;
|
|
13
|
+
const { $component, $context, innerProps } = this.props;
|
|
14
|
+
const { mount } = $component;
|
|
15
|
+
if (current && isfunc(mount)) {
|
|
16
|
+
mount(current, innerProps, $context, this.locals);
|
|
17
|
+
}
|
|
18
|
+
this.previous = current;
|
|
19
|
+
}
|
|
20
|
+
componentDidUpdate() {
|
|
21
|
+
const { current, previous } = this;
|
|
22
|
+
const { $component, $context, innerProps } = this.props;
|
|
23
|
+
const { update } = $component;
|
|
24
|
+
if (current !== previous) {
|
|
25
|
+
previous && this.componentWillUnmount();
|
|
26
|
+
current && this.componentDidMount();
|
|
27
|
+
}
|
|
28
|
+
else if (isfunc(update)) {
|
|
29
|
+
update(current, innerProps, $context, this.locals);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
componentWillUnmount() {
|
|
33
|
+
const { previous } = this;
|
|
34
|
+
const { $component } = this.props;
|
|
35
|
+
const { unmount } = $component;
|
|
36
|
+
if (previous && isfunc(unmount)) {
|
|
37
|
+
unmount(previous, this.locals);
|
|
38
|
+
}
|
|
39
|
+
this.previous = undefined;
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
const { $portalId } = this.props;
|
|
43
|
+
return React.createElement("piral-portal", { pid: $portalId, ref: this.setNode });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=ForeignComponentContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForeignComponentContainer.js","sourceRoot":"","sources":["../../src/components/ForeignComponentContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAWpC,MAAM,OAAO,yBAA6B,SAAQ,KAAK,CAAC,SAA4C;IAApG;;QACU,WAAM,GAAyB,EAAE,CAAC;QAIlC,YAAO,GAAG,CAAC,IAAoB,EAAE,EAAE;YACzC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC,CAAC;IA2CJ,CAAC;IAzCC,iBAAiB;QACf,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QACzB,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxD,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;QAE7B,IAAI,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE;YAC5B,KAAK,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,kBAAkB;QAChB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QACnC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACxD,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QAE9B,IAAI,OAAO,KAAK,QAAQ,EAAE;YACxB,QAAQ,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YACxC,OAAO,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;SACrC;aAAM,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE;YACzB,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SACpD;IACH,CAAC;IAED,oBAAoB;QAClB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAClC,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;QAE/B,IAAI,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE;YAC/B,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;SAChC;QAED,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACjC,OAAO,sCAAc,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,GAAI,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { startLoadingPilets } from 'piral-base';
|
|
3
|
-
import {
|
|
3
|
+
import { useGlobalStateContext } from '../hooks';
|
|
4
|
+
import { none } from '../utils';
|
|
4
5
|
/**
|
|
5
6
|
* The Mediator component for interfacing with pilets loading.
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
export const Mediator = ({ options }) => {
|
|
9
|
+
const { initialize, readState } = useGlobalStateContext();
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
const shouldLoad = readState(s => s.app.loading);
|
|
12
|
+
if (shouldLoad) {
|
|
13
|
+
const { connect, disconnect } = startLoadingPilets(options);
|
|
14
|
+
const notifier = (error, pilets, loaded) => {
|
|
15
|
+
initialize(!loaded, error, pilets);
|
|
16
|
+
};
|
|
17
|
+
connect(notifier);
|
|
18
|
+
return () => disconnect(notifier);
|
|
19
|
+
}
|
|
20
|
+
}, none);
|
|
18
21
|
// tslint:disable-next-line:no-null-keyword
|
|
19
22
|
return null;
|
|
20
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mediator.js","sourceRoot":"","sources":["../../src/components/Mediator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAqB,kBAAkB,EAAiB,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Mediator.js","sourceRoot":"","sources":["../../src/components/Mediator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAqB,kBAAkB,EAAiB,MAAM,YAAY,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAYhC;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/D,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAE1D,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAEjD,IAAI,UAAU,EAAE;YACd,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;YAC5D,MAAM,QAAQ,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;gBACxD,UAAU,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACrC,CAAC,CAAC;YACF,OAAO,CAAC,QAAQ,CAAC,CAAC;YAClB,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SACnC;IAEH,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PortalRenderer } from './PortalRenderer';
|
|
3
|
+
import { RegisteredDebug } from './components';
|
|
4
|
+
/**
|
|
5
|
+
* Integrates the global portal renderer and the debug utilities
|
|
6
|
+
* (if registered).
|
|
7
|
+
*/
|
|
8
|
+
export const PiralGlobals = () => {
|
|
9
|
+
return (React.createElement(React.Fragment, null,
|
|
10
|
+
React.createElement(PortalRenderer, { id: "root" }),
|
|
11
|
+
React.createElement(RegisteredDebug, null)));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=PiralGlobals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiralGlobals.js","sourceRoot":"","sources":["../../src/components/PiralGlobals.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAa,GAAG,EAAE;IACzC,OAAO,CACL;QACE,oBAAC,cAAc,IAAC,EAAE,EAAC,MAAM,GAAG;QAC5B,oBAAC,eAAe,OAAG,CAClB,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RouteComponentProps, SwitchProps } from 'react-router';
|
|
3
|
+
import { RouteSwitchProps } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* The props used by the PiralRoutes component.
|
|
5
6
|
*/
|
|
@@ -8,6 +9,10 @@ export interface RoutesProps extends SwitchProps {
|
|
|
8
9
|
* Sets the component for showing the not found page.
|
|
9
10
|
*/
|
|
10
11
|
NotFound: React.ComponentType<RouteComponentProps>;
|
|
12
|
+
/**
|
|
13
|
+
* Sets the component for actually switching the routes.
|
|
14
|
+
*/
|
|
15
|
+
RouteSwitch: React.ComponentType<RouteSwitchProps>;
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* The component for defining the exclusive routes to be used.
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { useGlobalState } from '../hooks';
|
|
3
|
+
import { useRoutes } from '../hooks';
|
|
5
4
|
/**
|
|
6
5
|
* The component for defining the exclusive routes to be used.
|
|
7
6
|
*/
|
|
8
|
-
export
|
|
9
|
-
var NotFound = _a
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (React.createElement(Switch, __assign({}, props),
|
|
13
|
-
Object.keys(routes).map(function (url) { return (React.createElement(Route, { exact: true, key: url, path: url, component: routes[url] })); }),
|
|
14
|
-
Object.keys(pages).map(function (url) { return (React.createElement(Route, { exact: true, key: url, path: url, component: pages[url].component })); }),
|
|
15
|
-
React.createElement(Route, { component: NotFound })));
|
|
7
|
+
export const PiralRoutes = (_a) => {
|
|
8
|
+
var { NotFound, RouteSwitch } = _a, props = __rest(_a, ["NotFound", "RouteSwitch"]);
|
|
9
|
+
const paths = useRoutes();
|
|
10
|
+
return React.createElement(RouteSwitch, Object.assign({ NotFound: NotFound, paths: paths }, props));
|
|
16
11
|
};
|
|
17
12
|
PiralRoutes.displayName = 'Routes';
|
|
18
13
|
//# sourceMappingURL=PiralRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PiralRoutes.js","sourceRoot":"","sources":["../../src/components/PiralRoutes.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PiralRoutes.js","sourceRoot":"","sources":["../../src/components/PiralRoutes.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiBrC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAA0B,CAAC,EAAmC,EAAE,EAAE;QAAvC,EAAE,QAAQ,EAAE,WAAW,OAAY,EAAP,KAAK,cAAjC,2BAAmC,CAAF;IAClF,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,OAAO,oBAAC,WAAW,kBAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,IAAM,KAAK,EAAI,CAAC;AACtE,CAAC,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RegisteredErrorInfo, RegisteredLoadingIndicator } from './components';
|
|
3
|
+
import { useGlobalState } from '../hooks';
|
|
4
|
+
export const PiralSuspense = ({ children }) => {
|
|
5
|
+
const { error, loading } = useGlobalState((m) => m.app);
|
|
6
|
+
return error ? (React.createElement(RegisteredErrorInfo, { type: "loading", error: error })) : loading ? (React.createElement(RegisteredLoadingIndicator, null)) : (React.createElement(React.Fragment, null, children));
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=PiralSuspense.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiralSuspense.js","sourceRoot":"","sources":["../../src/components/PiralSuspense.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM1C,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC1E,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAExD,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,oBAAC,mBAAmB,IAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,GAAI,CACrD,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,oBAAC,0BAA0B,OAAG,CAC/B,CAAC,CAAC,CAAC,CACF,0CAAG,QAAQ,CAAI,CAChB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { LayoutBreakpoints } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* The props for the PiralView component.
|
|
4
5
|
*/
|
|
5
6
|
export interface PiralViewProps {
|
|
7
|
+
/**
|
|
8
|
+
* The custom breakpoints for the different layout modi.
|
|
9
|
+
*/
|
|
10
|
+
breakpoints?: LayoutBreakpoints;
|
|
11
|
+
/**
|
|
12
|
+
* The extra content.
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
6
15
|
}
|
|
7
16
|
/**
|
|
8
17
|
* The component responsible for the generic view of the application.
|
|
9
|
-
* This includes the
|
|
18
|
+
* This includes the used the current content and some convenience.
|
|
10
19
|
*/
|
|
11
20
|
export declare const PiralView: React.FC<PiralViewProps>;
|
|
@@ -1,32 +1,19 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { PiralError, PiralRouter, PiralLoadingIndicator, PiralLayout, PiralDebug } from './components';
|
|
2
|
+
import { PiralGlobals } from './PiralGlobals';
|
|
5
3
|
import { PiralRoutes } from './PiralRoutes';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return error ? (React.createElement(PiralError, { type: "loading", error: error })) : loading ? (React.createElement(PiralLoadingIndicator, null)) : (React.createElement(PiralLayout, { currentLayout: layout },
|
|
11
|
-
React.createElement(PiralRoutes, { NotFound: NotFound })));
|
|
12
|
-
};
|
|
13
|
-
var Router = typeof window === 'undefined' ? function (props) { return React.createElement(StaticRouter, __assign({ location: "/" }, props)); } : PiralRouter;
|
|
14
|
-
var PiralProvider = function (_a) {
|
|
15
|
-
var children = _a.children;
|
|
16
|
-
var provider = useGlobalState(function (m) { return m.provider; }) || React.Fragment;
|
|
17
|
-
return React.createElement(provider, undefined, children);
|
|
18
|
-
};
|
|
4
|
+
import { PiralSuspense } from './PiralSuspense';
|
|
5
|
+
import { ResponsiveLayout } from './ResponsiveLayout';
|
|
6
|
+
import { RegisteredErrorInfo, RegisteredRouteSwitch, RegisteredLayout } from './components';
|
|
7
|
+
const NotFound = (props) => React.createElement(RegisteredErrorInfo, Object.assign({ type: "not_found" }, props));
|
|
19
8
|
/**
|
|
20
9
|
* The component responsible for the generic view of the application.
|
|
21
|
-
* This includes the
|
|
10
|
+
* This includes the used the current content and some convenience.
|
|
22
11
|
*/
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
React.createElement(
|
|
27
|
-
React.createElement(
|
|
28
|
-
|
|
29
|
-
React.createElement(PiralDebug, null))));
|
|
30
|
-
};
|
|
12
|
+
export const PiralView = ({ breakpoints, children }) => (React.createElement(React.Fragment, null,
|
|
13
|
+
React.createElement(PiralGlobals, null),
|
|
14
|
+
React.createElement(PiralSuspense, null,
|
|
15
|
+
React.createElement(ResponsiveLayout, { breakpoints: breakpoints, Layout: RegisteredLayout },
|
|
16
|
+
React.createElement(PiralRoutes, { NotFound: NotFound, RouteSwitch: RegisteredRouteSwitch }))),
|
|
17
|
+
children));
|
|
31
18
|
PiralView.displayName = 'PiralView';
|
|
32
19
|
//# sourceMappingURL=PiralView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PiralView.js","sourceRoot":"","sources":["../../src/components/PiralView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PiralView.js","sourceRoot":"","sources":["../../src/components/PiralView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG5F,MAAM,QAAQ,GAAkC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,mBAAmB,kBAAC,IAAI,EAAC,WAAW,IAAK,KAAK,EAAI,CAAC;AAgB/G;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAA6B,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAChF;IACE,oBAAC,YAAY,OAAG;IAChB,oBAAC,aAAa;QACZ,oBAAC,gBAAgB,IAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB;YAClE,oBAAC,WAAW,IAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,GAAI,CACtD,CACL;IACf,QAAQ,CACR,CACJ,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useGlobalState } from '../hooks';
|
|
2
|
+
import { defaultRender, none } from '../utils';
|
|
3
|
+
export const PortalRenderer = ({ id }) => {
|
|
4
|
+
const children = useGlobalState((m) => m.portals[id]) || none;
|
|
5
|
+
return defaultRender(children);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=PortalRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalRenderer.js","sourceRoot":"","sources":["../../src/components/PortalRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAM/C,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;IACtE,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;IAC9D,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { LayoutBreakpoints } from '../types';
|
|
2
|
+
import { LayoutBreakpoints, LayoutProps } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* The props for the ResponsiveLayout component.
|
|
5
5
|
*/
|
|
@@ -8,6 +8,14 @@ export interface ResponsiveLayoutProps {
|
|
|
8
8
|
* The individual breakpoints to be used for the different layouts.
|
|
9
9
|
*/
|
|
10
10
|
breakpoints?: LayoutBreakpoints;
|
|
11
|
+
/**
|
|
12
|
+
* The actual layout component to render to transport.
|
|
13
|
+
*/
|
|
14
|
+
Layout: React.ComponentType<LayoutProps>;
|
|
15
|
+
/**
|
|
16
|
+
* The content to display.
|
|
17
|
+
*/
|
|
18
|
+
children: React.ReactNode;
|
|
11
19
|
}
|
|
12
20
|
/**
|
|
13
21
|
* The component capable of identifying and switching the currently used layout.
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useMedia
|
|
3
|
-
import { defaultLayouts,
|
|
2
|
+
import { useMedia } from '../hooks';
|
|
3
|
+
import { defaultLayouts, defaultBreakpoints } from '../utils';
|
|
4
4
|
/**
|
|
5
5
|
* The component capable of identifying and switching the currently used layout.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var changeTo = useAction('changeLayout');
|
|
11
|
-
var selected = useMedia(breakpoints, defaultLayouts, current);
|
|
12
|
-
React.useEffect(function () {
|
|
13
|
-
if (selected !== current) {
|
|
14
|
-
changeTo(selected);
|
|
15
|
-
}
|
|
16
|
-
}, [selected]);
|
|
17
|
-
return defaultRender(children);
|
|
7
|
+
export const ResponsiveLayout = ({ breakpoints = defaultBreakpoints, Layout, children, }) => {
|
|
8
|
+
const selected = useMedia(breakpoints, defaultLayouts, 'desktop');
|
|
9
|
+
return React.createElement(Layout, { currentLayout: selected }, children);
|
|
18
10
|
};
|
|
19
11
|
ResponsiveLayout.displayName = 'ResponsiveLayout';
|
|
20
12
|
//# sourceMappingURL=ResponsiveLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveLayout.js","sourceRoot":"","sources":["../../src/components/ResponsiveLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"ResponsiveLayout.js","sourceRoot":"","sources":["../../src/components/ResponsiveLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAqB9D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAChE,WAAW,GAAG,kBAAkB,EAChC,MAAM,EACN,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAClE,OAAO,oBAAC,MAAM,IAAC,aAAa,EAAE,QAAQ,IAAG,QAAQ,CAAU,CAAC;AAC9D,CAAC,CAAC;AACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useGlobalState } from '../hooks';
|
|
4
|
-
import { defaultRender } from '../utils';
|
|
3
|
+
import { defaultRender, none } from '../utils';
|
|
5
4
|
function renderComponent(components, props) {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const name = props.type;
|
|
6
|
+
const Component = components[name];
|
|
7
|
+
if (process.env.NODE_ENV === 'development') {
|
|
8
|
+
React.useEffect(() => console.error('[dev-info] An error occurred in the Piral instance.', props), none);
|
|
9
|
+
}
|
|
8
10
|
if (!Component) {
|
|
9
|
-
|
|
11
|
+
const Unknown = components.unknown;
|
|
10
12
|
if (Unknown) {
|
|
11
|
-
return React.createElement(Unknown,
|
|
13
|
+
return React.createElement(Unknown, Object.assign({}, props, { type: "unknown" }));
|
|
12
14
|
}
|
|
13
|
-
return defaultRender(
|
|
15
|
+
return defaultRender(`Error: ${props.type}`);
|
|
14
16
|
}
|
|
15
|
-
return React.createElement(Component,
|
|
17
|
+
return React.createElement(Component, Object.assign({}, props));
|
|
16
18
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
+
export const SwitchErrorInfo = (props) => {
|
|
20
|
+
const components = useGlobalState((m) => m.errorComponents);
|
|
19
21
|
return renderComponent(components, props);
|
|
20
22
|
};
|
|
21
23
|
//# sourceMappingURL=SwitchErrorInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchErrorInfo.js","sourceRoot":"","sources":["../../src/components/SwitchErrorInfo.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwitchErrorInfo.js","sourceRoot":"","sources":["../../src/components/SwitchErrorInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAG/C,SAAS,eAAe,CACtB,UAAgC,EAChC,KAAmB;IAEnB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAEnC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;QAC1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,qDAAqD,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;KAC1G;IAED,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAEnC,IAAI,OAAO,EAAE;YACX,OAAO,oBAAC,OAAO,oBAAM,KAAa,IAAE,IAAI,EAAC,SAAS,IAAG,CAAC;SACvD;QAED,OAAO,aAAa,CAAC,UAAU,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;KAC9C;IAED,OAAO,oBAAC,SAAS,oBAAM,KAAa,EAAI,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAA6B,CAAC,KAAK,EAAE,EAAE;IACjE,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IAC5D,OAAO,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentsState
|
|
2
|
+
import { ComponentsState } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a registered layout component by its name.
|
|
5
|
+
* This will always return a valid component. If nothing is found
|
|
6
|
+
* then the returned component will just return null.
|
|
7
|
+
* @param name The name of the registered layout component.
|
|
8
|
+
* @returns The registered layout component or an empty stub component.
|
|
9
|
+
*/
|
|
3
10
|
export declare function getPiralComponent<TKey extends keyof ComponentsState>(name: TKey): ComponentsState[TKey];
|
|
4
11
|
/**
|
|
5
12
|
* Gets the currently registered ErrorInfo component.
|
|
6
13
|
* By default the DefaultErrorInfo component is used.
|
|
7
14
|
*/
|
|
8
|
-
export declare const
|
|
15
|
+
export declare const RegisteredErrorInfo: React.ComponentType<import("../types").ErrorInfoProps>;
|
|
9
16
|
/**
|
|
10
17
|
* Gets the currently registered LoadingIndicator component.
|
|
11
18
|
* By default only Loading is rendered.
|
|
12
19
|
*/
|
|
13
|
-
export declare const
|
|
20
|
+
export declare const RegisteredLoadingIndicator: React.ComponentType<import("../types").LoadingIndicatorProps>;
|
|
14
21
|
/**
|
|
15
22
|
* Gets the currently registered Router component.
|
|
16
23
|
* By default the BrowserRouter is used.
|
|
17
24
|
*/
|
|
18
|
-
export declare const
|
|
25
|
+
export declare const RegisteredRouter: React.ComponentType<import("../types").RouterProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the currently registered Route Switch component.
|
|
28
|
+
* By default the DefaultRouteSwitch component is used.
|
|
29
|
+
*/
|
|
30
|
+
export declare const RegisteredRouteSwitch: React.ComponentType<import("../types").RouteSwitchProps>;
|
|
19
31
|
/**
|
|
20
32
|
* Gets the currently registered Layout component.
|
|
21
33
|
* By default the children are rendered.
|
|
22
34
|
*/
|
|
23
|
-
export declare const
|
|
35
|
+
export declare const RegisteredLayout: React.ComponentType<import("../types").LayoutProps>;
|
|
24
36
|
/**
|
|
25
37
|
* Gets the currently registered Debug component.
|
|
26
38
|
* By default nothing is used.
|
|
27
39
|
*/
|
|
28
|
-
export declare const
|
|
40
|
+
export declare const RegisteredDebug: React.ComponentType;
|
|
@@ -1,35 +1,47 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useGlobalState } from '../hooks';
|
|
3
|
+
/**
|
|
4
|
+
* Gets a registered layout component by its name.
|
|
5
|
+
* This will always return a valid component. If nothing is found
|
|
6
|
+
* then the returned component will just return null.
|
|
7
|
+
* @param name The name of the registered layout component.
|
|
8
|
+
* @returns The registered layout component or an empty stub component.
|
|
9
|
+
*/
|
|
4
10
|
export function getPiralComponent(name) {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
return (props) => {
|
|
12
|
+
const Component = useGlobalState((s) => s.components[name]);
|
|
13
|
+
// tslint:disable-next-line:no-null-keyword
|
|
14
|
+
return Component ? React.createElement(Component, Object.assign({}, props)) : null;
|
|
8
15
|
};
|
|
9
16
|
}
|
|
10
17
|
/**
|
|
11
18
|
* Gets the currently registered ErrorInfo component.
|
|
12
19
|
* By default the DefaultErrorInfo component is used.
|
|
13
20
|
*/
|
|
14
|
-
export
|
|
21
|
+
export const RegisteredErrorInfo = getPiralComponent('ErrorInfo');
|
|
15
22
|
/**
|
|
16
23
|
* Gets the currently registered LoadingIndicator component.
|
|
17
24
|
* By default only Loading is rendered.
|
|
18
25
|
*/
|
|
19
|
-
export
|
|
26
|
+
export const RegisteredLoadingIndicator = getPiralComponent('LoadingIndicator');
|
|
20
27
|
/**
|
|
21
28
|
* Gets the currently registered Router component.
|
|
22
29
|
* By default the BrowserRouter is used.
|
|
23
30
|
*/
|
|
24
|
-
export
|
|
31
|
+
export const RegisteredRouter = getPiralComponent('Router');
|
|
32
|
+
/**
|
|
33
|
+
* Gets the currently registered Route Switch component.
|
|
34
|
+
* By default the DefaultRouteSwitch component is used.
|
|
35
|
+
*/
|
|
36
|
+
export const RegisteredRouteSwitch = getPiralComponent('RouteSwitch');
|
|
25
37
|
/**
|
|
26
38
|
* Gets the currently registered Layout component.
|
|
27
39
|
* By default the children are rendered.
|
|
28
40
|
*/
|
|
29
|
-
export
|
|
41
|
+
export const RegisteredLayout = getPiralComponent('Layout');
|
|
30
42
|
/**
|
|
31
43
|
* Gets the currently registered Debug component.
|
|
32
44
|
* By default nothing is used.
|
|
33
45
|
*/
|
|
34
|
-
export
|
|
46
|
+
export const RegisteredDebug = getPiralComponent('Debug');
|
|
35
47
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAqC,IAAU;IAC9E,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,2CAA2C;QAC3C,OAAO,SAAS,CAAC,CAAC,CAAC,oBAAC,SAAS,oBAAK,KAAK,EAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC"}
|