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
package/esm/utils/events.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
function nameOf(type) {
|
|
2
|
-
return "piral-" + type;
|
|
3
|
-
}
|
|
4
|
-
export function createListener(state) {
|
|
5
|
-
var eventListeners = [];
|
|
6
|
-
return {
|
|
7
|
-
on: function (type, callback) {
|
|
8
|
-
var listener = function (_a) {
|
|
9
|
-
var detail = _a.detail;
|
|
10
|
-
return detail && detail.state === state && callback(detail.arg);
|
|
11
|
-
};
|
|
12
|
-
document.body.addEventListener(nameOf(type), listener);
|
|
13
|
-
eventListeners.push([callback, listener]);
|
|
14
|
-
return this;
|
|
15
|
-
},
|
|
16
|
-
off: function (type, callback) {
|
|
17
|
-
var listener = eventListeners.filter(function (m) { return m[0] === callback; })[0];
|
|
18
|
-
if (listener) {
|
|
19
|
-
document.body.removeEventListener(nameOf(type), listener[1]);
|
|
20
|
-
eventListeners.splice(eventListeners.indexOf(listener), 1);
|
|
21
|
-
}
|
|
22
|
-
return this;
|
|
23
|
-
},
|
|
24
|
-
emit: function (type, arg) {
|
|
25
|
-
var ce = document.createEvent('CustomEvent');
|
|
26
|
-
ce.initCustomEvent(nameOf(type), false, false, {
|
|
27
|
-
arg: arg,
|
|
28
|
-
state: state,
|
|
29
|
-
});
|
|
30
|
-
document.body.dispatchEvent(ce);
|
|
31
|
-
return this;
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=events.js.map
|
package/esm/utils/events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAIA,SAAS,MAAM,CAAC,IAAqB;IACnC,OAAO,WAAS,IAAM,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAU;IACvC,IAAM,cAAc,GAAmB,EAAE,CAAC;IAE1C,OAAO;QACL,EAAE,EAAF,UAAG,IAAI,EAAE,QAAQ;YACf,IAAM,QAAQ,GAAG,UAAC,EAAuB;oBAArB,MAAM,YAAA;gBAAoB,OAAA,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;YAAxD,CAAwD,CAAC;YACvG,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;YACvD,cAAc,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,GAAG,YAAC,IAAI,EAAE,QAAQ;YACT,IAAA,QAAQ,GAAI,cAAc,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAjB,CAAiB,CAAC,GAAnD,CAAoD;YAEnE,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7D,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;aAC5D;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,YAAC,IAAI,EAAE,GAAG;YACZ,IAAM,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YAC/C,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC7C,GAAG,KAAA;gBACH,KAAK,OAAA;aACN,CAAC,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DefaultErrorInfo = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var React = require("react");
|
|
6
|
-
var ExtensionSlot_1 = require("./ExtensionSlot");
|
|
7
|
-
var SwitchErrorInfo_1 = require("./SwitchErrorInfo");
|
|
8
|
-
/**
|
|
9
|
-
* The default error info component. Just uses the "error" extension slot.
|
|
10
|
-
* Leverage the default one by registration of respective extensions using
|
|
11
|
-
* the "error" name.
|
|
12
|
-
*/
|
|
13
|
-
exports.DefaultErrorInfo = function (props) { return (React.createElement(ExtensionSlot_1.ExtensionSlot, { name: "error", params: props, empty: function () { return React.createElement(SwitchErrorInfo_1.SwitchErrorInfo, tslib_1.__assign({ key: "default_error" }, props)); } })); };
|
|
14
|
-
exports.DefaultErrorInfo.displayName = 'DefaultErrorInfo';
|
|
15
|
-
//# sourceMappingURL=DefaultErrorInfo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultErrorInfo.js","sourceRoot":"","sources":["../../src/components/DefaultErrorInfo.tsx"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,iDAAgD;AAChD,qDAAoD;AAGpD;;;;GAIG;AACU,QAAA,gBAAgB,GAA6B,UAAC,KAAK,IAAK,OAAA,CACnE,oBAAC,6BAAa,IAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,cAAM,OAAA,oBAAC,iCAAe,qBAAC,GAAG,EAAC,eAAe,IAAK,KAAK,EAAI,EAAlD,CAAkD,GAAI,CAC/G,EAFoE,CAEpE,CAAC;AACF,wBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultLayout.js","sourceRoot":"","sources":["../../src/components/DefaultLayout.tsx"],"names":[],"mappings":";;;AAEA,kCAAyC;AAEzC;;GAEG;AACU,QAAA,aAAa,GAA0B,UAAC,EAAY;QAAV,QAAQ,cAAA;IAAO,OAAA,qBAAa,CAAC,QAAQ,CAAC;AAAvB,CAAuB,CAAC;AAC9F,qBAAa,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultLoader.js","sourceRoot":"","sources":["../../src/components/DefaultLoader.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAG/B;;GAEG;AACU,QAAA,uBAAuB,GAAoC,cAAM,OAAA,2CAAkB,EAAlB,CAAkB,CAAC;AACjG,+BAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetComponent = void 0;
|
|
4
|
-
var hooks_1 = require("../hooks");
|
|
5
|
-
/**
|
|
6
|
-
* The component capable of setting a layout component at mounting.
|
|
7
|
-
*/
|
|
8
|
-
function SetComponent(_a) {
|
|
9
|
-
var name = _a.name, component = _a.component;
|
|
10
|
-
var setComponent = hooks_1.useAction('setComponent');
|
|
11
|
-
hooks_1.useSetter(function () { return component && setComponent(name, component); });
|
|
12
|
-
// tslint:disable-next-line:no-null-keyword
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
exports.SetComponent = SetComponent;
|
|
16
|
-
//# sourceMappingURL=SetComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetComponent.js","sourceRoot":"","sources":["../../src/components/SetComponent.tsx"],"names":[],"mappings":";;;AACA,kCAAgD;AAiBhD;;GAEG;AACH,SAAgB,YAAY,CAAqC,EAGvC;QAFxB,IAAI,UAAA,EACJ,SAAS,eAAA;IAET,IAAM,YAAY,GAAG,iBAAS,CAAC,cAAc,CAAC,CAAC;IAC/C,iBAAS,CAAC,cAAM,OAAA,SAAS,IAAI,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,EAA1C,CAA0C,CAAC,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AARD,oCAQC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetError = void 0;
|
|
4
|
-
var hooks_1 = require("../hooks");
|
|
5
|
-
/**
|
|
6
|
-
* The component capable of setting a globally defined error handler component at mounting.
|
|
7
|
-
*/
|
|
8
|
-
function SetError(_a) {
|
|
9
|
-
var type = _a.type, component = _a.component;
|
|
10
|
-
var setErrorComponent = hooks_1.useAction('setErrorComponent');
|
|
11
|
-
hooks_1.useSetter(function () { return component && setErrorComponent(type, component); });
|
|
12
|
-
// tslint:disable-next-line:no-null-keyword
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
exports.SetError = SetError;
|
|
16
|
-
//# sourceMappingURL=SetError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetError.js","sourceRoot":"","sources":["../../src/components/SetError.tsx"],"names":[],"mappings":";;;AACA,kCAAgD;AAiBhD;;GAEG;AACH,SAAgB,QAAQ,CAA0C,EAG5C;QAFpB,IAAI,UAAA,EACJ,SAAS,eAAA;IAET,IAAM,iBAAiB,GAAG,iBAAS,CAAC,mBAAmB,CAAC,CAAC;IACzD,iBAAS,CAAC,cAAM,OAAA,SAAS,IAAI,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,EAA/C,CAA+C,CAAC,CAAC;IACjE,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AARD,4BAQC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetErrors = void 0;
|
|
4
|
-
var React = require("react");
|
|
5
|
-
var SetError_1 = require("./SetError");
|
|
6
|
-
/**
|
|
7
|
-
* The component capable of batch setting error handling components.
|
|
8
|
-
*/
|
|
9
|
-
function SetErrors(_a) {
|
|
10
|
-
var _b = _a.errors, errors = _b === void 0 ? {} : _b;
|
|
11
|
-
return (React.createElement(React.Fragment, null, Object.keys(errors).map(function (key) { return (React.createElement(SetError_1.SetError, { type: key, component: errors[key], key: key })); })));
|
|
12
|
-
}
|
|
13
|
-
exports.SetErrors = SetErrors;
|
|
14
|
-
//# sourceMappingURL=SetErrors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetErrors.js","sourceRoot":"","sources":["../../src/components/SetErrors.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,uCAAsC;AAatC;;GAEG;AACH,SAAgB,SAAS,CAAC,EAA+B;QAA7B,cAAW,EAAX,MAAM,mBAAG,EAAE,KAAA;IACrC,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAC,GAAQ,IAAK,OAAA,CACrC,oBAAC,mBAAQ,IAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,GAAI,CAC1D,EAFsC,CAEtC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC;AARD,8BAQC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetLayout = void 0;
|
|
4
|
-
var React = require("react");
|
|
5
|
-
var SetComponent_1 = require("./SetComponent");
|
|
6
|
-
/**
|
|
7
|
-
* The component capable of batch setting layout components.
|
|
8
|
-
*/
|
|
9
|
-
function SetLayout(_a) {
|
|
10
|
-
var _b = _a.layout, layout = _b === void 0 ? {} : _b;
|
|
11
|
-
return (React.createElement(React.Fragment, null, Object.keys(layout).map(function (key) { return (React.createElement(SetComponent_1.SetComponent, { name: key, component: layout[key], key: key })); })));
|
|
12
|
-
}
|
|
13
|
-
exports.SetLayout = SetLayout;
|
|
14
|
-
//# sourceMappingURL=SetLayout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetLayout.js","sourceRoot":"","sources":["../../src/components/SetLayout.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,+CAA8C;AAa9C;;GAEG;AACH,SAAgB,SAAS,CAAC,EAA+B;QAA7B,cAAW,EAAX,MAAM,mBAAG,EAAE,KAAA;IACrC,OAAO,CACL,0CACG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAC,GAAQ,IAAK,OAAA,CACrC,oBAAC,2BAAY,IAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,GAAI,CAC9D,EAFsC,CAEtC,CAAC,CACD,CACJ,CAAC;AACJ,CAAC;AARD,8BAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetProvider.js","sourceRoot":"","sources":["../../src/components/SetProvider.tsx"],"names":[],"mappings":";;;AACA,kCAAgD;AAYhD;;GAEG;AACH,SAAgB,WAAW,CAAC,EAA8B;QAA5B,QAAQ,cAAA;IACpC,IAAM,eAAe,GAAG,iBAAS,CAAC,iBAAiB,CAAC,CAAC;IACrD,iBAAS,CAAC,cAAM,OAAA,QAAQ,IAAI,eAAe,CAAC,QAAQ,CAAC,EAArC,CAAqC,CAAC,CAAC;IACvD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AALD,kCAKC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetRedirect = void 0;
|
|
4
|
-
var React = require("react");
|
|
5
|
-
var react_router_1 = require("react-router");
|
|
6
|
-
var hooks_1 = require("../hooks");
|
|
7
|
-
/**
|
|
8
|
-
* The component capable of setting a global redirect route at mounting.
|
|
9
|
-
*/
|
|
10
|
-
function SetRedirect(_a) {
|
|
11
|
-
var from = _a.from, to = _a.to;
|
|
12
|
-
var setRoute = hooks_1.useAction('setRoute');
|
|
13
|
-
hooks_1.useSetter(function () { return setRoute(from, function () { return React.createElement(react_router_1.Redirect, { to: to }); }); });
|
|
14
|
-
// tslint:disable-next-line:no-null-keyword
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
exports.SetRedirect = SetRedirect;
|
|
18
|
-
//# sourceMappingURL=SetRedirect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetRedirect.js","sourceRoot":"","sources":["../../src/components/SetRedirect.tsx"],"names":[],"mappings":";;;AAAA,6BAA+B;AAC/B,6CAAwC;AACxC,kCAAgD;AAgBhD;;GAEG;AACH,SAAgB,WAAW,CAAC,EAA8B;QAA5B,IAAI,UAAA,EAAE,EAAE,QAAA;IACpC,IAAM,QAAQ,GAAG,iBAAS,CAAC,UAAU,CAAC,CAAC;IACvC,iBAAS,CAAC,cAAM,OAAA,QAAQ,CAAC,IAAI,EAAE,cAAM,OAAA,oBAAC,uBAAQ,IAAC,EAAE,EAAE,EAAE,GAAI,EAApB,CAAoB,CAAC,EAA1C,CAA0C,CAAC,CAAC;IAC5D,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AALD,kCAKC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetRoute = void 0;
|
|
4
|
-
var hooks_1 = require("../hooks");
|
|
5
|
-
/**
|
|
6
|
-
* The component capable of setting a global route at mounting.
|
|
7
|
-
*/
|
|
8
|
-
function SetRoute(_a) {
|
|
9
|
-
var path = _a.path, component = _a.component;
|
|
10
|
-
var setRoute = hooks_1.useAction('setRoute');
|
|
11
|
-
hooks_1.useSetter(function () { return component && setRoute(path, component); });
|
|
12
|
-
// tslint:disable-next-line:no-null-keyword
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
exports.SetRoute = SetRoute;
|
|
16
|
-
//# sourceMappingURL=SetRoute.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SetRoute.js","sourceRoot":"","sources":["../../src/components/SetRoute.tsx"],"names":[],"mappings":";;;AAEA,kCAAgD;AAgBhD;;GAEG;AACH,SAAgB,QAAQ,CAAS,EAAqC;QAAnC,IAAI,UAAA,EAAE,SAAS,eAAA;IAChD,IAAM,QAAQ,GAAG,iBAAS,CAAC,UAAU,CAAC,CAAC;IACvC,iBAAS,CAAC,cAAM,OAAA,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,EAAtC,CAAsC,CAAC,CAAC;IACxD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AALD,4BAKC"}
|
package/lib/hooks/debounce.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook that returns the debounced (i.e., delayed) value.
|
|
3
|
-
* Useful when user input should not fire immediately, but rather
|
|
4
|
-
* only after a certain timespan without any changes passed.
|
|
5
|
-
* @param value The value to consider.
|
|
6
|
-
* @param delay The timespan to pass before applying the value.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useDebounce<T>(value: T, delay?: number): T;
|
package/lib/hooks/debounce.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useDebounce = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook that returns the debounced (i.e., delayed) value.
|
|
7
|
-
* Useful when user input should not fire immediately, but rather
|
|
8
|
-
* only after a certain timespan without any changes passed.
|
|
9
|
-
* @param value The value to consider.
|
|
10
|
-
* @param delay The timespan to pass before applying the value.
|
|
11
|
-
*/
|
|
12
|
-
function useDebounce(value, delay) {
|
|
13
|
-
if (delay === void 0) { delay = 300; }
|
|
14
|
-
var _a = react_1.useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
15
|
-
react_1.useEffect(function () {
|
|
16
|
-
var handler = setTimeout(function () { return setDebouncedValue(value); }, delay);
|
|
17
|
-
return function () { return clearTimeout(handler); };
|
|
18
|
-
}, [value, delay]);
|
|
19
|
-
return debouncedValue;
|
|
20
|
-
}
|
|
21
|
-
exports.useDebounce = useDebounce;
|
|
22
|
-
//# sourceMappingURL=debounce.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/hooks/debounce.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAE5C;;;;;;GAMG;AACH,SAAgB,WAAW,CAAI,KAAQ,EAAE,KAAW;IAAX,sBAAA,EAAA,WAAW;IAC5C,IAAA,KAAsC,gBAAQ,CAAC,KAAK,CAAC,EAApD,cAAc,QAAA,EAAE,iBAAiB,QAAmB,CAAC;IAE5D,iBAAS,CAAC;QACR,IAAM,OAAO,GAAG,UAAU,CAAC,cAAM,OAAA,iBAAiB,CAAC,KAAK,CAAC,EAAxB,CAAwB,EAAE,KAAK,CAAC,CAAC;QAClE,OAAO,cAAM,OAAA,YAAY,CAAC,OAAO,CAAC,EAArB,CAAqB,CAAC;IACrC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAEnB,OAAO,cAAc,CAAC;AACxB,CAAC;AATD,kCASC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useLockBodyScroll = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook that locks scrolling on the main document.
|
|
7
|
-
* Useful for preventing the standard scrolling in context of
|
|
8
|
-
* a modal dialog.
|
|
9
|
-
*/
|
|
10
|
-
function useLockBodyScroll() {
|
|
11
|
-
react_1.useLayoutEffect(function () {
|
|
12
|
-
document.body.style.overflow = 'hidden';
|
|
13
|
-
return function () { return (document.body.style.overflow = 'visible'); };
|
|
14
|
-
}, []);
|
|
15
|
-
}
|
|
16
|
-
exports.useLockBodyScroll = useLockBodyScroll;
|
|
17
|
-
//# sourceMappingURL=lockBodyScroll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lockBodyScroll.js","sourceRoot":"","sources":["../../src/hooks/lockBodyScroll.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AAExC;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,uBAAe,CAAC;QACd,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACxC,OAAO,cAAM,OAAA,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC,EAA1C,CAA0C,CAAC;IAC1D,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AALD,8CAKC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that detects if a click outside the given reference
|
|
4
|
-
* has been performed.
|
|
5
|
-
* @param ref The reference to the element.
|
|
6
|
-
* @param handler The callback to invoke when an outside click happened.
|
|
7
|
-
*/
|
|
8
|
-
export declare function useOnClickOutside<T extends HTMLElement>(ref: RefObject<T>, handler: (event: MouseEvent) => void): void;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useOnClickOutside = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook that detects if a click outside the given reference
|
|
7
|
-
* has been performed.
|
|
8
|
-
* @param ref The reference to the element.
|
|
9
|
-
* @param handler The callback to invoke when an outside click happened.
|
|
10
|
-
*/
|
|
11
|
-
function useOnClickOutside(ref, handler) {
|
|
12
|
-
react_1.useEffect(function () {
|
|
13
|
-
var listener = function (event) {
|
|
14
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
15
|
-
handler(event);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
document.addEventListener('mousedown', listener);
|
|
19
|
-
document.addEventListener('touchstart', listener);
|
|
20
|
-
return function () {
|
|
21
|
-
document.removeEventListener('mousedown', listener);
|
|
22
|
-
document.removeEventListener('touchstart', listener);
|
|
23
|
-
};
|
|
24
|
-
}, [handler]);
|
|
25
|
-
}
|
|
26
|
-
exports.useOnClickOutside = useOnClickOutside;
|
|
27
|
-
//# sourceMappingURL=onClickOutside.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onClickOutside.js","sourceRoot":"","sources":["../../src/hooks/onClickOutside.ts"],"names":[],"mappings":";;;AAAA,+BAA6C;AAE7C;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAwB,GAAiB,EAAE,OAAoC;IAC9G,iBAAS,CAAC;QACR,IAAM,QAAQ,GAAG,UAAC,KAAiB;YACjC,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE;gBAC9D,OAAO,CAAC,KAAK,CAAC,CAAC;aAChB;QACH,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAElD,OAAO;YACL,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACpD,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC;AAhBD,8CAgBC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Hook that detects if a reference element within the main document is
|
|
4
|
-
* visible.
|
|
5
|
-
* Useful for performing some animation or triggering certain actions (e.g.,
|
|
6
|
-
* loading data for infinity scrolling) when an element appears or is close
|
|
7
|
-
* to appear on screen.
|
|
8
|
-
* @param ref The reference element to be visible.
|
|
9
|
-
* @param rootMargin The tolerance level to the reference element.
|
|
10
|
-
*/
|
|
11
|
-
export declare function useOnScreenVisible<T extends HTMLElement>(ref: RefObject<T>, rootMargin?: string): boolean;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useOnScreenVisible = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook that detects if a reference element within the main document is
|
|
7
|
-
* visible.
|
|
8
|
-
* Useful for performing some animation or triggering certain actions (e.g.,
|
|
9
|
-
* loading data for infinity scrolling) when an element appears or is close
|
|
10
|
-
* to appear on screen.
|
|
11
|
-
* @param ref The reference element to be visible.
|
|
12
|
-
* @param rootMargin The tolerance level to the reference element.
|
|
13
|
-
*/
|
|
14
|
-
function useOnScreenVisible(ref, rootMargin) {
|
|
15
|
-
if (rootMargin === void 0) { rootMargin = '0px'; }
|
|
16
|
-
var _a = react_1.useState(false), isIntersecting = _a[0], setIntersecting = _a[1];
|
|
17
|
-
react_1.useEffect(function () {
|
|
18
|
-
var observer = new IntersectionObserver(function (_a) {
|
|
19
|
-
var entry = _a[0];
|
|
20
|
-
return setIntersecting(entry.isIntersecting);
|
|
21
|
-
}, {
|
|
22
|
-
rootMargin: rootMargin,
|
|
23
|
-
});
|
|
24
|
-
if (ref.current) {
|
|
25
|
-
observer.observe(ref.current);
|
|
26
|
-
}
|
|
27
|
-
return function () { return observer.unobserve(ref.current); };
|
|
28
|
-
}, []);
|
|
29
|
-
return isIntersecting;
|
|
30
|
-
}
|
|
31
|
-
exports.useOnScreenVisible = useOnScreenVisible;
|
|
32
|
-
//# sourceMappingURL=onScreenVisible.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onScreenVisible.js","sourceRoot":"","sources":["../../src/hooks/onScreenVisible.ts"],"names":[],"mappings":";;;AAAA,+BAAuD;AAEvD;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAwB,GAAiB,EAAE,UAAkB;IAAlB,2BAAA,EAAA,kBAAkB;IACvF,IAAA,KAAoC,gBAAQ,CAAC,KAAK,CAAC,EAAlD,cAAc,QAAA,EAAE,eAAe,QAAmB,CAAC;IAE1D,iBAAS,CAAC;QACR,IAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,UAAC,EAAO;gBAAN,KAAK,QAAA;YAAM,OAAA,eAAe,CAAC,KAAK,CAAC,cAAc,CAAC;QAArC,CAAqC,EAAE;YAC5F,UAAU,YAAA;SACX,CAAC,CAAC;QAEH,IAAI,GAAG,CAAC,OAAO,EAAE;YACf,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;SAC/B;QAED,OAAO,cAAM,OAAA,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAA/B,CAA+B,CAAC;IAC/C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,cAAc,CAAC;AACxB,CAAC;AAhBD,gDAgBC"}
|
package/lib/hooks/promise.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The currently captured Promise state.
|
|
3
|
-
*/
|
|
4
|
-
export interface UsePromiseResult<T> {
|
|
5
|
-
loading: boolean;
|
|
6
|
-
data: T;
|
|
7
|
-
error: any;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Hook for introducing a complete local loading state for a promise.
|
|
11
|
-
* @param promise The callback for the promise to wait for.
|
|
12
|
-
*/
|
|
13
|
-
export declare function usePromise<T>(promise: () => Promise<T>): UsePromiseResult<T>;
|
package/lib/hooks/promise.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePromise = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* Hook for introducing a complete local loading state for a promise.
|
|
7
|
-
* @param promise The callback for the promise to wait for.
|
|
8
|
-
*/
|
|
9
|
-
function usePromise(promise) {
|
|
10
|
-
var _a = react_1.useState({
|
|
11
|
-
loading: true,
|
|
12
|
-
data: undefined,
|
|
13
|
-
error: undefined,
|
|
14
|
-
}), result = _a[0], setResult = _a[1];
|
|
15
|
-
react_1.useEffect(function () {
|
|
16
|
-
var cancelled = false;
|
|
17
|
-
promise().then(function (data) { return !cancelled && setResult({ data: data, error: undefined, loading: false }); }, function (error) { return !cancelled && setResult({ data: undefined, error: error, loading: false }); });
|
|
18
|
-
return function () {
|
|
19
|
-
cancelled = true;
|
|
20
|
-
};
|
|
21
|
-
}, []);
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
exports.usePromise = usePromise;
|
|
25
|
-
//# sourceMappingURL=promise.js.map
|
package/lib/hooks/promise.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../../src/hooks/promise.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAW5C;;;GAGG;AACH,SAAgB,UAAU,CAAI,OAAyB;IAC/C,IAAA,KAAsB,gBAAQ,CAAsB;QACxD,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;KACjB,CAAC,EAJK,MAAM,QAAA,EAAE,SAAS,QAItB,CAAC;IACH,iBAAS,CAAC;QACR,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,OAAO,EAAE,CAAC,IAAI,CACZ,UAAC,IAAI,IAAK,OAAA,CAAC,SAAS,IAAI,SAAS,CAAC,EAAE,IAAI,MAAA,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAnE,CAAmE,EAC7E,UAAC,KAAK,IAAK,OAAA,CAAC,SAAS,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,OAAA,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAnE,CAAmE,CAC/E,CAAC;QAEF,OAAO;YACL,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,MAAM,CAAC;AAChB,CAAC;AAnBD,gCAmBC"}
|
package/lib/utils/events.d.ts
DELETED
package/lib/utils/events.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createListener = void 0;
|
|
4
|
-
function nameOf(type) {
|
|
5
|
-
return "piral-" + type;
|
|
6
|
-
}
|
|
7
|
-
function createListener(state) {
|
|
8
|
-
var eventListeners = [];
|
|
9
|
-
return {
|
|
10
|
-
on: function (type, callback) {
|
|
11
|
-
var listener = function (_a) {
|
|
12
|
-
var detail = _a.detail;
|
|
13
|
-
return detail && detail.state === state && callback(detail.arg);
|
|
14
|
-
};
|
|
15
|
-
document.body.addEventListener(nameOf(type), listener);
|
|
16
|
-
eventListeners.push([callback, listener]);
|
|
17
|
-
return this;
|
|
18
|
-
},
|
|
19
|
-
off: function (type, callback) {
|
|
20
|
-
var listener = eventListeners.filter(function (m) { return m[0] === callback; })[0];
|
|
21
|
-
if (listener) {
|
|
22
|
-
document.body.removeEventListener(nameOf(type), listener[1]);
|
|
23
|
-
eventListeners.splice(eventListeners.indexOf(listener), 1);
|
|
24
|
-
}
|
|
25
|
-
return this;
|
|
26
|
-
},
|
|
27
|
-
emit: function (type, arg) {
|
|
28
|
-
var ce = document.createEvent('CustomEvent');
|
|
29
|
-
ce.initCustomEvent(nameOf(type), false, false, {
|
|
30
|
-
arg: arg,
|
|
31
|
-
state: state,
|
|
32
|
-
});
|
|
33
|
-
document.body.dispatchEvent(ce);
|
|
34
|
-
return this;
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
exports.createListener = createListener;
|
|
39
|
-
//# sourceMappingURL=events.js.map
|
package/lib/utils/events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":";;;AAIA,SAAS,MAAM,CAAC,IAAqB;IACnC,OAAO,WAAS,IAAM,CAAC;AACzB,CAAC;AAED,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAM,cAAc,GAAmB,EAAE,CAAC;IAE1C,OAAO;QACL,EAAE,EAAF,UAAG,IAAI,EAAE,QAAQ;YACf,IAAM,QAAQ,GAAG,UAAC,EAAuB;oBAArB,MAAM,YAAA;gBAAoB,OAAA,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;YAAxD,CAAwD,CAAC;YACvG,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;YACvD,cAAc,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,GAAG,YAAC,IAAI,EAAE,QAAQ;YACT,IAAA,QAAQ,GAAI,cAAc,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAjB,CAAiB,CAAC,GAAnD,CAAoD;YAEnE,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7D,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;aAC5D;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,YAAC,IAAI,EAAE,GAAG;YACZ,IAAM,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YAC/C,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC7C,GAAG,KAAA;gBACH,KAAK,OAAA;aACN,CAAC,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AA9BD,wCA8BC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DefaultLayout } from './DefaultLayout';
|
|
3
|
-
import { mount } from 'enzyme';
|
|
4
|
-
|
|
5
|
-
describe('Default Layout Component', () => {
|
|
6
|
-
it('renders correctly for desktop', () => {
|
|
7
|
-
const children = <div></div>;
|
|
8
|
-
const node = mount(<DefaultLayout currentLayout="desktop" children={children} />);
|
|
9
|
-
expect(node.find('div').length).toBe(1);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('renders correctly for mobile', () => {
|
|
13
|
-
const children = <div></div>;
|
|
14
|
-
const node = mount(<DefaultLayout currentLayout="mobile" children={children} />);
|
|
15
|
-
expect(node.find('div').length).toBe(1);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('renders correctly for tablet', () => {
|
|
19
|
-
const children = <div></div>;
|
|
20
|
-
const node = mount(<DefaultLayout currentLayout="tablet" children={children} />);
|
|
21
|
-
expect(node.find('div').length).toBe(1);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DefaultLoadingIndicator } from './DefaultLoader';
|
|
3
|
-
import { mount } from 'enzyme';
|
|
4
|
-
|
|
5
|
-
describe('Default Loader Component', () => {
|
|
6
|
-
it('renders correctly', () => {
|
|
7
|
-
const node = mount(<DefaultLoadingIndicator />);
|
|
8
|
-
expect(node.find('div').length).toBe(1);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useDebounce } from './debounce';
|
|
3
|
-
|
|
4
|
-
jest.mock('react');
|
|
5
|
-
|
|
6
|
-
describe('Debounce Hook Module', () => {
|
|
7
|
-
it('just returns initial value if nothing has been changed', () => {
|
|
8
|
-
const usedEffect = jest.fn();
|
|
9
|
-
const usedState = jest.fn((value) => [value]);
|
|
10
|
-
(React as any).useState = usedState;
|
|
11
|
-
(React as any).useEffect = usedEffect;
|
|
12
|
-
const result = useDebounce('foo');
|
|
13
|
-
expect(usedEffect).toHaveBeenCalled();
|
|
14
|
-
expect(usedState).toHaveBeenCalled();
|
|
15
|
-
expect(result).toBe('foo');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('invokes useEffect immediately, but does not set value immediately', () => {
|
|
19
|
-
const usedEffect = jest.fn((fn) => fn());
|
|
20
|
-
const setValue = jest.fn();
|
|
21
|
-
const usedState = jest.fn((value) => [value, setValue]);
|
|
22
|
-
(React as any).useState = usedState;
|
|
23
|
-
(React as any).useEffect = usedEffect;
|
|
24
|
-
useDebounce('foo');
|
|
25
|
-
expect(setValue).not.toHaveBeenCalled();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('invokes useEffect immediately, but sets value immediately if 0', () => {
|
|
29
|
-
jest.useFakeTimers();
|
|
30
|
-
const usedEffect = jest.fn((fn) => fn());
|
|
31
|
-
const setValue = jest.fn();
|
|
32
|
-
const usedState = jest.fn((value) => [value, setValue]);
|
|
33
|
-
(React as any).useState = usedState;
|
|
34
|
-
(React as any).useEffect = usedEffect;
|
|
35
|
-
useDebounce('foo', 0);
|
|
36
|
-
jest.advanceTimersByTime(0);
|
|
37
|
-
expect(setValue).toHaveBeenCalled();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('invokes useEffect immediately, but sets value after wait time', () => {
|
|
41
|
-
jest.useFakeTimers();
|
|
42
|
-
const usedEffect = jest.fn((fn) => fn());
|
|
43
|
-
const setValue = jest.fn();
|
|
44
|
-
const usedState = jest.fn((value) => [value, setValue]);
|
|
45
|
-
(React as any).useState = usedState;
|
|
46
|
-
(React as any).useEffect = usedEffect;
|
|
47
|
-
expect(setValue).not.toHaveBeenCalled();
|
|
48
|
-
useDebounce('foo', 300);
|
|
49
|
-
jest.advanceTimersByTime(300);
|
|
50
|
-
expect(setValue).toHaveBeenCalled();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('invokes useEffect immediately and resets timer if needed', () => {
|
|
54
|
-
jest.useFakeTimers();
|
|
55
|
-
const usedEffect = jest.fn((fn) => fn());
|
|
56
|
-
const setValue = jest.fn();
|
|
57
|
-
const usedState = jest.fn((value) => [value, setValue]);
|
|
58
|
-
(React as any).useState = usedState;
|
|
59
|
-
(React as any).useEffect = usedEffect;
|
|
60
|
-
expect(setValue).not.toHaveBeenCalled();
|
|
61
|
-
useDebounce('foo', 300);
|
|
62
|
-
jest.advanceTimersByTime(250);
|
|
63
|
-
usedEffect.mock.results[0].value();
|
|
64
|
-
jest.advanceTimersByTime(50);
|
|
65
|
-
expect(setValue).not.toHaveBeenCalled();
|
|
66
|
-
});
|
|
67
|
-
});
|
package/src/hooks/debounce.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Hook that returns the debounced (i.e., delayed) value.
|
|
5
|
-
* Useful when user input should not fire immediately, but rather
|
|
6
|
-
* only after a certain timespan without any changes passed.
|
|
7
|
-
* @param value The value to consider.
|
|
8
|
-
* @param delay The timespan to pass before applying the value.
|
|
9
|
-
*/
|
|
10
|
-
export function useDebounce<T>(value: T, delay = 300) {
|
|
11
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
15
|
-
return () => clearTimeout(handler);
|
|
16
|
-
}, [value, delay]);
|
|
17
|
-
|
|
18
|
-
return debouncedValue;
|
|
19
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useGlobalState } from './globalState';
|
|
2
|
-
|
|
3
|
-
jest.mock('react', () => {
|
|
4
|
-
const { Atom } = require('@libre/atom');
|
|
5
|
-
const state = Atom.of({
|
|
6
|
-
foo: 5,
|
|
7
|
-
bar: {
|
|
8
|
-
qxz: 'hello',
|
|
9
|
-
},
|
|
10
|
-
list: [1, 2, 3],
|
|
11
|
-
});
|
|
12
|
-
return {
|
|
13
|
-
createContext: jest.fn(),
|
|
14
|
-
useContext: () => ({ state }),
|
|
15
|
-
useState: (v) => [v, jest.fn()],
|
|
16
|
-
useMemo: (f) => f(),
|
|
17
|
-
useLayoutEffect: (f) => f(),
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('GlobalState Hook Module', () => {
|
|
22
|
-
it('selects key from state', () => {
|
|
23
|
-
const result = useGlobalState((m) => (m as any).foo);
|
|
24
|
-
expect(result).toBe(5);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('gets full state object', () => {
|
|
28
|
-
const result = useGlobalState();
|
|
29
|
-
expect(result).toEqual({
|
|
30
|
-
foo: 5,
|
|
31
|
-
bar: {
|
|
32
|
-
qxz: 'hello',
|
|
33
|
-
},
|
|
34
|
-
list: [1, 2, 3],
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('selects nested values', () => {
|
|
39
|
-
const result = useGlobalState((m) => (m as any).bar.qxz);
|
|
40
|
-
expect(result).toBe('hello');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('selection works against array members', () => {
|
|
44
|
-
const result = useGlobalState((m) => (m as any).list[2]);
|
|
45
|
-
expect(result).toBe(3);
|
|
46
|
-
});
|
|
47
|
-
});
|