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,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DefaultLoadingIndicator = void 0;
|
|
4
|
-
|
|
4
|
+
const React = require("react");
|
|
5
5
|
/**
|
|
6
6
|
* The default loading indicator only displaying "Loading".
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
const DefaultLoadingIndicator = () => React.createElement("div", null, "Loading");
|
|
9
|
+
exports.DefaultLoadingIndicator = DefaultLoadingIndicator;
|
|
9
10
|
exports.DefaultLoadingIndicator.displayName = 'DefaultLoadingIndicator';
|
|
10
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=DefaultLoadingIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultLoadingIndicator.js","sourceRoot":"","sources":["../../src/defaults/DefaultLoadingIndicator.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAG/B;;GAEG;AACI,MAAM,uBAAuB,GAAoC,GAAG,EAAE,CAAC,2CAAkB,CAAC;AAApF,QAAA,uBAAuB,2BAA6D;AACjG,+BAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultRouteSwitch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const react_router_1 = require("react-router");
|
|
7
|
+
const DefaultRouteSwitch = (_a) => {
|
|
8
|
+
var { paths, NotFound } = _a, props = tslib_1.__rest(_a, ["paths", "NotFound"]);
|
|
9
|
+
return (React.createElement(react_router_1.Switch, Object.assign({}, props),
|
|
10
|
+
paths.map(({ path, Component }) => (React.createElement(react_router_1.Route, { exact: true, key: path, path: path, component: Component }))),
|
|
11
|
+
React.createElement(react_router_1.Route, { component: NotFound })));
|
|
12
|
+
};
|
|
13
|
+
exports.DefaultRouteSwitch = DefaultRouteSwitch;
|
|
14
|
+
exports.DefaultRouteSwitch.displayName = 'DefaultRouteSwitch';
|
|
15
|
+
//# sourceMappingURL=DefaultRouteSwitch_v5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultRouteSwitch_v5.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouteSwitch_v5.tsx"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,+CAA6C;AAGtC,MAAM,kBAAkB,GAA+B,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,sBAA3B,qBAA6B,CAAF;IACxF,OAAO,CACL,oBAAC,qBAAM,oBAAK,KAAK;QACd,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAClC,oBAAC,oBAAK,IAAC,KAAK,QAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,GAAI,CAC7D,CAAC;QACF,oBAAC,oBAAK,IAAC,SAAS,EAAE,QAAQ,GAAI,CACvB,CACV,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B;AACF,0BAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultRouteSwitch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
//@ts-ignore
|
|
7
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
8
|
+
const DefaultRouteSwitch = (_a) => {
|
|
9
|
+
var { paths, NotFound } = _a, props = tslib_1.__rest(_a, ["paths", "NotFound"]);
|
|
10
|
+
return (React.createElement(react_router_dom_1.Routes, Object.assign({}, props),
|
|
11
|
+
paths.map(({ path, Component }) => (
|
|
12
|
+
//@ts-ignore
|
|
13
|
+
React.createElement(react_router_dom_1.Route, { key: path, path: path, element: React.createElement(Component, null) }))),
|
|
14
|
+
//@ts-ignore
|
|
15
|
+
React.createElement(react_router_dom_1.Route, { element: React.createElement(NotFound, null) })));
|
|
16
|
+
};
|
|
17
|
+
exports.DefaultRouteSwitch = DefaultRouteSwitch;
|
|
18
|
+
exports.DefaultRouteSwitch.displayName = 'DefaultRouteSwitch';
|
|
19
|
+
//# sourceMappingURL=DefaultRouteSwitch_v6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultRouteSwitch_v6.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouteSwitch_v6.tsx"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,YAAY;AACZ,uDAAiD;AAG1C,MAAM,kBAAkB,GAA+B,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,sBAA3B,qBAA6B,CAAF;IACxF,OAAO,CACL,oBAAC,yBAAM,oBAAK,KAAK;QACd,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QAClC,YAAY;QACZ,oBAAC,wBAAK,IAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAC,SAAS,OAAG,GAAI,CACzD,CAAC;QAEA,YAAY;QACZ,oBAAC,wBAAK,IAAC,OAAO,EAAE,oBAAC,QAAQ,OAAG,GAAI,CAE3B,CACV,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,kBAAkB,sBAa7B;AACF,0BAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultRouter = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
6
|
+
const DefaultRouter = ({ children, publicPath }) => {
|
|
7
|
+
return React.createElement(react_router_dom_1.BrowserRouter, { basename: publicPath }, children);
|
|
8
|
+
};
|
|
9
|
+
exports.DefaultRouter = DefaultRouter;
|
|
10
|
+
exports.DefaultRouter.displayName = 'DefaultRouter';
|
|
11
|
+
//# sourceMappingURL=DefaultRouter_v5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultRouter_v5.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouter_v5.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uDAAiD;AAG1C,MAAM,aAAa,GAA0B,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;IAC/E,OAAO,oBAAC,gCAAa,IAAC,QAAQ,EAAE,UAAU,IAAG,QAAQ,CAAiB,CAAC;AACzE,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB;AACF,qBAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultRouter = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
6
|
+
const DefaultRouter = ({ children, publicPath }) => {
|
|
7
|
+
return React.createElement(react_router_dom_1.BrowserRouter, { basename: publicPath }, children);
|
|
8
|
+
};
|
|
9
|
+
exports.DefaultRouter = DefaultRouter;
|
|
10
|
+
exports.DefaultRouter.displayName = 'DefaultRouter';
|
|
11
|
+
//# sourceMappingURL=DefaultRouter_v6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultRouter_v6.js","sourceRoot":"","sources":["../../src/defaults/DefaultRouter_v6.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uDAAiD;AAG1C,MAAM,aAAa,GAA0B,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;IAC/E,OAAO,oBAAC,gCAAa,IAAC,QAAQ,EAAE,UAAU,IAAG,QAAQ,CAAiB,CAAC;AACzE,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB;AACF,qBAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNavigation = exports.createRedirect = exports.useCurrentNavigation = exports.useRouterContext = void 0;
|
|
4
|
+
const _noop = () => { };
|
|
5
|
+
function useRouterContext() {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
exports.useRouterContext = useRouterContext;
|
|
9
|
+
function useCurrentNavigation() { }
|
|
10
|
+
exports.useCurrentNavigation = useCurrentNavigation;
|
|
11
|
+
function createRedirect() {
|
|
12
|
+
return () => null;
|
|
13
|
+
}
|
|
14
|
+
exports.createRedirect = createRedirect;
|
|
15
|
+
function createNavigation() {
|
|
16
|
+
return {
|
|
17
|
+
get path() {
|
|
18
|
+
return location.pathname;
|
|
19
|
+
},
|
|
20
|
+
get url() {
|
|
21
|
+
const loc = location;
|
|
22
|
+
return `${loc.pathname}${loc.search}${loc.hash}`;
|
|
23
|
+
},
|
|
24
|
+
push(target, state) { },
|
|
25
|
+
replace(target, state) { },
|
|
26
|
+
go(n) { },
|
|
27
|
+
block(blocker) {
|
|
28
|
+
return _noop;
|
|
29
|
+
},
|
|
30
|
+
listen(listener) {
|
|
31
|
+
return _noop;
|
|
32
|
+
},
|
|
33
|
+
router: undefined,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.createNavigation = createNavigation;
|
|
37
|
+
//# sourceMappingURL=navigator_none.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigator_none.js","sourceRoot":"","sources":["../../src/defaults/navigator_none.tsx"],"names":[],"mappings":";;;AAEA,MAAM,KAAK,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEvB,SAAgB,gBAAgB;IAC9B,OAAO,SAAS,CAAC;AACnB,CAAC;AAFD,4CAEC;AAED,SAAgB,oBAAoB,KAAI,CAAC;AAAzC,oDAAyC;AAEzC,SAAgB,cAAc;IAC5B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;AACpB,CAAC;AAFD,wCAEC;AAED,SAAgB,gBAAgB;IAC9B,OAAO;QACL,IAAI,IAAI;YACN,OAAO,QAAQ,CAAC,QAAQ,CAAC;QAC3B,CAAC;QACD,IAAI,GAAG;YACL,MAAM,GAAG,GAAG,QAAQ,CAAC;YACrB,OAAO,GAAG,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACnD,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,KAAK,IAAG,CAAC;QACtB,OAAO,CAAC,MAAM,EAAE,KAAK,IAAG,CAAC;QACzB,EAAE,CAAC,CAAC,IAAG,CAAC;QACR,KAAK,CAAC,OAAO;YACX,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,CAAC,QAAQ;YACb,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,EAAE,SAAS;KAClB,CAAC;AACJ,CAAC;AApBD,4CAoBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NavigationApi } from '../types';
|
|
3
|
+
export declare function useRouterContext(): import("react-router").RouteComponentProps<{}, import("react-router").StaticContext, unknown>;
|
|
4
|
+
export declare function useCurrentNavigation(): void;
|
|
5
|
+
export declare function createRedirect(to: string): () => JSX.Element;
|
|
6
|
+
export declare function createNavigation(): NavigationApi;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNavigation = exports.createRedirect = exports.useCurrentNavigation = exports.useRouterContext = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const react_router_1 = require("react-router");
|
|
6
|
+
let _nav;
|
|
7
|
+
const _noop = () => { };
|
|
8
|
+
function useRouterContext() {
|
|
9
|
+
return React.useContext(react_router_1.__RouterContext);
|
|
10
|
+
}
|
|
11
|
+
exports.useRouterContext = useRouterContext;
|
|
12
|
+
function useCurrentNavigation() {
|
|
13
|
+
const ctx = useRouterContext();
|
|
14
|
+
const location = (0, react_router_1.useLocation)();
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (_nav) {
|
|
17
|
+
window.dispatchEvent(new CustomEvent('piral-navigate', {
|
|
18
|
+
detail: {
|
|
19
|
+
location,
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
}, [location]);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
_nav = ctx.history;
|
|
26
|
+
return () => {
|
|
27
|
+
_nav = undefined;
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
}
|
|
31
|
+
exports.useCurrentNavigation = useCurrentNavigation;
|
|
32
|
+
function createRedirect(to) {
|
|
33
|
+
return () => React.createElement(react_router_1.Redirect, { to: to });
|
|
34
|
+
}
|
|
35
|
+
exports.createRedirect = createRedirect;
|
|
36
|
+
function createNavigation() {
|
|
37
|
+
const enhance = (location, action) => ({
|
|
38
|
+
action,
|
|
39
|
+
location: Object.assign({ get href() {
|
|
40
|
+
return _nav.createHref(location);
|
|
41
|
+
} }, location),
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
get path() {
|
|
45
|
+
const loc = _nav ? _nav.location : location;
|
|
46
|
+
return loc.pathname;
|
|
47
|
+
},
|
|
48
|
+
get url() {
|
|
49
|
+
const loc = _nav ? _nav.location : location;
|
|
50
|
+
return `${loc.pathname}${loc.search}${loc.hash}`;
|
|
51
|
+
},
|
|
52
|
+
push(target, state) {
|
|
53
|
+
if (_nav) {
|
|
54
|
+
_nav.push(target, state);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
replace(target, state) {
|
|
58
|
+
if (_nav) {
|
|
59
|
+
_nav.replace(target, state);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
go(n) {
|
|
63
|
+
if (_nav) {
|
|
64
|
+
_nav.go(n);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
block(blocker) {
|
|
68
|
+
if (!_nav) {
|
|
69
|
+
return _noop;
|
|
70
|
+
}
|
|
71
|
+
return _nav.block((location, action) => blocker(enhance(location, action)));
|
|
72
|
+
},
|
|
73
|
+
listen(listener) {
|
|
74
|
+
const handler = (e) => listener(enhance(e.detail.location, _nav.action));
|
|
75
|
+
window.addEventListener('piral-navigate', handler);
|
|
76
|
+
return () => {
|
|
77
|
+
window.removeEventListener('piral-navigate', handler);
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
router: {
|
|
81
|
+
get history() {
|
|
82
|
+
return _nav;
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
exports.createNavigation = createNavigation;
|
|
88
|
+
//# sourceMappingURL=navigator_v5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigator_v5.js","sourceRoot":"","sources":["../../src/defaults/navigator_v5.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B,+CAAuF;AAGvF,IAAI,IAAa,CAAC;AAClB,MAAM,KAAK,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEvB,SAAgB,gBAAgB;IAC9B,OAAO,KAAK,CAAC,UAAU,CAAC,8BAAa,CAAC,CAAC;AACzC,CAAC;AAFD,4CAEC;AAED,SAAgB,oBAAoB;IAClC,MAAM,GAAG,GAAG,gBAAgB,E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+
import { NavigationApi } from '../types';
|
|
3
|
+
export declare function useRouterContext(): unknown;
|
|
4
|
+
export declare function useCurrentNavigation(): void;
|
|
5
|
+
export declare function createRedirect(to: string): () => JSX.Element;
|
|
6
|
+
export declare function createNavigation(): NavigationApi;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNavigation = exports.createRedirect = exports.useCurrentNavigation = exports.useRouterContext = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
//@ts-ignore
|
|
6
|
+
const react_router_1 = require("react-router");
|
|
7
|
+
let _nav;
|
|
8
|
+
const _noop = () => { };
|
|
9
|
+
function useRouterContext() {
|
|
10
|
+
return React.useContext(react_router_1.UNSAFE_NavigationContext);
|
|
11
|
+
}
|
|
12
|
+
exports.useRouterContext = useRouterContext;
|
|
13
|
+
function useCurrentNavigation() {
|
|
14
|
+
const ctx = useRouterContext();
|
|
15
|
+
const location = (0, react_router_1.useLocation)();
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
if (_nav) {
|
|
18
|
+
window.dispatchEvent(new CustomEvent('piral-navigate', {
|
|
19
|
+
detail: {
|
|
20
|
+
location,
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
}, [location]);
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
_nav = ctx.navigator;
|
|
27
|
+
return () => {
|
|
28
|
+
_nav = undefined;
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
}
|
|
32
|
+
exports.useCurrentNavigation = useCurrentNavigation;
|
|
33
|
+
function createRedirect(to) {
|
|
34
|
+
return () => React.createElement(react_router_1.Navigate, { to: to });
|
|
35
|
+
}
|
|
36
|
+
exports.createRedirect = createRedirect;
|
|
37
|
+
function createNavigation() {
|
|
38
|
+
const enhance = (info) => (Object.assign(Object.assign({}, info), { location: Object.assign({ get href() {
|
|
39
|
+
return _nav.createHref(info.location);
|
|
40
|
+
} }, info.location) }));
|
|
41
|
+
return {
|
|
42
|
+
get path() {
|
|
43
|
+
const loc = _nav ? _nav.location : location;
|
|
44
|
+
return loc.pathname;
|
|
45
|
+
},
|
|
46
|
+
get url() {
|
|
47
|
+
const loc = _nav ? _nav.location : location;
|
|
48
|
+
return `${loc.pathname}${loc.search}${loc.hash}`;
|
|
49
|
+
},
|
|
50
|
+
push(target, state) {
|
|
51
|
+
if (_nav) {
|
|
52
|
+
_nav.push(target, state);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
replace(target, state) {
|
|
56
|
+
if (_nav) {
|
|
57
|
+
_nav.replace(target, state);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
go(n) {
|
|
61
|
+
if (_nav) {
|
|
62
|
+
_nav.go(n);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
block(blocker) {
|
|
66
|
+
if (!_nav) {
|
|
67
|
+
return _noop;
|
|
68
|
+
}
|
|
69
|
+
return _nav.block((transition) => blocker(enhance(transition)));
|
|
70
|
+
},
|
|
71
|
+
listen(listener) {
|
|
72
|
+
const handler = (e) => listener(enhance(e.detail));
|
|
73
|
+
window.addEventListener('piral-navigate', handler);
|
|
74
|
+
return () => {
|
|
75
|
+
window.removeEventListener('piral-navigate', handler);
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
get router() {
|
|
79
|
+
return _nav;
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
exports.createNavigation = createNavigation;
|
|
84
|
+
//# sourceMappingURL=navigator_v6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigator_v6.js","sourceRoot":"","sources":["../../src/defaults/navigator_v6.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,YAAY;AACZ,+CAAgG;AAGhG,IAAI,IAAS,CAAC;AACd,MAAM,KAAK,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC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C"}
|
package/lib/helpers.d.ts
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
|
-
import { PiletApiCreator, LoadPiletsOptions, CustomSpecLoaders, DefaultLoaderConfig,
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
* Creates a dependency getter that sets the shared dependencies explicitly.
|
|
5
|
-
* Overrides the potentially set shared dependencies from the Piral CLI, but
|
|
6
|
-
* keeps all global dependencies such as react, react-dom, ...
|
|
7
|
-
* @param sharedDependencies The shared dependencies to declare.
|
|
8
|
-
*/
|
|
9
|
-
export declare function setSharedDependencies(sharedDependencies: AvailableDependencies): () => {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Creates a dependency getter that extends the shared dependencies with additional dependencies.
|
|
14
|
-
* @param additionalDependencies The additional dependencies to declare.
|
|
15
|
-
*/
|
|
16
|
-
export declare function extendSharedDependencies(additionalDependencies: AvailableDependencies): () => {
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
};
|
|
1
|
+
import { PiletApiCreator, LoadPiletsOptions, CustomSpecLoaders, DefaultLoaderConfig, PiletLoader, PiletLifecycleHooks } from 'piral-base';
|
|
2
|
+
import type { DebuggerExtensionOptions } from 'piral-debug-utils';
|
|
3
|
+
import type { Pilet, PiletRequester, GlobalStateContext, PiletLoadingStrategy, DependencySelector } from './types';
|
|
19
4
|
export interface PiletOptionsConfig {
|
|
5
|
+
context: GlobalStateContext;
|
|
6
|
+
hooks?: PiletLifecycleHooks;
|
|
7
|
+
loaders?: CustomSpecLoaders;
|
|
8
|
+
loaderConfig?: DefaultLoaderConfig;
|
|
20
9
|
availablePilets: Array<Pilet>;
|
|
21
|
-
createApi: PiletApiCreator;
|
|
22
|
-
fetchDependency: PiletDependencyFetcher;
|
|
23
|
-
getDependencies: PiletDependencyGetter;
|
|
24
10
|
strategy: PiletLoadingStrategy;
|
|
25
|
-
|
|
26
|
-
loaderConfig?: DefaultLoaderConfig;
|
|
27
|
-
loaders?: CustomSpecLoaders;
|
|
11
|
+
createApi: PiletApiCreator;
|
|
28
12
|
loadPilet: PiletLoader;
|
|
29
|
-
|
|
13
|
+
requestPilets: PiletRequester;
|
|
14
|
+
shareDependencies: DependencySelector;
|
|
15
|
+
debug?: DebuggerExtensionOptions;
|
|
30
16
|
}
|
|
31
|
-
export declare function createPiletOptions({ context,
|
|
17
|
+
export declare function createPiletOptions({ hooks, context, loaders, loaderConfig, availablePilets, strategy, createApi, loadPilet, requestPilets, shareDependencies, debug, }: PiletOptionsConfig): LoadPiletsOptions;
|
package/lib/helpers.js
CHANGED
|
@@ -1,83 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPiletOptions =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
function setSharedDependencies(sharedDependencies) {
|
|
15
|
-
var dependencies = tslib_1.__assign(tslib_1.__assign({}, modules_1.globalDependencies), sharedDependencies);
|
|
16
|
-
return function () { return dependencies; };
|
|
17
|
-
}
|
|
18
|
-
exports.setSharedDependencies = setSharedDependencies;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a dependency getter that extends the shared dependencies with additional dependencies.
|
|
21
|
-
* @param additionalDependencies The additional dependencies to declare.
|
|
22
|
-
*/
|
|
23
|
-
function extendSharedDependencies(additionalDependencies) {
|
|
24
|
-
var dependencies = tslib_1.__assign(tslib_1.__assign({}, modules_1.getLocalDependencies()), additionalDependencies);
|
|
25
|
-
return function () { return dependencies; };
|
|
26
|
-
}
|
|
27
|
-
exports.extendSharedDependencies = extendSharedDependencies;
|
|
28
|
-
function createPiletOptions(_a) {
|
|
29
|
-
var context = _a.context, createApi = _a.createApi, availablePilets = _a.availablePilets, fetchDependency = _a.fetchDependency, getDependencies = _a.getDependencies, loaderConfig = _a.loaderConfig, loadPilet = _a.loadPilet, strategy = _a.strategy, loaders = _a.loaders, requestPilets = _a.requestPilets;
|
|
30
|
-
getDependencies = piral_base_1.getDependencyResolver(modules_1.globalDependencies, getDependencies);
|
|
31
|
-
loadPilet = piral_base_1.extendLoader(loadPilet !== null && loadPilet !== void 0 ? loadPilet : piral_base_1.getDefaultLoader(getDependencies, fetchDependency, loaderConfig), loaders);
|
|
32
|
-
// if we build the debug version of piral (debug and emulator build)
|
|
33
|
-
if (process.env.DEBUG_PIRAL) {
|
|
34
|
-
var installPiralDebug = require('piral-debug-utils').installPiralDebug;
|
|
35
|
-
installPiralDebug({
|
|
36
|
-
context: context,
|
|
37
|
-
createApi: createApi,
|
|
38
|
-
getDependencies: getDependencies,
|
|
39
|
-
loadPilet: loadPilet,
|
|
40
|
-
requestPilets: requestPilets,
|
|
41
|
-
});
|
|
42
|
-
// we watch the state container for changes
|
|
43
|
-
react_atom_1.addChangeHandler(context.state, 'debugging', function (_a) {
|
|
44
|
-
var current = _a.current, previous = _a.previous;
|
|
45
|
-
var viewState = sessionStorage.getItem('dbg:view-state') !== 'off';
|
|
46
|
-
if (viewState) {
|
|
47
|
-
var infos = new Error().stack;
|
|
48
|
-
if (infos) {
|
|
49
|
-
// Chrome, Firefox, ... (full capability)
|
|
50
|
-
var action = infos.split('\n')[7].replace(/^\s+at\s+(Atom\.|Object\.)?/, '');
|
|
51
|
-
console.group("%c Piral State Change %c " + new Date().toLocaleTimeString(), 'color: gray; font-weight: lighter;', 'color: black; font-weight: bold;');
|
|
52
|
-
console.log('%c Previous', "color: #9E9E9E; font-weight: bold", previous);
|
|
53
|
-
console.log('%c Action', "color: #03A9F4; font-weight: bold", action);
|
|
54
|
-
console.log('%c Next', "color: #4CAF50; font-weight: bold", current);
|
|
55
|
-
console.groupEnd();
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
// IE 11, ... (does not know colors etc.)
|
|
59
|
-
console.log('Changed state', previous, current);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
if (process.env.DEBUG_PILET) {
|
|
65
|
-
var withEmulatorPilets = require('piral-debug-utils').withEmulatorPilets;
|
|
66
|
-
requestPilets = withEmulatorPilets(requestPilets, {
|
|
67
|
-
inject: context.injectPilet,
|
|
68
|
-
createApi: createApi,
|
|
69
|
-
loadPilet: loadPilet,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
strategy: strategy,
|
|
74
|
-
loadPilet: loadPilet,
|
|
75
|
-
createApi: createApi,
|
|
76
|
-
getDependencies: getDependencies,
|
|
3
|
+
exports.createPiletOptions = void 0;
|
|
4
|
+
const piral_base_1 = require("piral-base");
|
|
5
|
+
const modules_1 = require("./modules");
|
|
6
|
+
const app_codegen_1 = require("../app.codegen");
|
|
7
|
+
function createPiletOptions({ hooks, context, loaders, loaderConfig, availablePilets, strategy, createApi, loadPilet, requestPilets, shareDependencies, debug, }) {
|
|
8
|
+
const options = {
|
|
9
|
+
config: loaderConfig,
|
|
10
|
+
strategy,
|
|
11
|
+
loadPilet: (0, piral_base_1.extendLoader)(loadPilet !== null && loadPilet !== void 0 ? loadPilet : (0, piral_base_1.getDefaultLoader)(loaderConfig), loaders),
|
|
12
|
+
createApi,
|
|
77
13
|
pilets: availablePilets,
|
|
78
14
|
fetchPilets: requestPilets,
|
|
79
|
-
|
|
15
|
+
hooks,
|
|
16
|
+
dependencies: shareDependencies(modules_1.globalDependencies),
|
|
80
17
|
};
|
|
18
|
+
(0, app_codegen_1.integrateDebugger)(context, options, debug);
|
|
19
|
+
(0, app_codegen_1.integrateEmulator)(context, options, debug);
|
|
20
|
+
return options;
|
|
81
21
|
}
|
|
82
22
|
exports.createPiletOptions = createPiletOptions;
|
|
83
23
|
//# sourceMappingURL=helpers.js.map
|
package/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.tsx"],"names":[],"mappings":";;;AAAA,2CASoB;AAEpB,uCAA+C;AAE/C,gDAAsE;AAgBtE,SAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,SAAS,EACT,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,KAAK,GACc;IACnB,MAAM,OAAO,GAAsB;QACjC,MAAM,EAAE,YAAY;QACpB,QAAQ;QACR,SAAS,EAAE,IAAA,yBAAY,EAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAA,6BAAgB,EAAC,YAAY,CAAC,EAAE,OAAO,CAAC;QAC7E,SAAS;QACT,MAAM,EAAE,eAAe;QACvB,WAAW,EAAE,aAAa;QAC1B,KAAK;QACL,YAAY,EAAE,iBAAiB,CAAC,4BAAkB,CAAC;KACpD,CAAC;IAEF,IAAA,+BAAiB,EAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3C,IAAA,+BAAiB,EAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAE3C,OAAO,OAAO,CAAC;AACjB,CAAC;AA5BD,gDA4BC"}
|
package/lib/hooks/action.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useAction = void 0;
|
|
4
|
-
|
|
5
|
-
var stateContext_1 = require("../state/stateContext");
|
|
4
|
+
const globalState_1 = require("./globalState");
|
|
6
5
|
/**
|
|
7
6
|
* Hook that gets an action for manipulating the global state.
|
|
8
7
|
* @param action The name of the action to retrieve.
|
|
9
8
|
*/
|
|
10
9
|
function useAction(action) {
|
|
11
|
-
|
|
10
|
+
const ctx = (0, globalState_1.useGlobalStateContext)();
|
|
12
11
|
return ctx[action];
|
|
13
12
|
}
|
|
14
13
|
exports.useAction = useAction;
|
package/lib/hooks/action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/hooks/action.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/hooks/action.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AAGtD;;;GAGG;AACH,SAAgB,SAAS,CAA+B,MAAS;IAC/D,MAAM,GAAG,GAAG,IAAA,mCAAqB,GAAE,CAAC;IACpC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC;AAHD,8BAGC"}
|
package/lib/hooks/actions.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useActions = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const stateContext_1 = require("../state/stateContext");
|
|
7
7
|
/**
|
|
8
8
|
* Hook that gets the actions for manipulating the global state.
|
|
9
9
|
*/
|
|
10
10
|
function useActions() {
|
|
11
|
-
|
|
11
|
+
const _a = (0, react_1.useContext)(stateContext_1.StateContext), { state } = _a, actions = tslib_1.__rest(_a, ["state"]);
|
|
12
12
|
return actions;
|
|
13
13
|
}
|
|
14
14
|
exports.useActions = useActions;
|
package/lib/hooks/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/hooks/actions.ts"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/hooks/actions.ts"],"names":[],"mappings":";;;;AAAA,iCAAmC;AACnC,wDAAqD;AAGrD;;GAEG;AACH,SAAgB,UAAU;IACxB,MAAM,KAAwB,IAAA,kBAAU,EAAqB,2BAAY,CAAC,EAApE,EAAE,KAAK,OAA6D,EAAxD,OAAO,sBAAnB,SAAqB,CAA+C,CAAC;IAC3E,OAAO,OAAuB,CAAC;AACjC,CAAC;AAHD,gCAGC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { GlobalState } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to obtain the global state context, which gives you directly
|
|
4
|
+
* all actions, state, and more of the Piral instance.
|
|
5
|
+
* If you are only interested in reading out the state, use the
|
|
6
|
+
* `useGlobalState` hook instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useGlobalStateContext(): import("../types").GlobalStateContext;
|
|
2
9
|
/**
|
|
3
10
|
* Hook that yields the full global state.
|
|
4
11
|
* Any change to the global state yields the new state.
|
package/lib/hooks/globalState.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useGlobalState = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
exports.useGlobalState = exports.useGlobalStateContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const stateContext_1 = require("../state/stateContext");
|
|
6
|
+
/**
|
|
7
|
+
* Hook to obtain the global state context, which gives you directly
|
|
8
|
+
* all actions, state, and more of the Piral instance.
|
|
9
|
+
* If you are only interested in reading out the state, use the
|
|
10
|
+
* `useGlobalState` hook instead.
|
|
11
|
+
*/
|
|
12
|
+
function useGlobalStateContext() {
|
|
13
|
+
return (0, react_1.useContext)(stateContext_1.StateContext);
|
|
12
14
|
}
|
|
15
|
+
exports.useGlobalStateContext = useGlobalStateContext;
|
|
13
16
|
function useGlobalState(select) {
|
|
14
|
-
|
|
15
|
-
return
|
|
17
|
+
const { state: useState } = useGlobalStateContext();
|
|
18
|
+
return useState(select);
|
|
16
19
|
}
|
|
17
20
|
exports.useGlobalState = useGlobalState;
|
|
18
21
|
//# sourceMappingURL=globalState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalState.js","sourceRoot":"","sources":["../../src/hooks/globalState.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"globalState.js","sourceRoot":"","sources":["../../src/hooks/globalState.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AACnC,wDAAqD;AAGrD;;;;;GAKG;AACH,SAAgB,qBAAqB;IACnC,OAAO,IAAA,kBAAU,EAAC,2BAAY,CAAC,CAAC;AAClC,CAAC;AAFD,sDAEC;AAeD,SAAgB,cAAc,CAAI,MAAkC;IAClE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACpD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC;AAHD,wCAGC"}
|