piral-core 1.0.0-pre.2217 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +4 -4
- package/app.codegen +36 -0
- package/app.codegen.d.ts +29 -0
- package/dist/codegen.js +5308 -0
- package/esm/Piral.d.ts +4 -4
- package/esm/Piral.js +8 -11
- package/esm/Piral.js.map +1 -1
- package/esm/PiralContext.d.ts +21 -0
- package/esm/PiralContext.js +34 -0
- package/esm/PiralContext.js.map +1 -0
- package/esm/RootListener.d.ts +2 -0
- package/esm/RootListener.js +23 -0
- package/esm/RootListener.js.map +1 -0
- package/esm/actions/app.d.ts +7 -4
- package/esm/actions/app.js +24 -14
- package/esm/actions/app.js.map +1 -1
- package/esm/actions/components.js +5 -6
- package/esm/actions/components.js.map +1 -1
- package/esm/actions/data.js +16 -17
- package/esm/actions/data.js.map +1 -1
- package/esm/actions/define.js +2 -3
- package/esm/actions/define.js.map +1 -1
- package/esm/actions/portal.d.ts +2 -0
- package/esm/actions/portal.js +9 -4
- package/esm/actions/portal.js.map +1 -1
- package/esm/actions/state.js +7 -4
- package/esm/actions/state.js.map +1 -1
- package/esm/components/ErrorBoundary.d.ts +14 -31
- package/esm/components/ErrorBoundary.js +22 -28
- package/esm/components/ErrorBoundary.js.map +1 -1
- package/esm/components/ExtensionSlot.d.ts +1 -0
- package/esm/components/ExtensionSlot.js +34 -11
- package/esm/components/ExtensionSlot.js.map +1 -1
- package/esm/components/ForeignComponentContainer.d.ts +19 -0
- package/esm/components/ForeignComponentContainer.js +46 -0
- package/esm/components/ForeignComponentContainer.js.map +1 -0
- package/esm/components/Mediator.js +15 -12
- package/esm/components/Mediator.js.map +1 -1
- package/esm/components/PiralGlobals.d.ts +6 -0
- package/esm/components/PiralGlobals.js +13 -0
- package/esm/components/PiralGlobals.js.map +1 -0
- package/esm/components/PiralRoutes.d.ts +5 -0
- package/esm/components/PiralRoutes.js +6 -11
- package/esm/components/PiralRoutes.js.map +1 -1
- package/esm/components/PiralSuspense.d.ts +5 -0
- package/esm/components/PiralSuspense.js +8 -0
- package/esm/components/PiralSuspense.js.map +1 -0
- package/esm/components/PiralView.d.ts +10 -1
- package/esm/components/PiralView.js +12 -25
- package/esm/components/PiralView.js.map +1 -1
- package/esm/components/PortalRenderer.d.ts +5 -0
- package/esm/components/PortalRenderer.js +7 -0
- package/esm/components/PortalRenderer.js.map +1 -0
- package/esm/components/ResponsiveLayout.d.ts +9 -1
- package/esm/components/ResponsiveLayout.js +5 -13
- package/esm/components/ResponsiveLayout.js.map +1 -1
- package/esm/components/SwitchErrorInfo.js +12 -10
- package/esm/components/SwitchErrorInfo.js.map +1 -1
- package/esm/components/components.d.ts +18 -6
- package/esm/components/components.js +21 -9
- package/esm/components/components.js.map +1 -1
- package/esm/components/index.d.ts +4 -10
- package/esm/components/index.js +4 -10
- package/esm/components/index.js.map +1 -1
- package/esm/components/wrapComponent.d.ts +7 -0
- package/esm/components/wrapComponent.js +42 -0
- package/esm/components/wrapComponent.js.map +1 -0
- package/esm/createInstance.d.ts +2 -2
- package/esm/createInstance.js +34 -30
- package/esm/createInstance.js.map +1 -1
- package/esm/defaults/DefaultErrorInfo.js +10 -0
- package/esm/defaults/DefaultErrorInfo.js.map +1 -0
- package/esm/{components → defaults}/DefaultLayout.js +1 -4
- package/esm/defaults/DefaultLayout.js.map +1 -0
- package/esm/{components/DefaultLoader.js → defaults/DefaultLoadingIndicator.js} +2 -2
- package/esm/defaults/DefaultLoadingIndicator.js.map +1 -0
- package/esm/defaults/DefaultRouteSwitch_v5.d.ts +3 -0
- package/esm/defaults/DefaultRouteSwitch_v5.js +11 -0
- package/esm/defaults/DefaultRouteSwitch_v5.js.map +1 -0
- package/esm/defaults/DefaultRouteSwitch_v6.d.ts +3 -0
- package/esm/defaults/DefaultRouteSwitch_v6.js +15 -0
- package/esm/defaults/DefaultRouteSwitch_v6.js.map +1 -0
- package/esm/defaults/DefaultRouter_v5.d.ts +3 -0
- package/esm/defaults/DefaultRouter_v5.js +7 -0
- package/esm/defaults/DefaultRouter_v5.js.map +1 -0
- package/esm/defaults/DefaultRouter_v6.d.ts +3 -0
- package/esm/defaults/DefaultRouter_v6.js +7 -0
- package/esm/defaults/DefaultRouter_v6.js.map +1 -0
- package/esm/defaults/navigator_none.d.ts +5 -0
- package/esm/defaults/navigator_none.js +30 -0
- package/esm/defaults/navigator_none.js.map +1 -0
- package/esm/defaults/navigator_v5.d.ts +6 -0
- package/esm/defaults/navigator_v5.js +81 -0
- package/esm/defaults/navigator_v5.js.map +1 -0
- package/esm/defaults/navigator_v6.d.ts +6 -0
- package/esm/defaults/navigator_v6.js +77 -0
- package/esm/defaults/navigator_v6.js.map +1 -0
- package/esm/helpers.d.ts +12 -26
- package/esm/helpers.js +14 -72
- package/esm/helpers.js.map +1 -1
- package/esm/hooks/action.js +2 -3
- package/esm/hooks/action.js.map +1 -1
- package/esm/hooks/actions.js +1 -1
- package/esm/hooks/actions.js.map +1 -1
- package/esm/hooks/globalState.d.ts +7 -0
- package/esm/hooks/globalState.js +10 -8
- package/esm/hooks/globalState.js.map +1 -1
- package/esm/hooks/index.d.ts +2 -5
- package/esm/hooks/index.js +2 -5
- package/esm/hooks/index.js.map +1 -1
- package/esm/hooks/media.js +8 -7
- package/esm/hooks/media.js.map +1 -1
- package/esm/hooks/piletApi.d.ts +7 -0
- package/esm/hooks/piletApi.js +14 -0
- package/esm/hooks/piletApi.js.map +1 -0
- package/esm/hooks/routes.d.ts +2 -0
- package/esm/hooks/routes.js +11 -0
- package/esm/hooks/routes.js.map +1 -0
- package/esm/hooks/setter.js +3 -2
- package/esm/hooks/setter.js.map +1 -1
- package/esm/hooks/sharedData.js +2 -2
- package/esm/hooks/sharedData.js.map +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/index.js.map +1 -1
- package/esm/modules/api.d.ts +2 -5
- package/esm/modules/api.js +9 -68
- package/esm/modules/api.js.map +1 -1
- package/esm/modules/core.d.ts +3 -0
- package/esm/modules/core.js +50 -0
- package/esm/modules/core.js.map +1 -0
- package/esm/modules/dependencies.d.ts +5 -6
- package/esm/modules/dependencies.js +9 -24
- package/esm/modules/dependencies.js.map +1 -1
- package/esm/modules/element.d.ts +5 -0
- package/esm/modules/element.js +169 -0
- package/esm/modules/element.js.map +1 -0
- package/esm/modules/index.d.ts +1 -0
- package/esm/modules/index.js +1 -0
- package/esm/modules/index.js.map +1 -1
- package/esm/setters/SetComponent.js +11 -0
- package/esm/setters/SetComponent.js.map +1 -0
- package/esm/setters/SetError.js +11 -0
- package/esm/setters/SetError.js.map +1 -0
- package/esm/setters/SetErrors.js +9 -0
- package/esm/setters/SetErrors.js.map +1 -0
- package/esm/setters/SetLayout.js +9 -0
- package/esm/setters/SetLayout.js.map +1 -0
- package/esm/setters/SetProvider.js +11 -0
- package/esm/setters/SetProvider.js.map +1 -0
- package/esm/setters/SetRedirect.js +12 -0
- package/esm/setters/SetRedirect.js.map +1 -0
- package/{lib/components → esm/setters}/SetRoute.d.ts +6 -2
- package/esm/setters/SetRoute.js +11 -0
- package/esm/setters/SetRoute.js.map +1 -0
- package/esm/setters/index.d.ts +7 -0
- package/esm/setters/index.js +8 -0
- package/esm/setters/index.js.map +1 -0
- package/esm/state/createActions.d.ts +2 -2
- package/esm/state/createActions.js +8 -12
- package/esm/state/createActions.js.map +1 -1
- package/esm/state/createGlobalState.d.ts +1 -2
- package/esm/state/createGlobalState.js +9 -34
- package/esm/state/createGlobalState.js.map +1 -1
- package/esm/state/stateContext.js +1 -1
- package/esm/state/stateContext.js.map +1 -1
- package/esm/state/withApi.d.ts +1 -1
- package/esm/state/withApi.js +19 -104
- package/esm/state/withApi.js.map +1 -1
- package/esm/tools/codegen.d.ts +21 -0
- package/esm/tools/codegen.js +145 -0
- package/esm/tools/codegen.js.map +1 -0
- package/esm/tools/debugger.d.ts +4 -0
- package/esm/tools/debugger.js +54 -0
- package/esm/tools/debugger.js.map +1 -0
- package/esm/tools/emulator.d.ts +3 -0
- package/esm/tools/emulator.js +11 -0
- package/esm/tools/emulator.js.map +1 -0
- package/esm/types/api.d.ts +37 -10
- package/esm/types/common.d.ts +11 -11
- package/esm/types/components.d.ts +74 -8
- package/esm/types/config.d.ts +24 -17
- package/esm/types/data.d.ts +2 -2
- package/esm/types/extension.d.ts +31 -4
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/index.js.map +1 -1
- package/esm/types/instance.d.ts +26 -4
- package/esm/types/layout.d.ts +3 -3
- package/esm/types/navigation.d.ts +94 -0
- package/esm/types/navigation.js +2 -0
- package/esm/types/navigation.js.map +1 -0
- package/esm/types/plugin.d.ts +1 -14
- package/esm/types/state.d.ts +66 -27
- package/esm/types/utils.d.ts +1 -1
- package/esm/utils/compare.d.ts +1 -1
- package/esm/utils/compare.js +24 -7
- package/esm/utils/compare.js.map +1 -1
- package/esm/utils/data.js +6 -7
- package/esm/utils/data.js.map +1 -1
- package/esm/utils/extension.d.ts +16 -0
- package/esm/utils/extension.js +37 -0
- package/esm/utils/extension.js.map +1 -0
- package/esm/utils/foreign.d.ts +7 -2
- package/esm/utils/foreign.js +20 -9
- package/esm/utils/foreign.js.map +1 -1
- package/esm/utils/guid.js +3 -3
- package/esm/utils/guid.js.map +1 -1
- package/esm/utils/helpers.d.ts +11 -8
- package/esm/utils/helpers.js +29 -18
- package/esm/utils/helpers.js.map +1 -1
- package/esm/utils/index.d.ts +3 -1
- package/esm/utils/index.js +3 -1
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/media.js +8 -8
- package/esm/utils/media.js.map +1 -1
- package/esm/utils/state.d.ts +57 -0
- package/esm/utils/state.js +83 -0
- package/esm/utils/state.js.map +1 -0
- package/esm/utils/storage.js +13 -14
- package/esm/utils/storage.js.map +1 -1
- package/lib/Piral.d.ts +4 -4
- package/lib/Piral.js +11 -13
- package/lib/Piral.js.map +1 -1
- package/lib/PiralContext.d.ts +21 -0
- package/lib/PiralContext.js +38 -0
- package/lib/PiralContext.js.map +1 -0
- package/lib/RootListener.d.ts +2 -0
- package/lib/RootListener.js +27 -0
- package/lib/RootListener.js.map +1 -0
- package/lib/actions/app.d.ts +7 -4
- package/lib/actions/app.js +27 -16
- package/lib/actions/app.js.map +1 -1
- package/lib/actions/components.js +5 -6
- package/lib/actions/components.js.map +1 -1
- package/lib/actions/data.js +17 -18
- package/lib/actions/data.js.map +1 -1
- package/lib/actions/define.js +2 -3
- package/lib/actions/define.js.map +1 -1
- package/lib/actions/index.js +1 -1
- package/lib/actions/portal.d.ts +2 -0
- package/lib/actions/portal.js +12 -5
- package/lib/actions/portal.js.map +1 -1
- package/lib/actions/state.js +7 -4
- package/lib/actions/state.js.map +1 -1
- package/lib/components/ErrorBoundary.d.ts +14 -31
- package/lib/components/ErrorBoundary.js +23 -28
- package/lib/components/ErrorBoundary.js.map +1 -1
- package/lib/components/ExtensionSlot.d.ts +1 -0
- package/lib/components/ExtensionSlot.js +37 -14
- package/lib/components/ExtensionSlot.js.map +1 -1
- package/lib/components/ForeignComponentContainer.d.ts +19 -0
- package/lib/components/ForeignComponentContainer.js +50 -0
- package/lib/components/ForeignComponentContainer.js.map +1 -0
- package/lib/components/Mediator.js +18 -14
- package/lib/components/Mediator.js.map +1 -1
- package/lib/components/PiralGlobals.d.ts +6 -0
- package/lib/components/PiralGlobals.js +17 -0
- package/lib/components/PiralGlobals.js.map +1 -0
- package/lib/components/PiralRoutes.d.ts +5 -0
- package/lib/components/PiralRoutes.js +8 -12
- package/lib/components/PiralRoutes.js.map +1 -1
- package/lib/components/PiralSuspense.d.ts +5 -0
- package/lib/components/PiralSuspense.js +12 -0
- package/lib/components/PiralSuspense.js.map +1 -0
- package/lib/components/PiralView.d.ts +10 -1
- package/lib/components/PiralView.js +15 -27
- package/lib/components/PiralView.js.map +1 -1
- package/lib/components/PortalRenderer.d.ts +5 -0
- package/lib/components/PortalRenderer.js +11 -0
- package/lib/components/PortalRenderer.js.map +1 -0
- package/lib/components/ResponsiveLayout.d.ts +9 -1
- package/lib/components/ResponsiveLayout.js +7 -14
- package/lib/components/ResponsiveLayout.js.map +1 -1
- package/lib/components/SwitchErrorInfo.js +15 -12
- package/lib/components/SwitchErrorInfo.js.map +1 -1
- package/lib/components/components.d.ts +18 -6
- package/lib/components/components.js +24 -12
- package/lib/components/components.js.map +1 -1
- package/lib/components/index.d.ts +4 -10
- package/lib/components/index.js +5 -11
- package/lib/components/index.js.map +1 -1
- package/lib/components/wrapComponent.d.ts +7 -0
- package/lib/components/wrapComponent.js +46 -0
- package/lib/components/wrapComponent.js.map +1 -0
- package/lib/createInstance.d.ts +2 -2
- package/lib/createInstance.js +40 -36
- package/lib/createInstance.js.map +1 -1
- package/lib/defaults/DefaultErrorInfo.js +14 -0
- package/lib/defaults/DefaultErrorInfo.js.map +1 -0
- package/lib/{components → defaults}/DefaultLayout.js +3 -5
- package/lib/defaults/DefaultLayout.js.map +1 -0
- package/lib/{components/DefaultLoader.js → defaults/DefaultLoadingIndicator.js} +4 -3
- package/lib/defaults/DefaultLoadingIndicator.js.map +1 -0
- package/lib/defaults/DefaultRouteSwitch_v5.d.ts +3 -0
- package/lib/defaults/DefaultRouteSwitch_v5.js +15 -0
- package/lib/defaults/DefaultRouteSwitch_v5.js.map +1 -0
- package/lib/defaults/DefaultRouteSwitch_v6.d.ts +3 -0
- package/lib/defaults/DefaultRouteSwitch_v6.js +19 -0
- package/lib/defaults/DefaultRouteSwitch_v6.js.map +1 -0
- package/lib/defaults/DefaultRouter_v5.d.ts +3 -0
- package/lib/defaults/DefaultRouter_v5.js +11 -0
- package/lib/defaults/DefaultRouter_v5.js.map +1 -0
- package/lib/defaults/DefaultRouter_v6.d.ts +3 -0
- package/lib/defaults/DefaultRouter_v6.js +11 -0
- package/lib/defaults/DefaultRouter_v6.js.map +1 -0
- package/lib/defaults/navigator_none.d.ts +5 -0
- package/lib/defaults/navigator_none.js +37 -0
- package/lib/defaults/navigator_none.js.map +1 -0
- package/lib/defaults/navigator_v5.d.ts +6 -0
- package/lib/defaults/navigator_v5.js +88 -0
- package/lib/defaults/navigator_v5.js.map +1 -0
- package/lib/defaults/navigator_v6.d.ts +6 -0
- package/lib/defaults/navigator_v6.js +84 -0
- package/lib/defaults/navigator_v6.js.map +1 -0
- package/lib/helpers.d.ts +12 -26
- package/lib/helpers.js +15 -75
- package/lib/helpers.js.map +1 -1
- package/lib/hooks/action.js +2 -3
- package/lib/hooks/action.js.map +1 -1
- package/lib/hooks/actions.js +4 -4
- package/lib/hooks/actions.js.map +1 -1
- package/lib/hooks/globalState.d.ts +7 -0
- package/lib/hooks/globalState.js +14 -11
- package/lib/hooks/globalState.js.map +1 -1
- package/lib/hooks/index.d.ts +2 -5
- package/lib/hooks/index.js +3 -6
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/media.js +10 -9
- package/lib/hooks/media.js.map +1 -1
- package/lib/hooks/piletApi.d.ts +7 -0
- package/lib/hooks/piletApi.js +18 -0
- package/lib/hooks/piletApi.js.map +1 -0
- package/lib/hooks/routes.d.ts +2 -0
- package/lib/hooks/routes.js +15 -0
- package/lib/hooks/routes.js.map +1 -0
- package/lib/hooks/setter.js +4 -3
- package/lib/hooks/setter.js.map +1 -1
- package/lib/hooks/sharedData.js +3 -3
- package/lib/hooks/sharedData.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/modules/api.d.ts +2 -5
- package/lib/modules/api.js +12 -74
- package/lib/modules/api.js.map +1 -1
- package/lib/modules/core.d.ts +3 -0
- package/lib/modules/core.js +54 -0
- package/lib/modules/core.js.map +1 -0
- package/lib/modules/dependencies.d.ts +5 -6
- package/lib/modules/dependencies.js +12 -27
- package/lib/modules/dependencies.js.map +1 -1
- package/lib/modules/element.d.ts +5 -0
- package/lib/modules/element.js +173 -0
- package/lib/modules/element.js.map +1 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -1
- package/lib/modules/index.js.map +1 -1
- package/lib/setters/SetComponent.js +15 -0
- package/lib/setters/SetComponent.js.map +1 -0
- package/lib/setters/SetError.js +15 -0
- package/lib/setters/SetError.js.map +1 -0
- package/lib/setters/SetErrors.js +13 -0
- package/lib/setters/SetErrors.js.map +1 -0
- package/lib/setters/SetLayout.js +13 -0
- package/lib/setters/SetLayout.js.map +1 -0
- package/lib/{components → setters}/SetProvider.js +4 -5
- package/lib/setters/SetProvider.js.map +1 -0
- package/lib/setters/SetRedirect.js +16 -0
- package/lib/setters/SetRedirect.js.map +1 -0
- package/{esm/components → lib/setters}/SetRoute.d.ts +6 -2
- package/lib/setters/SetRoute.js +15 -0
- package/lib/setters/SetRoute.js.map +1 -0
- package/lib/setters/index.d.ts +7 -0
- package/lib/setters/index.js +11 -0
- package/lib/setters/index.js.map +1 -0
- package/lib/state/createActions.d.ts +2 -2
- package/lib/state/createActions.js +9 -13
- package/lib/state/createActions.js.map +1 -1
- package/lib/state/createGlobalState.d.ts +1 -2
- package/lib/state/createGlobalState.js +9 -34
- package/lib/state/createGlobalState.js.map +1 -1
- package/lib/state/index.js +1 -1
- package/lib/state/stateContext.js +1 -1
- package/lib/state/stateContext.js.map +1 -1
- package/lib/state/withApi.d.ts +1 -1
- package/lib/state/withApi.js +20 -105
- package/lib/state/withApi.js.map +1 -1
- package/lib/tools/codegen.d.ts +21 -0
- package/lib/tools/codegen.js +152 -0
- package/lib/tools/codegen.js.map +1 -0
- package/lib/tools/debugger.d.ts +4 -0
- package/lib/tools/debugger.js +58 -0
- package/lib/tools/debugger.js.map +1 -0
- package/lib/tools/emulator.d.ts +3 -0
- package/lib/tools/emulator.js +15 -0
- package/lib/tools/emulator.js.map +1 -0
- package/lib/types/api.d.ts +37 -10
- package/lib/types/common.d.ts +11 -11
- package/lib/types/components.d.ts +74 -8
- package/lib/types/config.d.ts +24 -17
- package/lib/types/data.d.ts +2 -2
- package/lib/types/extension.d.ts +31 -4
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +2 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/instance.d.ts +26 -4
- package/lib/types/layout.d.ts +3 -3
- package/lib/types/navigation.d.ts +94 -0
- package/lib/types/navigation.js +3 -0
- package/lib/types/navigation.js.map +1 -0
- package/lib/types/plugin.d.ts +1 -14
- package/lib/types/state.d.ts +66 -27
- package/lib/types/utils.d.ts +1 -1
- package/lib/utils/compare.d.ts +1 -1
- package/lib/utils/compare.js +26 -9
- package/lib/utils/compare.js.map +1 -1
- package/lib/utils/data.js +6 -7
- package/lib/utils/data.js.map +1 -1
- package/lib/utils/extension.d.ts +16 -0
- package/lib/utils/extension.js +42 -0
- package/lib/utils/extension.js.map +1 -0
- package/lib/utils/foreign.d.ts +7 -2
- package/lib/utils/foreign.js +25 -12
- package/lib/utils/foreign.js.map +1 -1
- package/lib/utils/guid.js +3 -3
- package/lib/utils/guid.js.map +1 -1
- package/lib/utils/helpers.d.ts +11 -8
- package/lib/utils/helpers.js +31 -18
- package/lib/utils/helpers.js.map +1 -1
- package/lib/utils/index.d.ts +3 -1
- package/lib/utils/index.js +7 -2
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/media.js +7 -7
- package/lib/utils/media.js.map +1 -1
- package/lib/utils/react.js +1 -1
- package/lib/utils/react.js.map +1 -1
- package/lib/utils/state.d.ts +57 -0
- package/lib/utils/state.js +94 -0
- package/lib/utils/state.js.map +1 -0
- package/lib/utils/storage.js +11 -12
- package/lib/utils/storage.js.map +1 -1
- package/package.json +55 -18
- package/src/Piral.test.tsx +7 -16
- package/src/Piral.tsx +12 -11
- package/src/PiralContext.tsx +43 -0
- package/src/RootListener.test.tsx +46 -0
- package/src/RootListener.tsx +26 -0
- package/src/actions/app.test.ts +114 -44
- package/src/actions/app.ts +33 -23
- package/src/actions/components.test.ts +11 -11
- package/src/actions/components.ts +5 -33
- package/src/actions/data.test.ts +50 -50
- package/src/actions/define.test.ts +2 -2
- package/src/actions/portal.test.ts +62 -17
- package/src/actions/portal.ts +19 -1
- package/src/actions/state.test.ts +3 -3
- package/src/actions/state.ts +8 -4
- package/src/components/ErrorBoundary.tsx +22 -49
- package/src/components/ExtensionSlot.test.tsx +115 -30
- package/src/components/ExtensionSlot.tsx +57 -18
- package/src/components/ForeignComponentContainer.test.tsx +100 -0
- package/src/components/ForeignComponentContainer.tsx +63 -0
- package/src/components/Mediator.test.tsx +16 -14
- package/src/components/Mediator.tsx +17 -9
- package/src/components/PiralGlobals.tsx +16 -0
- package/src/components/PiralRoutes.test.tsx +65 -57
- package/src/components/PiralRoutes.tsx +10 -17
- package/src/components/PiralSuspense.tsx +19 -0
- package/src/components/PiralView-server.test.tsx +61 -0
- package/src/components/PiralView.test.tsx +27 -26
- package/src/components/PiralView.tsx +28 -35
- package/src/components/PortalRenderer.tsx +12 -0
- package/src/components/ResponsiveLayout.test.tsx +18 -37
- package/src/components/ResponsiveLayout.tsx +18 -15
- package/src/components/SwitchErrorInfo.test.tsx +36 -0
- package/src/components/SwitchErrorInfo.tsx +5 -1
- package/src/components/components.tsx +20 -6
- package/src/components/index.ts +4 -10
- package/src/components/wrapComponent.tsx +74 -0
- package/src/createInstance.test.tsx +10 -0
- package/src/createInstance.tsx +19 -14
- package/src/{components → defaults}/DefaultErrorInfo.test.tsx +15 -18
- package/src/{components → defaults}/DefaultErrorInfo.tsx +2 -3
- package/src/defaults/DefaultLayout.test.tsx +23 -0
- package/src/defaults/DefaultLoadingIndicator.test.tsx +10 -0
- package/src/defaults/DefaultRouteSwitch_v5.tsx +15 -0
- package/src/defaults/DefaultRouteSwitch_v6.tsx +20 -0
- package/src/defaults/DefaultRouter_v5.tsx +8 -0
- package/src/defaults/DefaultRouter_v6.tsx +8 -0
- package/src/defaults/navigator_none.tsx +35 -0
- package/src/defaults/navigator_v5.tsx +99 -0
- package/src/defaults/navigator_v6.tsx +96 -0
- package/src/helpers.test.tsx +30 -49
- package/src/helpers.tsx +31 -108
- package/src/hooks/action.ts +2 -3
- package/src/hooks/globalState.ts +10 -9
- package/src/hooks/index.ts +2 -5
- package/src/hooks/media.ts +2 -1
- package/src/hooks/piletApi.ts +14 -0
- package/src/hooks/routes.ts +14 -0
- package/src/hooks/setter-server.test.ts +22 -0
- package/src/hooks/setter.test.ts +18 -0
- package/src/hooks/setter.ts +2 -1
- package/src/index.tsx +3 -1
- package/src/modules/api.test.ts +15 -26
- package/src/modules/api.ts +3 -65
- package/src/modules/core.test.ts +148 -0
- package/src/modules/core.ts +52 -0
- package/src/modules/dependencies.test.ts +16 -5
- package/src/modules/dependencies.ts +13 -31
- package/src/modules/element-server.test.ts +29 -0
- package/src/modules/element.test.ts +67 -0
- package/src/modules/element.ts +212 -0
- package/src/modules/index.ts +1 -0
- package/src/{components → setters}/SetComponent.test.tsx +9 -8
- package/src/{components → setters}/SetComponent.tsx +2 -2
- package/src/{components → setters}/SetError.test.tsx +9 -8
- package/src/{components → setters}/SetError.tsx +2 -2
- package/src/{components → setters}/SetErrors.test.tsx +9 -8
- package/src/{components → setters}/SetLayout.test.tsx +9 -8
- package/src/{components → setters}/SetProvider.test.tsx +9 -8
- package/src/{components → setters}/SetProvider.tsx +2 -2
- package/src/{components → setters}/SetRedirect.test.tsx +9 -8
- package/src/{components → setters}/SetRedirect.tsx +4 -4
- package/src/{components → setters}/SetRoute.test.tsx +9 -8
- package/src/{components → setters}/SetRoute.tsx +7 -4
- package/src/setters/index.ts +7 -0
- package/src/state/createActions.test.ts +2 -2
- package/src/state/createActions.ts +5 -3
- package/src/state/createGlobalState.test.ts +55 -54
- package/src/state/createGlobalState.ts +4 -28
- package/src/state/withApi.test.tsx +87 -40
- package/src/state/withApi.tsx +31 -165
- package/src/tools/codegen.ts +193 -0
- package/src/tools/debugger.ts +84 -0
- package/src/tools/emulator.ts +13 -0
- package/src/types/api.ts +50 -11
- package/src/types/components.ts +76 -7
- package/src/types/config.ts +23 -17
- package/src/types/extension.ts +38 -5
- package/src/types/index.ts +1 -0
- package/src/types/instance.ts +28 -4
- package/src/types/navigation.ts +101 -0
- package/src/types/plugin.ts +1 -15
- package/src/types/state.ts +65 -25
- package/src/types/utils.ts +1 -1
- package/src/utils/compare.test.ts +15 -15
- package/src/utils/compare.ts +23 -3
- package/src/utils/extension.test.tsx +21 -0
- package/src/utils/extension.tsx +48 -0
- package/src/utils/foreign.test.ts +29 -11
- package/src/utils/foreign.ts +34 -7
- package/src/utils/guid.test.ts +6 -1
- package/src/utils/helpers.test.ts +52 -0
- package/src/utils/helpers.ts +22 -8
- package/src/utils/index.ts +4 -1
- package/src/utils/media-server.test.ts +13 -0
- package/src/utils/media.ts +2 -2
- package/src/utils/state.test.ts +37 -0
- package/src/utils/state.ts +131 -0
- package/dependencies.codegen +0 -9
- package/dependencies.codegen.native.js +0 -2
- package/esm/components/DefaultErrorInfo.js +0 -12
- package/esm/components/DefaultErrorInfo.js.map +0 -1
- package/esm/components/DefaultLayout.js.map +0 -1
- package/esm/components/DefaultLoader.js.map +0 -1
- package/esm/components/SetComponent.js +0 -12
- package/esm/components/SetComponent.js.map +0 -1
- package/esm/components/SetError.js +0 -12
- package/esm/components/SetError.js.map +0 -1
- package/esm/components/SetErrors.js +0 -10
- package/esm/components/SetErrors.js.map +0 -1
- package/esm/components/SetLayout.js +0 -10
- package/esm/components/SetLayout.js.map +0 -1
- package/esm/components/SetProvider.js +0 -12
- package/esm/components/SetProvider.js.map +0 -1
- package/esm/components/SetRedirect.js +0 -14
- package/esm/components/SetRedirect.js.map +0 -1
- package/esm/components/SetRoute.js +0 -12
- package/esm/components/SetRoute.js.map +0 -1
- package/esm/hooks/debounce.d.ts +0 -8
- package/esm/hooks/debounce.js +0 -18
- package/esm/hooks/debounce.js.map +0 -1
- package/esm/hooks/lockBodyScroll.d.ts +0 -6
- package/esm/hooks/lockBodyScroll.js +0 -13
- package/esm/hooks/lockBodyScroll.js.map +0 -1
- package/esm/hooks/onClickOutside.d.ts +0 -8
- package/esm/hooks/onClickOutside.js +0 -23
- package/esm/hooks/onClickOutside.js.map +0 -1
- package/esm/hooks/onScreenVisible.d.ts +0 -11
- package/esm/hooks/onScreenVisible.js +0 -28
- package/esm/hooks/onScreenVisible.js.map +0 -1
- package/esm/hooks/promise.d.ts +0 -13
- package/esm/hooks/promise.js +0 -21
- package/esm/hooks/promise.js.map +0 -1
- package/esm/utils/events.d.ts +0 -3
- package/esm/utils/events.js +0 -35
- package/esm/utils/events.js.map +0 -1
- package/lib/components/DefaultErrorInfo.js +0 -15
- package/lib/components/DefaultErrorInfo.js.map +0 -1
- package/lib/components/DefaultLayout.js.map +0 -1
- package/lib/components/DefaultLoader.js.map +0 -1
- package/lib/components/SetComponent.js +0 -16
- package/lib/components/SetComponent.js.map +0 -1
- package/lib/components/SetError.js +0 -16
- package/lib/components/SetError.js.map +0 -1
- package/lib/components/SetErrors.js +0 -14
- package/lib/components/SetErrors.js.map +0 -1
- package/lib/components/SetLayout.js +0 -14
- package/lib/components/SetLayout.js.map +0 -1
- package/lib/components/SetProvider.js.map +0 -1
- package/lib/components/SetRedirect.js +0 -18
- package/lib/components/SetRedirect.js.map +0 -1
- package/lib/components/SetRoute.js +0 -16
- package/lib/components/SetRoute.js.map +0 -1
- package/lib/hooks/debounce.d.ts +0 -8
- package/lib/hooks/debounce.js +0 -22
- package/lib/hooks/debounce.js.map +0 -1
- package/lib/hooks/lockBodyScroll.d.ts +0 -6
- package/lib/hooks/lockBodyScroll.js +0 -17
- package/lib/hooks/lockBodyScroll.js.map +0 -1
- package/lib/hooks/onClickOutside.d.ts +0 -8
- package/lib/hooks/onClickOutside.js +0 -27
- package/lib/hooks/onClickOutside.js.map +0 -1
- package/lib/hooks/onScreenVisible.d.ts +0 -11
- package/lib/hooks/onScreenVisible.js +0 -32
- package/lib/hooks/onScreenVisible.js.map +0 -1
- package/lib/hooks/promise.d.ts +0 -13
- package/lib/hooks/promise.js +0 -25
- package/lib/hooks/promise.js.map +0 -1
- package/lib/utils/events.d.ts +0 -3
- package/lib/utils/events.js +0 -39
- package/lib/utils/events.js.map +0 -1
- package/src/components/DefaultLayout.test.tsx +0 -23
- package/src/components/DefaultLoader.test.tsx +0 -10
- package/src/hooks/debounce.test.ts +0 -67
- package/src/hooks/debounce.ts +0 -19
- package/src/hooks/globalState.test.ts +0 -47
- package/src/hooks/lockBodyScroll.test.ts +0 -24
- package/src/hooks/lockBodyScroll.ts +0 -13
- package/src/hooks/onClickOutside.test.ts +0 -113
- package/src/hooks/onClickOutside.ts +0 -25
- package/src/hooks/onScreenVisible.test.ts +0 -68
- package/src/hooks/onScreenVisible.ts +0 -28
- package/src/hooks/promise.test.ts +0 -76
- package/src/hooks/promise.ts +0 -35
- package/src/utils/events.test.ts +0 -65
- package/src/utils/events.ts +0 -39
- package/esm/{components → defaults}/DefaultErrorInfo.d.ts +0 -0
- package/esm/{components → defaults}/DefaultLayout.d.ts +0 -0
- package/esm/{components/DefaultLoader.d.ts → defaults/DefaultLoadingIndicator.d.ts} +0 -0
- package/esm/{components → setters}/SetComponent.d.ts +0 -0
- package/esm/{components → setters}/SetError.d.ts +0 -0
- package/esm/{components → setters}/SetErrors.d.ts +0 -0
- package/esm/{components → setters}/SetLayout.d.ts +0 -0
- package/esm/{components → setters}/SetProvider.d.ts +0 -0
- package/esm/{components → setters}/SetRedirect.d.ts +0 -0
- package/lib/{components → defaults}/DefaultErrorInfo.d.ts +0 -0
- package/lib/{components → defaults}/DefaultLayout.d.ts +0 -0
- package/lib/{components/DefaultLoader.d.ts → defaults/DefaultLoadingIndicator.d.ts} +0 -0
- package/lib/{components → setters}/SetComponent.d.ts +0 -0
- package/lib/{components → setters}/SetError.d.ts +0 -0
- package/lib/{components → setters}/SetErrors.d.ts +0 -0
- package/lib/{components → setters}/SetLayout.d.ts +0 -0
- package/lib/{components → setters}/SetProvider.d.ts +0 -0
- package/lib/{components → setters}/SetRedirect.d.ts +0 -0
- package/src/{components → defaults}/DefaultLayout.tsx +1 -1
- /package/src/{components/DefaultLoader.tsx → defaults/DefaultLoadingIndicator.tsx} +0 -0
- /package/src/{components → setters}/SetErrors.tsx +0 -0
- /package/src/{components → setters}/SetLayout.tsx +0 -0
package/esm/utils/media.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isfunc } from 'piral-base';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
?
|
|
6
|
-
:
|
|
7
|
-
export function getCurrentLayout(breakpoints, layouts, defaultLayout) {
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export const defaultLayouts = ['desktop', 'tablet', 'mobile'];
|
|
3
|
+
export const defaultBreakpoints = ['(min-width: 991px)', '(min-width: 481px)', '(max-width: 480px)'];
|
|
4
|
+
const mm = typeof window === 'undefined' || !isfunc(window.matchMedia)
|
|
5
|
+
? () => ({ matches: undefined })
|
|
6
|
+
: (q) => window.matchMedia(q);
|
|
7
|
+
export function getCurrentLayout(breakpoints = defaultBreakpoints, layouts, defaultLayout) {
|
|
8
|
+
const query = breakpoints.findIndex((q) => mm(q).matches);
|
|
9
|
+
const layout = layouts[query];
|
|
10
10
|
return layout !== undefined ? layout : defaultLayout;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=media.js.map
|
package/esm/utils/media.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/utils/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/utils/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC,MAAM,CAAC,MAAM,cAAc,GAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,kBAAkB,GAAsB,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AAExH,MAAM,EAAE,GACN,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;IACzD,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,UAAU,gBAAgB,CAAI,cAA6B,kBAAkB,EAAE,OAAiB,EAAE,aAAgB;IACtH,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { RouteComponentProps } from 'react-router';
|
|
3
|
+
import { GlobalState, PageRegistration, ExtensionRegistration } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Returns a dispatcher that includes all mentioned dispatchers.
|
|
6
|
+
* @param dispatchers The dispatchers to include.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withAll(...dispatchers: Array<(state: GlobalState) => GlobalState>): (state: GlobalState) => GlobalState;
|
|
9
|
+
/**
|
|
10
|
+
* Returns a dispatcher that adds a page registration.
|
|
11
|
+
* @param name The path of the page to register.
|
|
12
|
+
* @param value The value of the page to register.
|
|
13
|
+
* @returns The dispatcher.
|
|
14
|
+
*/
|
|
15
|
+
export declare function withPage(name: string, value: PageRegistration): (state: GlobalState) => GlobalState;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a dispatcher that removes a page registration.
|
|
18
|
+
* @param name The path of the page to unregister.
|
|
19
|
+
* @returns The dispatcher.
|
|
20
|
+
*/
|
|
21
|
+
export declare function withoutPage(name: string): (state: GlobalState) => GlobalState;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a dispatcher that adds an extension registration.
|
|
24
|
+
* @param name The name of the extension to register.
|
|
25
|
+
* @param value The value of the extension to register.
|
|
26
|
+
* @returns The dispatcher.
|
|
27
|
+
*/
|
|
28
|
+
export declare function withExtension(name: string, value: ExtensionRegistration): (state: GlobalState) => GlobalState;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a dispatcher that removes an extension registration.
|
|
31
|
+
* @param name The name of the extension to unregister.
|
|
32
|
+
* @param reference The reference for the extension.
|
|
33
|
+
* @returns The dispatcher.
|
|
34
|
+
*/
|
|
35
|
+
export declare function withoutExtension(name: string, reference: any): (state: GlobalState) => GlobalState;
|
|
36
|
+
/**
|
|
37
|
+
* Returns a dispatcher that adds an extension registration from the root (no Pilet API).
|
|
38
|
+
* @param name The name of the extension to register.
|
|
39
|
+
* @param component The extension's component to use.
|
|
40
|
+
* @returns The dispatcher.
|
|
41
|
+
*/
|
|
42
|
+
export declare function withRootExtension<T>(name: string, component: ComponentType<T>): (state: GlobalState) => GlobalState;
|
|
43
|
+
/**
|
|
44
|
+
* Returns a dispatcher that adds another provider.
|
|
45
|
+
* @param provider The provider to include.
|
|
46
|
+
* @returns The dispatcher.
|
|
47
|
+
*/
|
|
48
|
+
export declare function withProvider(provider: JSX.Element): (state: GlobalState) => GlobalState;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a dispatcher that registers another route.
|
|
51
|
+
* @param path The path of the route to register.
|
|
52
|
+
* @param component The component representing the route.
|
|
53
|
+
* @returns The dispatcher.
|
|
54
|
+
*/
|
|
55
|
+
export declare function withRoute<T extends {
|
|
56
|
+
[K in keyof T]?: string;
|
|
57
|
+
} = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): (state: GlobalState) => GlobalState;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { cloneElement, createElement } from 'react';
|
|
2
|
+
import { toExtension } from './extension';
|
|
3
|
+
import { withKey, withoutKey, appendItem, excludeOn } from './helpers';
|
|
4
|
+
/**
|
|
5
|
+
* Returns a dispatcher that includes all mentioned dispatchers.
|
|
6
|
+
* @param dispatchers The dispatchers to include.
|
|
7
|
+
*/
|
|
8
|
+
export function withAll(...dispatchers) {
|
|
9
|
+
return (state) => {
|
|
10
|
+
for (const dispatcher of dispatchers) {
|
|
11
|
+
state = dispatcher(state);
|
|
12
|
+
}
|
|
13
|
+
return state;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns a dispatcher that adds a page registration.
|
|
18
|
+
* @param name The path of the page to register.
|
|
19
|
+
* @param value The value of the page to register.
|
|
20
|
+
* @returns The dispatcher.
|
|
21
|
+
*/
|
|
22
|
+
export function withPage(name, value) {
|
|
23
|
+
return (state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { pages: withKey(state.registry.pages, name, value) }) }));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns a dispatcher that removes a page registration.
|
|
27
|
+
* @param name The path of the page to unregister.
|
|
28
|
+
* @returns The dispatcher.
|
|
29
|
+
*/
|
|
30
|
+
export function withoutPage(name) {
|
|
31
|
+
return (state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { pages: withoutKey(state.registry.pages, name) }) }));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns a dispatcher that adds an extension registration.
|
|
35
|
+
* @param name The name of the extension to register.
|
|
36
|
+
* @param value The value of the extension to register.
|
|
37
|
+
* @returns The dispatcher.
|
|
38
|
+
*/
|
|
39
|
+
export function withExtension(name, value) {
|
|
40
|
+
return (state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { extensions: withKey(state.registry.extensions, name, appendItem(state.registry.extensions[name], value)) }) }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns a dispatcher that removes an extension registration.
|
|
44
|
+
* @param name The name of the extension to unregister.
|
|
45
|
+
* @param reference The reference for the extension.
|
|
46
|
+
* @returns The dispatcher.
|
|
47
|
+
*/
|
|
48
|
+
export function withoutExtension(name, reference) {
|
|
49
|
+
return (state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { extensions: withKey(state.registry.extensions, name, excludeOn(state.registry.extensions[name], (m) => m.reference === reference)) }) }));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns a dispatcher that adds an extension registration from the root (no Pilet API).
|
|
53
|
+
* @param name The name of the extension to register.
|
|
54
|
+
* @param component The extension's component to use.
|
|
55
|
+
* @returns The dispatcher.
|
|
56
|
+
*/
|
|
57
|
+
export function withRootExtension(name, component) {
|
|
58
|
+
return withExtension(name, {
|
|
59
|
+
component: toExtension(component),
|
|
60
|
+
defaults: {},
|
|
61
|
+
pilet: '',
|
|
62
|
+
reference: component,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns a dispatcher that adds another provider.
|
|
67
|
+
* @param provider The provider to include.
|
|
68
|
+
* @returns The dispatcher.
|
|
69
|
+
*/
|
|
70
|
+
export function withProvider(provider) {
|
|
71
|
+
const wrapper = (props) => cloneElement(provider, props);
|
|
72
|
+
return (state) => (Object.assign(Object.assign({}, state), { provider: !state.provider ? wrapper : (props) => createElement(state.provider, undefined, wrapper(props)) }));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Returns a dispatcher that registers another route.
|
|
76
|
+
* @param path The path of the route to register.
|
|
77
|
+
* @param component The component representing the route.
|
|
78
|
+
* @returns The dispatcher.
|
|
79
|
+
*/
|
|
80
|
+
export function withRoute(path, component) {
|
|
81
|
+
return (state) => (Object.assign(Object.assign({}, state), { routes: withKey(state.routes, path, component) }));
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/utils/state.ts"],"names":[],"mappings":"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"}
|
package/esm/utils/storage.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
setItem
|
|
1
|
+
const crx = /\s*(.*?)=(.*?)($|;|,(?! ))/g;
|
|
2
|
+
export const storage = {
|
|
3
|
+
setItem(name, data) {
|
|
4
4
|
return localStorage.setItem(name, data);
|
|
5
5
|
},
|
|
6
|
-
getItem
|
|
6
|
+
getItem(name) {
|
|
7
7
|
return localStorage.getItem(name);
|
|
8
8
|
},
|
|
9
|
-
removeItem
|
|
9
|
+
removeItem(name) {
|
|
10
10
|
return localStorage.removeItem(name);
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
setItem
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
document.cookie = name + "=" + encodeURIComponent(data) + ";expires=\"" + expires + "\";path=/;" + domainPart;
|
|
13
|
+
export const cookie = {
|
|
14
|
+
setItem(name, data, expires = '') {
|
|
15
|
+
const domain = location.hostname;
|
|
16
|
+
const domainPart = domain ? `domain=.${domain};` : '';
|
|
17
|
+
document.cookie = `${name}=${encodeURIComponent(data)};expires="${expires}";path=/;${domainPart}`;
|
|
19
18
|
},
|
|
20
|
-
getItem
|
|
21
|
-
return document.cookie.replace(crx,
|
|
19
|
+
getItem(name) {
|
|
20
|
+
return document.cookie.replace(crx, (_m, p1, p2) => (name === p1 ? p2 : ''));
|
|
22
21
|
},
|
|
23
|
-
removeItem
|
|
22
|
+
removeItem(name) {
|
|
24
23
|
this.setItem(name, '', '-1');
|
|
25
24
|
},
|
|
26
25
|
};
|
package/esm/utils/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/utils/storage.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/utils/storage.ts"],"names":[],"mappings":"AAEA,MAAM,GAAG,GAAG,6BAA6B,CAAC;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAiB;IACnC,OAAO,CAAC,IAAY,EAAE,IAAY;QAChC,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,CAAC,IAAY;QAClB,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,UAAU,CAAC,IAAY;QACrB,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,OAAO,CAAC,IAAY,EAAE,IAAY,EAAE,OAAO,GAAG,EAAE;QAC9C,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACjC,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,IAAI,kBAAkB,CAAC,IAAI,CAAC,aAAa,OAAO,YAAY,UAAU,EAAE,CAAC;IACpG,CAAC;IACD,OAAO,CAAC,IAAY;QAClB,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAO,EAAE,EAAU,EAAE,EAAU,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpG,CAAC;IACD,UAAU,CAAC,IAAY;QACrB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF,CAAC"}
|
package/lib/Piral.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PiralProps } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Represents the Piral app shell frame. Use this component together
|
|
5
5
|
* with an existing instance to render the app shell.
|
|
6
|
-
* Includes layout and routing handling.
|
|
7
|
-
* to the generated views.
|
|
6
|
+
* Includes layout and routing handling. Connects the Piral context
|
|
7
|
+
* and the React router to the generated views.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
```jsx
|
|
@@ -15,4 +15,4 @@ const app = (
|
|
|
15
15
|
);
|
|
16
16
|
```
|
|
17
17
|
*/
|
|
18
|
-
export declare const Piral: React.FC<
|
|
18
|
+
export declare const Piral: React.FC<PiralProps>;
|
package/lib/Piral.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Piral = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const createInstance_1 = require("./createInstance");
|
|
6
|
+
const components_1 = require("./components");
|
|
7
|
+
const PiralContext_1 = require("./PiralContext");
|
|
8
|
+
const app_codegen_1 = require("../app.codegen");
|
|
8
9
|
/**
|
|
9
10
|
* Represents the Piral app shell frame. Use this component together
|
|
10
11
|
* with an existing instance to render the app shell.
|
|
11
|
-
* Includes layout and routing handling.
|
|
12
|
-
* to the generated views.
|
|
12
|
+
* Includes layout and routing handling. Connects the Piral context
|
|
13
|
+
* and the React router to the generated views.
|
|
13
14
|
*
|
|
14
15
|
* @example
|
|
15
16
|
```jsx
|
|
@@ -20,12 +21,9 @@ const app = (
|
|
|
20
21
|
);
|
|
21
22
|
```
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
React.createElement(components_1.Mediator, { options: instance.options }),
|
|
28
|
-
React.createElement(components_1.PiralView, null, children)));
|
|
29
|
-
};
|
|
24
|
+
const Piral = ({ instance = (0, createInstance_1.createInstance)(), breakpoints, children }) => (React.createElement(PiralContext_1.PiralContext, { instance: instance },
|
|
25
|
+
React.createElement(components_1.RegisteredRouter, { publicPath: app_codegen_1.publicPath },
|
|
26
|
+
React.createElement(components_1.PiralView, { breakpoints: breakpoints }, children))));
|
|
27
|
+
exports.Piral = Piral;
|
|
30
28
|
exports.Piral.displayName = 'Piral';
|
|
31
29
|
//# sourceMappingURL=Piral.js.map
|
package/lib/Piral.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"Piral.js","sourceRoot":"","sources":["../src/Piral.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,qDAAkD;AAClD,6CAA2D;AAC3D,iDAA8C;AAC9C,gDAA4C;AAG5C;;;;;;;;;;;;;;GAcG;AACI,MAAM,KAAK,GAAyB,CAAC,EAAE,QAAQ,GAAG,IAAA,+BAAc,GAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACrG,oBAAC,2BAAY,IAAC,QAAQ,EAAE,QAAQ;IAC9B,oBAAC,6BAAgB,IAAC,UAAU,EAAE,wBAAU;QACtC,oBAAC,sBAAS,IAAC,WAAW,EAAE,WAAW,IAAG,QAAQ,CAAa,CAC1C,CACN,CAChB,CAAC;AANW,QAAA,KAAK,SAMhB;AACF,aAAK,CAAC,WAAW,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PiralContextProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the Piral app shell frame. Use this component together
|
|
5
|
+
* with an existing instance to render components from micro frontends
|
|
6
|
+
* in your app.
|
|
7
|
+
* Wires the state container together with the global providers.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
```jsx
|
|
11
|
+
const app = (
|
|
12
|
+
<MyRouter>
|
|
13
|
+
<PiralContext instance={yourPiralInstance}>
|
|
14
|
+
<PiralGlobals />
|
|
15
|
+
<MyAppContent />
|
|
16
|
+
</PiralContext>
|
|
17
|
+
</MyRouter>
|
|
18
|
+
);
|
|
19
|
+
```
|
|
20
|
+
*/
|
|
21
|
+
export declare const PiralContext: React.FC<PiralContextProps>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PiralContext = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const state_1 = require("./state");
|
|
6
|
+
const createInstance_1 = require("./createInstance");
|
|
7
|
+
const components_1 = require("./components");
|
|
8
|
+
const hooks_1 = require("./hooks");
|
|
9
|
+
const RootListener_1 = require("./RootListener");
|
|
10
|
+
const PiralProvider = ({ children }) => {
|
|
11
|
+
const Provider = (0, hooks_1.useGlobalState)((m) => m.provider || React.Fragment);
|
|
12
|
+
return React.createElement(Provider, null, children);
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Represents the Piral app shell frame. Use this component together
|
|
16
|
+
* with an existing instance to render components from micro frontends
|
|
17
|
+
* in your app.
|
|
18
|
+
* Wires the state container together with the global providers.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
```jsx
|
|
22
|
+
const app = (
|
|
23
|
+
<MyRouter>
|
|
24
|
+
<PiralContext instance={yourPiralInstance}>
|
|
25
|
+
<PiralGlobals />
|
|
26
|
+
<MyAppContent />
|
|
27
|
+
</PiralContext>
|
|
28
|
+
</MyRouter>
|
|
29
|
+
);
|
|
30
|
+
```
|
|
31
|
+
*/
|
|
32
|
+
const PiralContext = ({ instance = (0, createInstance_1.createInstance)(), children }) => (React.createElement(state_1.StateContext.Provider, { value: instance.context },
|
|
33
|
+
React.createElement(components_1.Mediator, { options: instance.options, key: instance.id }),
|
|
34
|
+
React.createElement(RootListener_1.RootListener, null),
|
|
35
|
+
React.createElement(PiralProvider, null, children)));
|
|
36
|
+
exports.PiralContext = PiralContext;
|
|
37
|
+
exports.PiralContext.displayName = 'PiralContext';
|
|
38
|
+
//# sourceMappingURL=PiralContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiralContext.js","sourceRoot":"","sources":["../src/PiralContext.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,mCAAuC;AACvC,qDAAkD;AAClD,6CAAwC;AACxC,mCAAyC;AACzC,iDAA8C;AAO9C,MAAM,aAAa,GAAiC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnE,MAAM,QAAQ,GAAG,IAAA,sBAAc,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrE,OAAO,oBAAC,QAAQ,QAAE,QAAQ,CAAY,CAAC;AACzC,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,YAAY,GAAgC,CAAC,EAAE,QAAQ,GAAG,IAAA,+BAAc,GAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACtG,oBAAC,oBAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,CAAC,OAAO;IAC5C,oBAAC,qBAAQ,IAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAI;IACzD,oBAAC,2BAAY,OAAG;IAChB,oBAAC,aAAa,QAAE,QAAQ,CAAiB,CACnB,CACzB,CAAC;AANW,QAAA,YAAY,gBAMvB;AACF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RootListener = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const hooks_1 = require("./hooks");
|
|
6
|
+
const modules_1 = require("./modules");
|
|
7
|
+
const RootListener = () => {
|
|
8
|
+
const context = (0, hooks_1.useGlobalStateContext)();
|
|
9
|
+
React.useLayoutEffect(() => {
|
|
10
|
+
if (typeof document !== 'undefined') {
|
|
11
|
+
const handler = (ev) => {
|
|
12
|
+
ev.stopPropagation();
|
|
13
|
+
const { target, props } = ev.detail;
|
|
14
|
+
const [dispose, update] = (0, modules_1.renderElement)(context, target, props);
|
|
15
|
+
target.dispose = dispose;
|
|
16
|
+
target.update = update;
|
|
17
|
+
};
|
|
18
|
+
document.body.addEventListener('render-html', handler, false);
|
|
19
|
+
return () => {
|
|
20
|
+
document.body.removeEventListener('render-html', handler, false);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}, [context]);
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
exports.RootListener = RootListener;
|
|
27
|
+
//# sourceMappingURL=RootListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootListener.js","sourceRoot":"","sources":["../src/RootListener.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,mCAAgD;AAChD,uCAA0C;AAEnC,MAAM,YAAY,GAAa,GAAG,EAAE;IACzC,MAAM,OAAO,GAAG,IAAA,6BAAqB,GAAE,CAAC;IAExC,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE;QACzB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACnC,MAAM,OAAO,GAAG,CAAC,EAAe,EAAE,EAAE;gBAClC,EAAE,CAAC,eAAe,EAAE,CAAC;gBACrB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;gBACpC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,IAAA,uBAAa,EAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;gBAChE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;gBACzB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;YACzB,CAAC,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAE9D,OAAO,GAAG,EAAE;gBACV,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YACnE,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AArBW,QAAA,YAAY,gBAqBvB"}
|
package/lib/actions/app.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { RouteComponentProps } from 'react-router';
|
|
3
|
-
import {
|
|
4
|
-
export declare function changeLayout(ctx: GlobalStateContext, current: LayoutType): void;
|
|
3
|
+
import { ComponentsState, ErrorComponentsState, GlobalStateContext, Pilet, PiletEntry } from '../types';
|
|
5
4
|
export declare function initialize(ctx: GlobalStateContext, loading: boolean, error: Error | undefined, modules: Array<Pilet>): void;
|
|
6
|
-
export declare function
|
|
5
|
+
export declare function addPilet(ctx: GlobalStateContext, meta: PiletEntry): Promise<void>;
|
|
6
|
+
export declare function removePilet(ctx: GlobalStateContext, name: string): Promise<void>;
|
|
7
|
+
export declare function injectPilet(ctx: GlobalStateContext, pilet: Pilet): Pilet;
|
|
7
8
|
export declare function setComponent<TKey extends keyof ComponentsState>(ctx: GlobalStateContext, name: TKey, component: ComponentsState[TKey]): void;
|
|
8
9
|
export declare function setErrorComponent<TKey extends keyof ErrorComponentsState>(ctx: GlobalStateContext, type: TKey, component: ErrorComponentsState[TKey]): void;
|
|
9
|
-
export declare function setRoute<T
|
|
10
|
+
export declare function setRoute<T extends {
|
|
11
|
+
[K in keyof T]?: string;
|
|
12
|
+
} = {}>(ctx: GlobalStateContext, path: string, component: ComponentType<RouteComponentProps<T>>): void;
|
|
10
13
|
export declare function includeProvider(ctx: GlobalStateContext, provider: JSX.Element): void;
|
package/lib/actions/app.js
CHANGED
|
@@ -1,40 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.includeProvider = exports.setRoute = exports.setErrorComponent = exports.setComponent = exports.injectPilet = exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var utils_1 = require("../utils");
|
|
7
|
-
function changeLayout(ctx, current) {
|
|
8
|
-
ctx.dispatch(function (state) { return (tslib_1.__assign(tslib_1.__assign({}, state), { app: utils_1.withKey(state.app, 'layout', current) })); });
|
|
9
|
-
}
|
|
10
|
-
exports.changeLayout = changeLayout;
|
|
3
|
+
exports.includeProvider = exports.setRoute = exports.setErrorComponent = exports.setComponent = exports.injectPilet = exports.removePilet = exports.addPilet = exports.initialize = void 0;
|
|
4
|
+
const piral_base_1 = require("piral-base");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
11
6
|
function initialize(ctx, loading, error, modules) {
|
|
12
|
-
ctx.dispatch(
|
|
13
|
-
loading
|
|
7
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { app: Object.assign(Object.assign({}, state.app), { error,
|
|
8
|
+
loading }), modules })));
|
|
14
9
|
}
|
|
15
10
|
exports.initialize = initialize;
|
|
11
|
+
function addPilet(ctx, meta) {
|
|
12
|
+
return ctx.options
|
|
13
|
+
.loadPilet(meta)
|
|
14
|
+
.then((pilet) => ctx.injectPilet(pilet))
|
|
15
|
+
.then((pilet) => (0, piral_base_1.runPilet)(ctx.options.createApi, pilet, ctx.options.hooks))
|
|
16
|
+
.then(utils_1.noop);
|
|
17
|
+
}
|
|
18
|
+
exports.addPilet = addPilet;
|
|
19
|
+
function removePilet(ctx, name) {
|
|
20
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { modules: state.modules.filter((m) => m.name !== name), registry: (0, utils_1.removeNested)(state.registry, (m) => m.pilet === name) })));
|
|
21
|
+
ctx.emit('unload-pilet', {
|
|
22
|
+
name,
|
|
23
|
+
});
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
}
|
|
26
|
+
exports.removePilet = removePilet;
|
|
16
27
|
function injectPilet(ctx, pilet) {
|
|
17
|
-
ctx.dispatch(
|
|
28
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { modules: (0, utils_1.replaceOrAddItem)(state.modules, pilet, (m) => m.name === pilet.name), registry: (0, utils_1.removeNested)(state.registry, (m) => m.pilet === pilet.name) })));
|
|
18
29
|
ctx.emit('unload-pilet', {
|
|
19
30
|
name: pilet.name,
|
|
20
31
|
});
|
|
32
|
+
return pilet;
|
|
21
33
|
}
|
|
22
34
|
exports.injectPilet = injectPilet;
|
|
23
35
|
function setComponent(ctx, name, component) {
|
|
24
|
-
ctx.dispatch(
|
|
36
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { components: (0, utils_1.withKey)(state.components, name, component) })));
|
|
25
37
|
}
|
|
26
38
|
exports.setComponent = setComponent;
|
|
27
39
|
function setErrorComponent(ctx, type, component) {
|
|
28
|
-
ctx.dispatch(
|
|
40
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { errorComponents: (0, utils_1.withKey)(state.errorComponents, type, component) })));
|
|
29
41
|
}
|
|
30
42
|
exports.setErrorComponent = setErrorComponent;
|
|
31
43
|
function setRoute(ctx, path, component) {
|
|
32
|
-
ctx.dispatch(
|
|
44
|
+
ctx.dispatch((0, utils_1.withRoute)(path, component));
|
|
33
45
|
}
|
|
34
46
|
exports.setRoute = setRoute;
|
|
35
47
|
function includeProvider(ctx, provider) {
|
|
36
|
-
|
|
37
|
-
ctx.dispatch(function (state) { return (tslib_1.__assign(tslib_1.__assign({}, state), { provider: !state.provider ? wrapper : function (props) { return react_1.createElement(state.provider, undefined, wrapper(props)); } })); });
|
|
48
|
+
ctx.dispatch((0, utils_1.withProvider)(provider));
|
|
38
49
|
}
|
|
39
50
|
exports.includeProvider = includeProvider;
|
|
40
51
|
//# sourceMappingURL=app.js.map
|
package/lib/actions/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/actions/app.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.unregisterExtension = exports.registerExtension = exports.unregisterPage = exports.registerPage = void 0;
|
|
4
|
-
|
|
5
|
-
var utils_1 = require("../utils");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
6
5
|
function registerPage(ctx, name, value) {
|
|
7
|
-
ctx.dispatch(
|
|
6
|
+
ctx.dispatch((0, utils_1.withPage)(name, value));
|
|
8
7
|
}
|
|
9
8
|
exports.registerPage = registerPage;
|
|
10
9
|
function unregisterPage(ctx, name) {
|
|
11
|
-
ctx.dispatch(
|
|
10
|
+
ctx.dispatch((0, utils_1.withoutPage)(name));
|
|
12
11
|
}
|
|
13
12
|
exports.unregisterPage = unregisterPage;
|
|
14
13
|
function registerExtension(ctx, name, value) {
|
|
15
|
-
ctx.dispatch(
|
|
14
|
+
ctx.dispatch((0, utils_1.withExtension)(name, value));
|
|
16
15
|
}
|
|
17
16
|
exports.registerExtension = registerExtension;
|
|
18
17
|
function unregisterExtension(ctx, name, reference) {
|
|
19
|
-
ctx.dispatch(
|
|
18
|
+
ctx.dispatch((0, utils_1.withoutExtension)(name, reference));
|
|
20
19
|
}
|
|
21
20
|
exports.unregisterExtension = unregisterExtension;
|
|
22
21
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/actions/components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/actions/components.ts"],"names":[],"mappings":";;;AAAA,oCAAkF;AAGlF,SAAgB,YAAY,CAAC,GAAuB,EAAE,IAAY,EAAE,KAAuB;IACzF,GAAG,CAAC,QAAQ,CAAC,IAAA,gBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACtC,CAAC;AAFD,oCAEC;AAED,SAAgB,cAAc,CAAC,GAAuB,EAAE,IAAY;IAClE,GAAG,CAAC,QAAQ,CAAC,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;AAClC,CAAC;AAFD,wCAEC;AAED,SAAgB,iBAAiB,CAAC,GAAuB,EAAE,IAAY,EAAE,KAA4B;IACnG,GAAG,CAAC,QAAQ,CAAC,IAAA,qBAAa,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC;AAFD,8CAEC;AAED,SAAgB,mBAAmB,CAAC,GAAuB,EAAE,IAAY,EAAE,SAAc;IACvF,GAAG,CAAC,QAAQ,CAAC,IAAA,wBAAgB,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AAClD,CAAC;AAFD,kDAEC"}
|
package/lib/actions/data.js
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryWriteDataItem = exports.writeDataItem = exports.readDataValue = exports.readDataItem = exports.resetData = void 0;
|
|
4
|
-
|
|
5
|
-
var utils_1 = require("../utils");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
6
5
|
function resetData(ctx) {
|
|
7
|
-
ctx.dispatch(
|
|
6
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { data: {} })));
|
|
8
7
|
}
|
|
9
8
|
exports.resetData = resetData;
|
|
10
9
|
function readDataItem(ctx, key) {
|
|
11
|
-
return ctx.readState(
|
|
10
|
+
return ctx.readState((state) => state.data[key]);
|
|
12
11
|
}
|
|
13
12
|
exports.readDataItem = readDataItem;
|
|
14
13
|
function readDataValue(ctx, key) {
|
|
15
|
-
|
|
14
|
+
const item = readDataItem(ctx, key);
|
|
16
15
|
return item && item.value;
|
|
17
16
|
}
|
|
18
17
|
exports.readDataValue = readDataValue;
|
|
19
18
|
function writeDataItem(ctx, key, value, owner, target, expires) {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const isNull = !value && typeof value === 'object';
|
|
20
|
+
const data = isNull
|
|
22
21
|
? value
|
|
23
22
|
: {
|
|
24
|
-
value
|
|
25
|
-
owner
|
|
26
|
-
target
|
|
27
|
-
expires
|
|
23
|
+
value,
|
|
24
|
+
owner,
|
|
25
|
+
target,
|
|
26
|
+
expires,
|
|
28
27
|
};
|
|
29
|
-
ctx.dispatch(
|
|
28
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { data: (0, utils_1.updateKey)(state.data, key, data) })));
|
|
30
29
|
ctx.emit('store-data', {
|
|
31
30
|
name: key,
|
|
32
|
-
target
|
|
33
|
-
value
|
|
34
|
-
owner
|
|
35
|
-
expires
|
|
31
|
+
target,
|
|
32
|
+
value,
|
|
33
|
+
owner,
|
|
34
|
+
expires,
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
37
|
exports.writeDataItem = writeDataItem;
|
|
39
38
|
function tryWriteDataItem(ctx, key, value, owner, target, expires) {
|
|
40
|
-
|
|
39
|
+
const item = readDataItem(ctx, key);
|
|
41
40
|
if (item && item.owner !== owner) {
|
|
42
|
-
console.error(
|
|
41
|
+
console.error(`Invalid data write to '${key}'. This item currently belongs to '${item.owner}' (write attempted from '${owner}'). The action has been ignored.`);
|
|
43
42
|
return false;
|
|
44
43
|
}
|
|
45
44
|
writeDataItem(ctx, key, value, owner, target, expires);
|
package/lib/actions/data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/actions/data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/actions/data.ts"],"names":[],"mappings":";;;AAAA,oCAAqC;AAGrC,SAAgB,SAAS,CAAC,GAAuB;IAC/C,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,IAAI,EAAE,EAAE,IACR,CAAC,CAAC;AACN,CAAC;AALD,8BAKC;AAED,SAAgB,YAAY,CAAC,GAAuB,EAAE,GAAW;IAC/D,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACnD,CAAC;AAFD,oCAEC;AAED,SAAgB,aAAa,CAAC,GAAuB,EAAE,GAAW;IAChE,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACpC,OAAO,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC;AAC5B,CAAC;AAHD,sCAGC;AAED,SAAgB,aAAa,CAC3B,GAAuB,EACvB,GAAW,EACX,KAAU,EACV,KAAa,EACb,MAAuB,EACvB,OAAe;IAEf,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;IACnD,MAAM,IAAI,GAAG,MAAM;QACjB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC;YACE,KAAK;YACL,KAAK;YACL,MAAM;YACN,OAAO;SACR,CAAC;IACN,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,IAAI,EAAE,IAAA,iBAAS,EAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,IACtC,CAAC,CAAC;IAEJ,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE;QACrB,IAAI,EAAE,GAAG;QACT,MAAM;QACN,KAAK;QACL,KAAK;QACL,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AA7BD,sCA6BC;AAED,SAAgB,gBAAgB,CAC9B,GAAuB,EACvB,GAAW,EACX,KAAU,EACV,KAAa,EACb,MAAuB,EACvB,OAAe;IAEf,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAEpC,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE;QAChC,OAAO,CAAC,KAAK,CACX,0BAA0B,GAAG,sCAAsC,IAAI,CAAC,KAAK,4BAA4B,KAAK,kCAAkC,CACjJ,CAAC;QACF,OAAO,KAAK,CAAC;KACd;IAED,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,IAAI,CAAC;AACd,CAAC;AAnBD,4CAmBC"}
|