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,35 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PiralView = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var PiralContent = function () {
|
|
12
|
-
var _a = hooks_1.useGlobalState(function (m) { return m.app; }), error = _a.error, loading = _a.loading, layout = _a.layout;
|
|
13
|
-
return error ? (React.createElement(components_1.PiralError, { type: "loading", error: error })) : loading ? (React.createElement(components_1.PiralLoadingIndicator, null)) : (React.createElement(components_1.PiralLayout, { currentLayout: layout },
|
|
14
|
-
React.createElement(PiralRoutes_1.PiralRoutes, { NotFound: NotFound })));
|
|
15
|
-
};
|
|
16
|
-
var Router = typeof window === 'undefined' ? function (props) { return React.createElement(react_router_1.StaticRouter, tslib_1.__assign({ location: "/" }, props)); } : components_1.PiralRouter;
|
|
17
|
-
var PiralProvider = function (_a) {
|
|
18
|
-
var children = _a.children;
|
|
19
|
-
var provider = hooks_1.useGlobalState(function (m) { return m.provider; }) || React.Fragment;
|
|
20
|
-
return React.createElement(provider, undefined, children);
|
|
21
|
-
};
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const PiralGlobals_1 = require("./PiralGlobals");
|
|
6
|
+
const PiralRoutes_1 = require("./PiralRoutes");
|
|
7
|
+
const PiralSuspense_1 = require("./PiralSuspense");
|
|
8
|
+
const ResponsiveLayout_1 = require("./ResponsiveLayout");
|
|
9
|
+
const components_1 = require("./components");
|
|
10
|
+
const NotFound = (props) => React.createElement(components_1.RegisteredErrorInfo, Object.assign({ type: "not_found" }, props));
|
|
22
11
|
/**
|
|
23
12
|
* The component responsible for the generic view of the application.
|
|
24
|
-
* This includes the
|
|
13
|
+
* This includes the used the current content and some convenience.
|
|
25
14
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
React.createElement(
|
|
30
|
-
React.createElement(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
15
|
+
const PiralView = ({ breakpoints, children }) => (React.createElement(React.Fragment, null,
|
|
16
|
+
React.createElement(PiralGlobals_1.PiralGlobals, null),
|
|
17
|
+
React.createElement(PiralSuspense_1.PiralSuspense, null,
|
|
18
|
+
React.createElement(ResponsiveLayout_1.ResponsiveLayout, { breakpoints: breakpoints, Layout: components_1.RegisteredLayout },
|
|
19
|
+
React.createElement(PiralRoutes_1.PiralRoutes, { NotFound: NotFound, RouteSwitch: components_1.RegisteredRouteSwitch }))),
|
|
20
|
+
children));
|
|
21
|
+
exports.PiralView = PiralView;
|
|
34
22
|
exports.PiralView.displayName = 'PiralView';
|
|
35
23
|
//# 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,+BAA+B;AAE/B,iDAA8C;AAC9C,+CAA4C;AAC5C,mDAAgD;AAChD,yDAAsD;AACtD,6CAA4F;AAG5F,MAAM,QAAQ,GAAkC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAC,gCAAmB,kBAAC,IAAI,EAAC,WAAW,IAAK,KAAK,EAAI,CAAC;AAgB/G;;;GAGG;AACI,MAAM,SAAS,GAA6B,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAChF;IACE,oBAAC,2BAAY,OAAG;IAChB,oBAAC,6BAAa;QACZ,oBAAC,mCAAgB,IAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,6BAAgB;YAClE,oBAAC,yBAAW,IAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAqB,GAAI,CACtD,CACL;IACf,QAAQ,CACR,CACJ,CAAC;AAVW,QAAA,SAAS,aAUpB;AACF,iBAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PortalRenderer = void 0;
|
|
4
|
+
const hooks_1 = require("../hooks");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const PortalRenderer = ({ id }) => {
|
|
7
|
+
const children = (0, hooks_1.useGlobalState)((m) => m.portals[id]) || utils_1.none;
|
|
8
|
+
return (0, utils_1.defaultRender)(children);
|
|
9
|
+
};
|
|
10
|
+
exports.PortalRenderer = PortalRenderer;
|
|
11
|
+
//# sourceMappingURL=PortalRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortalRenderer.js","sourceRoot":"","sources":["../../src/components/PortalRenderer.tsx"],"names":[],"mappings":";;;AACA,oCAA0C;AAC1C,oCAA+C;AAMxC,MAAM,cAAc,GAAkC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;IACtE,MAAM,QAAQ,GAAG,IAAA,sBAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,YAAI,CAAC;IAC9D,OAAO,IAAA,qBAAa,EAAC,QAAQ,CAAC,CAAC;AACjC,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB"}
|
|
@@ -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,23 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ResponsiveLayout = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const hooks_1 = require("../hooks");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
7
|
/**
|
|
8
8
|
* The component capable of identifying and switching the currently used layout.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var changeTo = hooks_1.useAction('changeLayout');
|
|
14
|
-
var selected = hooks_1.useMedia(breakpoints, utils_1.defaultLayouts, current);
|
|
15
|
-
React.useEffect(function () {
|
|
16
|
-
if (selected !== current) {
|
|
17
|
-
changeTo(selected);
|
|
18
|
-
}
|
|
19
|
-
}, [selected]);
|
|
20
|
-
return utils_1.defaultRender(children);
|
|
10
|
+
const ResponsiveLayout = ({ breakpoints = utils_1.defaultBreakpoints, Layout, children, }) => {
|
|
11
|
+
const selected = (0, hooks_1.useMedia)(breakpoints, utils_1.defaultLayouts, 'desktop');
|
|
12
|
+
return React.createElement(Layout, { currentLayout: selected }, children);
|
|
21
13
|
};
|
|
14
|
+
exports.ResponsiveLayout = ResponsiveLayout;
|
|
22
15
|
exports.ResponsiveLayout.displayName = 'ResponsiveLayout';
|
|
23
16
|
//# sourceMappingURL=ResponsiveLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveLayout.js","sourceRoot":"","sources":["../../src/components/ResponsiveLayout.tsx"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"ResponsiveLayout.js","sourceRoot":"","sources":["../../src/components/ResponsiveLayout.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,oCAAoC;AACpC,oCAA8D;AAqB9D;;GAEG;AACI,MAAM,gBAAgB,GAAoC,CAAC,EAChE,WAAW,GAAG,0BAAkB,EAChC,MAAM,EACN,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,IAAA,gBAAQ,EAAC,WAAW,EAAE,sBAAc,EAAE,SAAS,CAAC,CAAC;IAClE,OAAO,oBAAC,MAAM,IAAC,aAAa,EAAE,QAAQ,IAAG,QAAQ,CAAU,CAAC;AAC9D,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AACF,wBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SwitchErrorInfo = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var utils_1 = require("../utils");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const hooks_1 = require("../hooks");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
8
7
|
function renderComponent(components, props) {
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const name = props.type;
|
|
9
|
+
const Component = components[name];
|
|
10
|
+
if (process.env.NODE_ENV === 'development') {
|
|
11
|
+
React.useEffect(() => console.error('[dev-info] An error occurred in the Piral instance.', props), utils_1.none);
|
|
12
|
+
}
|
|
11
13
|
if (!Component) {
|
|
12
|
-
|
|
14
|
+
const Unknown = components.unknown;
|
|
13
15
|
if (Unknown) {
|
|
14
|
-
return React.createElement(Unknown,
|
|
16
|
+
return React.createElement(Unknown, Object.assign({}, props, { type: "unknown" }));
|
|
15
17
|
}
|
|
16
|
-
return utils_1.defaultRender(
|
|
18
|
+
return (0, utils_1.defaultRender)(`Error: ${props.type}`);
|
|
17
19
|
}
|
|
18
|
-
return React.createElement(Component,
|
|
20
|
+
return React.createElement(Component, Object.assign({}, props));
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
const SwitchErrorInfo = (props) => {
|
|
23
|
+
const components = (0, hooks_1.useGlobalState)((m) => m.errorComponents);
|
|
22
24
|
return renderComponent(components, props);
|
|
23
25
|
};
|
|
26
|
+
exports.SwitchErrorInfo = SwitchErrorInfo;
|
|
24
27
|
//# 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,+BAA+B;AAC/B,oCAA0C;AAC1C,oCAA+C;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,YAAI,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,IAAA,qBAAa,EAAC,UAAU,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;KAC9C;IAED,OAAO,oBAAC,SAAS,oBAAM,KAAa,EAAI,CAAC;AAC3C,CAAC;AAEM,MAAM,eAAe,GAA6B,CAAC,KAAK,EAAE,EAAE;IACjE,MAAM,UAAU,GAAG,IAAA,sBAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IAC5D,OAAO,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B"}
|
|
@@ -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,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
exports.RegisteredDebug = exports.RegisteredLayout = exports.RegisteredRouteSwitch = exports.RegisteredRouter = exports.RegisteredLoadingIndicator = exports.RegisteredErrorInfo = exports.getPiralComponent = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const hooks_1 = require("../hooks");
|
|
6
|
+
/**
|
|
7
|
+
* Gets a registered layout component by its name.
|
|
8
|
+
* This will always return a valid component. If nothing is found
|
|
9
|
+
* then the returned component will just return null.
|
|
10
|
+
* @param name The name of the registered layout component.
|
|
11
|
+
* @returns The registered layout component or an empty stub component.
|
|
12
|
+
*/
|
|
7
13
|
function getPiralComponent(name) {
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
return (props) => {
|
|
15
|
+
const Component = (0, hooks_1.useGlobalState)((s) => s.components[name]);
|
|
16
|
+
// tslint:disable-next-line:no-null-keyword
|
|
17
|
+
return Component ? React.createElement(Component, Object.assign({}, props)) : null;
|
|
11
18
|
};
|
|
12
19
|
}
|
|
13
20
|
exports.getPiralComponent = getPiralComponent;
|
|
@@ -15,25 +22,30 @@ exports.getPiralComponent = getPiralComponent;
|
|
|
15
22
|
* Gets the currently registered ErrorInfo component.
|
|
16
23
|
* By default the DefaultErrorInfo component is used.
|
|
17
24
|
*/
|
|
18
|
-
exports.
|
|
25
|
+
exports.RegisteredErrorInfo = getPiralComponent('ErrorInfo');
|
|
19
26
|
/**
|
|
20
27
|
* Gets the currently registered LoadingIndicator component.
|
|
21
28
|
* By default only Loading is rendered.
|
|
22
29
|
*/
|
|
23
|
-
exports.
|
|
30
|
+
exports.RegisteredLoadingIndicator = getPiralComponent('LoadingIndicator');
|
|
24
31
|
/**
|
|
25
32
|
* Gets the currently registered Router component.
|
|
26
33
|
* By default the BrowserRouter is used.
|
|
27
34
|
*/
|
|
28
|
-
exports.
|
|
35
|
+
exports.RegisteredRouter = getPiralComponent('Router');
|
|
36
|
+
/**
|
|
37
|
+
* Gets the currently registered Route Switch component.
|
|
38
|
+
* By default the DefaultRouteSwitch component is used.
|
|
39
|
+
*/
|
|
40
|
+
exports.RegisteredRouteSwitch = getPiralComponent('RouteSwitch');
|
|
29
41
|
/**
|
|
30
42
|
* Gets the currently registered Layout component.
|
|
31
43
|
* By default the children are rendered.
|
|
32
44
|
*/
|
|
33
|
-
exports.
|
|
45
|
+
exports.RegisteredLayout = getPiralComponent('Layout');
|
|
34
46
|
/**
|
|
35
47
|
* Gets the currently registered Debug component.
|
|
36
48
|
* By default nothing is used.
|
|
37
49
|
*/
|
|
38
|
-
exports.
|
|
50
|
+
exports.RegisteredDebug = getPiralComponent('Debug');
|
|
39
51
|
//# 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,+BAA+B;AAC/B,oCAA0C;AAG1C;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAqC,IAAU;IAC9E,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,MAAM,SAAS,GAAG,IAAA,sBAAc,EAAC,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;AAND,8CAMC;AAED;;;GAGG;AACU,QAAA,mBAAmB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAElE;;;GAGG;AACU,QAAA,0BAA0B,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAEhF;;;GAGG;AACU,QAAA,gBAAgB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAE5D;;;GAGG;AACU,QAAA,qBAAqB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEtE;;;GAGG;AACU,QAAA,gBAAgB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAE5D;;;GAGG;AACU,QAAA,eAAe,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export * from './DefaultErrorInfo';
|
|
3
|
-
export * from './DefaultLayout';
|
|
4
|
-
export * from './DefaultLoader';
|
|
5
2
|
export * from './ErrorBoundary';
|
|
6
3
|
export * from './ExtensionSlot';
|
|
7
4
|
export * from './Mediator';
|
|
5
|
+
export * from './PiralGlobals';
|
|
8
6
|
export * from './PiralRoutes';
|
|
7
|
+
export * from './PiralSuspense';
|
|
9
8
|
export * from './PiralView';
|
|
9
|
+
export * from './PortalRenderer';
|
|
10
10
|
export * from './ResponsiveLayout';
|
|
11
|
-
export * from './SetComponent';
|
|
12
|
-
export * from './SetError';
|
|
13
|
-
export * from './SetErrors';
|
|
14
|
-
export * from './SetLayout';
|
|
15
|
-
export * from './SetProvider';
|
|
16
|
-
export * from './SetRedirect';
|
|
17
|
-
export * from './SetRoute';
|
|
18
11
|
export * from './SwitchErrorInfo';
|
|
12
|
+
export * from './wrapComponent';
|
package/lib/components/index.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
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("./components"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./DefaultErrorInfo"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./DefaultLayout"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./DefaultLoader"), exports);
|
|
8
5
|
tslib_1.__exportStar(require("./ErrorBoundary"), exports);
|
|
9
6
|
tslib_1.__exportStar(require("./ExtensionSlot"), exports);
|
|
10
7
|
tslib_1.__exportStar(require("./Mediator"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./PiralGlobals"), exports);
|
|
11
9
|
tslib_1.__exportStar(require("./PiralRoutes"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./PiralSuspense"), exports);
|
|
12
11
|
tslib_1.__exportStar(require("./PiralView"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./PortalRenderer"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./ResponsiveLayout"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./SetComponent"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./SetError"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./SetErrors"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./SetLayout"), exports);
|
|
18
|
-
tslib_1.__exportStar(require("./SetProvider"), exports);
|
|
19
|
-
tslib_1.__exportStar(require("./SetRedirect"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./SetRoute"), exports);
|
|
21
14
|
tslib_1.__exportStar(require("./SwitchErrorInfo"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./wrapComponent"), exports);
|
|
22
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,0DAAgC;AAChC,0DAAgC;AAChC,qDAA2B;AAC3B,yDAA+B;AAC/B,wDAA8B;AAC9B,0DAAgC;AAChC,sDAA4B;AAC5B,2DAAiC;AACjC,6DAAmC;AACnC,4DAAkC;AAClC,0DAAgC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AnyComponent, ComponentConverters, PiletApi, BaseComponentProps } from '../types';
|
|
3
|
+
interface CapturedProps {
|
|
4
|
+
piral: PiletApi;
|
|
5
|
+
}
|
|
6
|
+
export declare function wrapComponent<T>(converters: ComponentConverters<T & BaseComponentProps>, component: AnyComponent<T & BaseComponentProps>, captured: CapturedProps, Wrapper: React.FC<T>): React.MemoExoticComponent<(props: T) => JSX.Element> | React.ComponentType<T>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapComponent = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const PortalRenderer_1 = require("./PortalRenderer");
|
|
6
|
+
const ForeignComponentContainer_1 = require("./ForeignComponentContainer");
|
|
7
|
+
const hooks_1 = require("../hooks");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const app_codegen_1 = require("../../app.codegen");
|
|
10
|
+
// this is an arbitrary start number to have 6 digits
|
|
11
|
+
let portalIdBase = 123456;
|
|
12
|
+
function wrapReactComponent(Component, captured, Wrapper) {
|
|
13
|
+
return (props) => (React.createElement(Wrapper, Object.assign({}, props),
|
|
14
|
+
React.createElement(Component, Object.assign({}, props, captured))));
|
|
15
|
+
}
|
|
16
|
+
function wrapForeignComponent(component, captured, Wrapper) {
|
|
17
|
+
return React.memo((props) => {
|
|
18
|
+
const { destroyPortal, navigation } = (0, hooks_1.useGlobalStateContext)();
|
|
19
|
+
const id = React.useMemo(() => (portalIdBase++).toString(26), utils_1.none);
|
|
20
|
+
// router added for backwards compatibility
|
|
21
|
+
const context = React.useMemo(() => ({ publicPath: app_codegen_1.publicPath, navigation, router: navigation.router }), []);
|
|
22
|
+
const innerProps = React.useMemo(() => (Object.assign(Object.assign({}, props), captured)), [props]);
|
|
23
|
+
React.useEffect(() => () => destroyPortal(id), utils_1.none);
|
|
24
|
+
return (React.createElement(Wrapper, Object.assign({}, props),
|
|
25
|
+
React.createElement(PortalRenderer_1.PortalRenderer, { id: id }),
|
|
26
|
+
React.createElement(ForeignComponentContainer_1.ForeignComponentContainer, { innerProps: innerProps, "$portalId": id, "$component": component, "$context": context })));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function isNotExotic(component) {
|
|
30
|
+
return !component.$$typeof;
|
|
31
|
+
}
|
|
32
|
+
function wrapComponent(converters, component, captured, Wrapper) {
|
|
33
|
+
if (!component) {
|
|
34
|
+
const pilet = captured.piral.meta.name;
|
|
35
|
+
console.error(`[${pilet}] The given value is not a valid component.`);
|
|
36
|
+
// tslint:disable-next-line:no-null-keyword
|
|
37
|
+
component = () => null;
|
|
38
|
+
}
|
|
39
|
+
if (typeof component === 'object' && isNotExotic(component)) {
|
|
40
|
+
const result = (0, utils_1.convertComponent)(converters[component.type], component);
|
|
41
|
+
return wrapForeignComponent(result, captured, Wrapper);
|
|
42
|
+
}
|
|
43
|
+
return wrapReactComponent(component, captured, Wrapper);
|
|
44
|
+
}
|
|
45
|
+
exports.wrapComponent = wrapComponent;
|
|
46
|
+
//# sourceMappingURL=wrapComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapComponent.js","sourceRoot":"","sources":["../../src/components/wrapComponent.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,qDAAkD;AAClD,2EAAwE;AACxE,oCAAiD;AACjD,oCAAkD;AAClD,mDAA+C;AAG/C,qDAAqD;AACrD,IAAI,YAAY,GAAG,MAAM,CAAC;AAM1B,SAAS,kBAAkB,CACzB,SAAsD,EACtD,QAAuB,EACvB,OAAoB;IAEpB,OAAO,CAAC,KAAQ,EAAE,EAAE,CAAC,CACnB,oBAAC,OAAO,oBAAK,KAAK;QAChB,oBAAC,SAAS,oBAAK,KAAK,EAAM,QAAQ,EAAI,CAC9B,CACX,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,SAAmD,EACnD,QAAuB,EACvB,OAAoB;IAEpB,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,KAAQ,EAAE,EAAE;QAC7B,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,IAAA,6BAAqB,GAAE,CAAC;QAC9D,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,YAAI,CAAC,CAAC;QACpE,2CAA2C;QAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAV,wBAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACjG,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,iCAAM,KAAK,GAAK,QAAQ,EAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAE7E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,YAAI,CAAC,CAAC;QAErD,OAAO,CACL,oBAAC,OAAO,oBAAK,KAAK;YAChB,oBAAC,+BAAc,IAAC,EAAE,EAAE,EAAE,GAAI;YAC1B,oBAAC,qDAAyB,IAAC,UAAU,EAAE,UAAU,eAAa,EAAE,gBAAc,SAAS,cAAY,OAAO,GAAI,CACtG,CACX,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,SAAc;IACjC,OAAO,CAAE,SAAmC,CAAC,QAAQ,CAAC;AACxD,CAAC;AAED,SAAgB,aAAa,CAC3B,UAAuD,EACvD,SAA+C,EAC/C,QAAuB,EACvB,OAAoB;IAEpB,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QACvC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,6CAA6C,CAAC,CAAC;QACtE,2CAA2C;QAC3C,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;KACxB;IAED,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE;QAC3D,MAAM,MAAM,GAAG,IAAA,wBAAgB,EAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,oBAAoB,CAAI,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;KAC3D;IAED,OAAO,kBAAkB,CAAI,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC;AAnBD,sCAmBC"}
|
package/lib/createInstance.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PiralInstanceOptions, PiralInstance } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a new PiralInstance component, which can be used for
|
|
4
4
|
* bootstrapping the application easily.
|
|
@@ -19,4 +19,4 @@ const app = (
|
|
|
19
19
|
render(app, document.querySelector('#app'));
|
|
20
20
|
```
|
|
21
21
|
*/
|
|
22
|
-
export declare function createInstance(config?:
|
|
22
|
+
export declare function createInstance(config?: PiralInstanceOptions): PiralInstance;
|
package/lib/createInstance.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createInstance = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const piral_base_1 = require("piral-base");
|
|
6
|
+
const modules_1 = require("./modules");
|
|
7
|
+
const state_1 = require("./state");
|
|
8
|
+
const helpers_1 = require("./helpers");
|
|
9
|
+
const utils_1 = require("./utils");
|
|
10
10
|
/**
|
|
11
11
|
* Creates a new PiralInstance component, which can be used for
|
|
12
12
|
* bootstrapping the application easily.
|
|
@@ -27,41 +27,45 @@ const app = (
|
|
|
27
27
|
render(app, document.querySelector('#app'));
|
|
28
28
|
```
|
|
29
29
|
*/
|
|
30
|
-
function createInstance(config) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
function createInstance(config = {}) {
|
|
31
|
+
const { id = (0, utils_1.generateId)(), state, actions, availablePilets = [], plugins, requestPilets = modules_1.defaultModuleRequester, loaderConfig, async = false, shareDependencies = modules_1.defaultDependencySelector, loadPilet, loaders, debug, apiFactory = modules_1.defaultApiFactory, } = config;
|
|
32
|
+
const globalState = (0, state_1.createGlobalState)(state);
|
|
33
|
+
const events = (0, piral_base_1.createListener)(globalState);
|
|
34
|
+
const context = (0, state_1.createActions)(globalState, events);
|
|
35
|
+
const definedPlugins = plugins || [];
|
|
36
|
+
const usedPlugins = Array.isArray(definedPlugins) ? definedPlugins : [definedPlugins];
|
|
37
|
+
const createApi = apiFactory(context, usedPlugins);
|
|
38
|
+
const root = createApi({
|
|
39
|
+
name: '_',
|
|
40
|
+
version: '0',
|
|
41
|
+
spec: 'v0',
|
|
42
|
+
basePath: '',
|
|
43
|
+
link: '',
|
|
44
|
+
config: {},
|
|
45
|
+
dependencies: {},
|
|
43
46
|
});
|
|
44
|
-
|
|
45
|
-
context
|
|
46
|
-
createApi
|
|
47
|
-
loaders
|
|
48
|
-
loadPilet
|
|
49
|
-
availablePilets
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
const options = (0, helpers_1.createPiletOptions)({
|
|
48
|
+
context,
|
|
49
|
+
createApi,
|
|
50
|
+
loaders,
|
|
51
|
+
loadPilet,
|
|
52
|
+
availablePilets,
|
|
53
|
+
loaderConfig,
|
|
54
|
+
shareDependencies,
|
|
55
|
+
strategy: (0, piral_base_1.isfunc)(async) ? async : async ? piral_base_1.blazingStrategy : piral_base_1.standardStrategy,
|
|
56
|
+
requestPilets,
|
|
57
|
+
debug,
|
|
55
58
|
});
|
|
56
59
|
if (actions) {
|
|
57
|
-
state_1.includeActions(context, actions);
|
|
60
|
+
(0, state_1.includeActions)(context, actions);
|
|
58
61
|
}
|
|
59
62
|
context.options = options;
|
|
60
|
-
return tslib_1.__assign(events, {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
return (0, tslib_1.__assign)(events, {
|
|
64
|
+
id,
|
|
65
|
+
createApi,
|
|
66
|
+
context,
|
|
67
|
+
root,
|
|
68
|
+
options,
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
71
|
exports.createInstance = createInstance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInstance.js","sourceRoot":"","sources":["../src/createInstance.tsx"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"createInstance.js","sourceRoot":"","sources":["../src/createInstance.tsx"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,2CAAuF;AACvF,uCAAiG;AACjG,mCAA2E;AAC3E,uCAA+C;AAC/C,mCAAqC;AAGrC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,cAAc,CAAC,SAA+B,EAAE;IAC9D,MAAM,EACJ,EAAE,GAAG,IAAA,kBAAU,GAAE,EACjB,KAAK,EACL,OAAO,EACP,eAAe,GAAG,EAAE,EACpB,OAAO,EACP,aAAa,GAAG,gCAAsB,EACtC,YAAY,EACZ,KAAK,GAAG,KAAK,EACb,iBAAiB,GAAG,mCAAyB,EAC7C,SAAS,EACT,OAAO,EACP,KAAK,EACL,UAAU,GAAG,2BAAiB,GAC/B,GAAG,MAAM,CAAC;IACX,MAAM,WAAW,GAAG,IAAA,yBAAiB,EAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAA,2BAAc,EAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IACtF,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,SAAS,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;KACjB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,IAAA,4BAAkB,EAAC;QACjC,OAAO;QACP,SAAS;QACT,OAAO;QACP,SAAS;QACT,eAAe;QACf,YAAY;QACZ,iBAAiB;QACjB,QAAQ,EAAE,IAAA,mBAAM,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,4BAAe,CAAC,CAAC,CAAC,6BAAgB;QAC5E,aAAa;QACb,KAAK;KACN,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE;QACX,IAAA,sBAAc,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KAClC;IAED,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IAE1B,OAAO,IAAA,gBAAQ,EAAC,MAAM,EAAE;QACtB,EAAE;QACF,SAAS;QACT,OAAO;QACP,IAAI;QACJ,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAzDD,wCAyDC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultErrorInfo = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const components_1 = require("../components");
|
|
6
|
+
/**
|
|
7
|
+
* The default error info component. Just uses the "error" extension slot.
|
|
8
|
+
* Leverage the default one by registration of respective extensions using
|
|
9
|
+
* the "error" name.
|
|
10
|
+
*/
|
|
11
|
+
const DefaultErrorInfo = (props) => (React.createElement(components_1.ExtensionSlot, { name: "error", params: props, empty: () => React.createElement(components_1.SwitchErrorInfo, Object.assign({}, props)) }));
|
|
12
|
+
exports.DefaultErrorInfo = DefaultErrorInfo;
|
|
13
|
+
exports.DefaultErrorInfo.displayName = 'DefaultErrorInfo';
|
|
14
|
+
//# sourceMappingURL=DefaultErrorInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultErrorInfo.js","sourceRoot":"","sources":["../../src/defaults/DefaultErrorInfo.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,8CAA+D;AAG/D;;;;GAIG;AACI,MAAM,gBAAgB,GAA6B,CAAC,KAAK,EAAE,EAAE,CAAC,CACnE,oBAAC,0BAAa,IAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,oBAAC,4BAAe,oBAAK,KAAK,EAAI,GAAI,CAC3F,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AACF,wBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultLayout = void 0;
|
|
4
|
-
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
5
|
/**
|
|
6
6
|
* The default layout only rendering the provided children.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return utils_1.defaultRender(children);
|
|
11
|
-
};
|
|
8
|
+
const DefaultLayout = ({ children }) => (0, utils_1.defaultRender)(children);
|
|
9
|
+
exports.DefaultLayout = DefaultLayout;
|
|
12
10
|
exports.DefaultLayout.displayName = 'DefaultLayout';
|
|
13
11
|
//# sourceMappingURL=DefaultLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../src/defaults/DefaultLayout.tsx"],"names":[],"mappings":";;;AACA,oCAAyC;AAGzC;;GAEG;AACI,MAAM,aAAa,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,QAAQ,CAAC,CAAC;AAAjF,QAAA,aAAa,iBAAoE;AAC9F,qBAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|