@react-navigation/core 7.0.0-rc.9 → 7.0.1
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/lib/commonjs/BaseNavigationContainer.js +356 -0
- package/lib/commonjs/BaseNavigationContainer.js.map +1 -0
- package/lib/commonjs/CurrentRenderContext.js +15 -0
- package/lib/commonjs/DeprecatedNavigationInChildContext.js +14 -0
- package/lib/commonjs/EnsureSingleNavigator.js +43 -0
- package/lib/commonjs/Group.js +14 -0
- package/lib/commonjs/NavigationBuilderContext.js +17 -0
- package/lib/commonjs/NavigationContainerRefContext.js +14 -0
- package/lib/commonjs/NavigationContext.js +14 -0
- package/lib/commonjs/NavigationHelpersContext.js +15 -0
- package/lib/commonjs/NavigationIndependentTree.js +35 -0
- package/lib/commonjs/NavigationIndependentTreeContext.js +14 -0
- package/lib/commonjs/NavigationRouteContext.js +14 -0
- package/lib/commonjs/NavigationStateContext.js +29 -0
- package/lib/commonjs/PreventRemoveContext.js +16 -0
- package/lib/commonjs/PreventRemoveProvider.js +91 -0
- package/lib/commonjs/SceneView.js +96 -0
- package/lib/commonjs/Screen.js +14 -0
- package/lib/commonjs/StaticContainer.js +31 -0
- package/lib/commonjs/StaticNavigation.js +256 -0
- package/lib/commonjs/StaticNavigation.js.map +1 -0
- package/lib/commonjs/UnhandledActionContext.js +11 -0
- package/lib/commonjs/checkDuplicateRouteNames.js +25 -0
- package/lib/commonjs/checkSerializable.js +50 -0
- package/lib/commonjs/createNavigationContainerRef.js +69 -0
- package/lib/commonjs/createNavigatorFactory.js +34 -0
- package/lib/commonjs/deepFreeze.js +37 -0
- package/lib/commonjs/findFocusedRoute.js +15 -0
- package/lib/commonjs/getActionFromState.js +86 -0
- package/lib/commonjs/getFocusedRouteNameFromRoute.js +22 -0
- package/lib/commonjs/getPathFromState.js +218 -0
- package/lib/commonjs/getPathFromState.js.map +1 -0
- package/lib/commonjs/getStateFromPath.js +475 -0
- package/lib/commonjs/getStateFromPath.js.map +1 -0
- package/lib/commonjs/index.js +287 -0
- package/lib/commonjs/isArrayEqual.js +20 -0
- package/lib/commonjs/isRecordEqual.js +21 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theming/ThemeContext.js +12 -0
- package/lib/commonjs/theming/ThemeProvider.js +21 -0
- package/lib/commonjs/theming/useTheme.js +18 -0
- package/lib/commonjs/types.js +27 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useChildListeners.js +36 -0
- package/lib/commonjs/useComponent.js +40 -0
- package/lib/commonjs/useCurrentRender.js +25 -0
- package/lib/commonjs/useDescriptors.js +188 -0
- package/lib/commonjs/useEventEmitter.js +105 -0
- package/lib/commonjs/useFocusEffect.js +80 -0
- package/lib/commonjs/useFocusEvents.js +70 -0
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js +48 -0
- package/lib/commonjs/useIsFocused.js +28 -0
- package/lib/commonjs/useIsomorphicLayoutEffect.js +12 -0
- package/lib/commonjs/useIsomorphicLayoutEffect.native.js +9 -0
- package/lib/commonjs/useKeyedChildListeners.js +33 -0
- package/lib/commonjs/useLazyValue.js +17 -0
- package/lib/commonjs/useNavigation.js +27 -0
- package/lib/commonjs/useNavigationBuilder.js +492 -0
- package/lib/commonjs/useNavigationBuilder.js.map +1 -0
- package/lib/commonjs/useNavigationCache.js +162 -0
- package/lib/commonjs/useNavigationContainerRef.js +18 -0
- package/lib/commonjs/useNavigationHelpers.js +76 -0
- package/lib/commonjs/useNavigationIndependentTree.js +14 -0
- package/lib/commonjs/useNavigationState.js +26 -0
- package/lib/commonjs/useOnAction.js +106 -0
- package/lib/commonjs/useOnGetState.js +48 -0
- package/lib/commonjs/useOnPreventRemove.js +72 -0
- package/lib/commonjs/useOnRouteFocus.js +36 -0
- package/lib/commonjs/useOptionsGetters.js +78 -0
- package/lib/commonjs/usePreventRemove.js +48 -0
- package/lib/commonjs/usePreventRemoveContext.js +18 -0
- package/lib/commonjs/useRegisterNavigator.js +32 -0
- package/lib/commonjs/useRoute.js +23 -0
- package/lib/commonjs/useRouteCache.js +69 -0
- package/lib/commonjs/useSyncState.js +48 -0
- package/lib/commonjs/validatePathConfig.js +49 -0
- package/lib/commonjs/validatePathConfig.js.map +1 -0
- package/lib/module/BaseNavigationContainer.js +349 -0
- package/lib/module/BaseNavigationContainer.js.map +1 -0
- package/lib/module/CurrentRenderContext.js +10 -0
- package/lib/module/CurrentRenderContext.js.map +1 -0
- package/lib/module/DeprecatedNavigationInChildContext.js +9 -0
- package/lib/module/DeprecatedNavigationInChildContext.js.map +1 -0
- package/lib/module/EnsureSingleNavigator.js +36 -0
- package/lib/module/EnsureSingleNavigator.js.map +1 -0
- package/lib/module/Group.js +10 -0
- package/lib/module/Group.js.map +1 -0
- package/lib/module/NavigationBuilderContext.js +11 -0
- package/lib/module/NavigationBuilderContext.js.map +1 -0
- package/lib/module/NavigationContainerRefContext.js +8 -0
- package/lib/module/NavigationContainerRefContext.js.map +1 -0
- package/lib/module/NavigationContext.js +8 -0
- package/lib/module/NavigationContext.js.map +1 -0
- package/lib/module/NavigationHelpersContext.js +9 -0
- package/lib/module/NavigationHelpersContext.js.map +1 -0
- package/lib/module/NavigationIndependentTree.js +30 -0
- package/lib/module/NavigationIndependentTree.js.map +1 -0
- package/lib/module/NavigationIndependentTreeContext.js +9 -0
- package/lib/module/NavigationIndependentTreeContext.js.map +1 -0
- package/lib/module/NavigationRouteContext.js +9 -0
- package/lib/module/NavigationRouteContext.js.map +1 -0
- package/lib/module/NavigationStateContext.js +23 -0
- package/lib/module/NavigationStateContext.js.map +1 -0
- package/lib/module/PreventRemoveContext.js +11 -0
- package/lib/module/PreventRemoveContext.js.map +1 -0
- package/lib/module/PreventRemoveProvider.js +84 -0
- package/lib/module/PreventRemoveProvider.js.map +1 -0
- package/lib/module/SceneView.js +90 -0
- package/lib/module/SceneView.js.map +1 -0
- package/lib/module/Screen.js +10 -0
- package/lib/module/Screen.js.map +1 -0
- package/lib/module/StaticContainer.js +26 -0
- package/lib/module/StaticContainer.js.map +1 -0
- package/lib/module/StaticNavigation.js +249 -0
- package/lib/module/StaticNavigation.js.map +1 -0
- package/lib/module/UnhandledActionContext.js +5 -0
- package/lib/module/UnhandledActionContext.js.map +1 -0
- package/lib/module/checkDuplicateRouteNames.js +21 -0
- package/lib/module/checkDuplicateRouteNames.js.map +1 -0
- package/lib/module/checkSerializable.js +46 -0
- package/lib/module/checkSerializable.js.map +1 -0
- package/lib/module/createNavigationContainerRef.js +64 -0
- package/lib/module/createNavigationContainerRef.js.map +1 -0
- package/lib/module/createNavigatorFactory.js +31 -0
- package/lib/module/createNavigatorFactory.js.map +1 -0
- package/lib/module/deepFreeze.js +31 -0
- package/lib/module/deepFreeze.js.map +1 -0
- package/lib/module/findFocusedRoute.js +11 -0
- package/lib/module/findFocusedRoute.js.map +1 -0
- package/lib/module/getActionFromState.js +82 -0
- package/lib/module/getActionFromState.js.map +1 -0
- package/lib/module/getFocusedRouteNameFromRoute.js +18 -0
- package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -0
- package/lib/module/getPathFromState.js +212 -0
- package/lib/module/getPathFromState.js.map +1 -0
- package/lib/module/getStateFromPath.js +468 -0
- package/lib/module/getStateFromPath.js.map +1 -0
- package/lib/module/index.js +36 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/isArrayEqual.js +16 -0
- package/lib/module/isArrayEqual.js.map +1 -0
- package/lib/module/isRecordEqual.js +17 -0
- package/lib/module/isRecordEqual.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theming/ThemeContext.js +6 -0
- package/lib/module/theming/ThemeContext.js.map +1 -0
- package/lib/module/theming/ThemeProvider.js +15 -0
- package/lib/module/theming/ThemeProvider.js.map +1 -0
- package/lib/module/theming/useTheme.js +12 -0
- package/lib/module/theming/useTheme.js.map +1 -0
- package/lib/module/types.js +23 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useChildListeners.js +30 -0
- package/lib/module/useChildListeners.js.map +1 -0
- package/lib/module/useComponent.js +34 -0
- package/lib/module/useComponent.js.map +1 -0
- package/lib/module/useCurrentRender.js +19 -0
- package/lib/module/useCurrentRender.js.map +1 -0
- package/lib/module/useDescriptors.js +182 -0
- package/lib/module/useDescriptors.js.map +1 -0
- package/lib/module/useEventEmitter.js +99 -0
- package/lib/module/useEventEmitter.js.map +1 -0
- package/lib/module/useFocusEffect.js +74 -0
- package/lib/module/useFocusEffect.js.map +1 -0
- package/lib/module/useFocusEvents.js +64 -0
- package/lib/module/useFocusEvents.js.map +1 -0
- package/lib/module/useFocusedListenersChildrenAdapter.js +42 -0
- package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -0
- package/lib/module/useIsFocused.js +23 -0
- package/lib/module/useIsFocused.js.map +1 -0
- package/lib/module/useIsomorphicLayoutEffect.js +9 -0
- package/lib/module/useIsomorphicLayoutEffect.js.map +1 -0
- package/lib/module/useIsomorphicLayoutEffect.native.js +5 -0
- package/lib/module/useIsomorphicLayoutEffect.native.js.map +1 -0
- package/lib/module/useKeyedChildListeners.js +27 -0
- package/lib/module/useKeyedChildListeners.js.map +1 -0
- package/lib/module/useLazyValue.js +11 -0
- package/lib/module/useLazyValue.js.map +1 -0
- package/lib/module/useNavigation.js +21 -0
- package/lib/module/useNavigation.js.map +1 -0
- package/lib/module/useNavigationBuilder.js +486 -0
- package/lib/module/useNavigationBuilder.js.map +1 -0
- package/lib/module/useNavigationCache.js +156 -0
- package/lib/module/useNavigationCache.js.map +1 -0
- package/lib/module/useNavigationContainerRef.js +12 -0
- package/lib/module/useNavigationContainerRef.js.map +1 -0
- package/lib/module/useNavigationHelpers.js +70 -0
- package/lib/module/useNavigationHelpers.js.map +1 -0
- package/lib/module/useNavigationIndependentTree.js +8 -0
- package/lib/module/useNavigationIndependentTree.js.map +1 -0
- package/lib/module/useNavigationState.js +20 -0
- package/lib/module/useNavigationState.js.map +1 -0
- package/lib/module/useOnAction.js +100 -0
- package/lib/module/useOnAction.js.map +1 -0
- package/lib/module/useOnGetState.js +42 -0
- package/lib/module/useOnGetState.js.map +1 -0
- package/lib/module/useOnPreventRemove.js +64 -0
- package/lib/module/useOnPreventRemove.js.map +1 -0
- package/lib/module/useOnRouteFocus.js +30 -0
- package/lib/module/useOnRouteFocus.js.map +1 -0
- package/lib/module/useOptionsGetters.js +72 -0
- package/lib/module/useOptionsGetters.js.map +1 -0
- package/lib/module/usePreventRemove.js +42 -0
- package/lib/module/usePreventRemove.js.map +1 -0
- package/lib/module/usePreventRemoveContext.js +12 -0
- package/lib/module/usePreventRemoveContext.js.map +1 -0
- package/lib/module/useRegisterNavigator.js +27 -0
- package/lib/module/useRegisterNavigator.js.map +1 -0
- package/lib/module/useRoute.js +17 -0
- package/lib/module/useRoute.js.map +1 -0
- package/lib/module/useRouteCache.js +62 -0
- package/lib/module/useRouteCache.js.map +1 -0
- package/lib/module/useSyncState.js +42 -0
- package/lib/module/useSyncState.js.map +1 -0
- package/lib/module/validatePathConfig.js +45 -0
- package/lib/module/validatePathConfig.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/BaseNavigationContainer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/CurrentRenderContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/DeprecatedNavigationInChildContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/EnsureSingleNavigator.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Group.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationBuilderContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationContainerRefContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationHelpersContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationIndependentTree.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationIndependentTreeContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationRouteContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NavigationStateContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/PreventRemoveContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/PreventRemoveProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/SceneView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Screen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/StaticContainer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/StaticNavigation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/UnhandledActionContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/checkDuplicateRouteNames.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/checkSerializable.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/createNavigationContainerRef.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/createNavigatorFactory.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/deepFreeze.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/findFocusedRoute.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/getActionFromState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/getFocusedRouteNameFromRoute.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/getPathFromState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/getStateFromPath.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/isArrayEqual.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/isRecordEqual.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theming/ThemeContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theming/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theming/useTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +702 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useChildListeners.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useCurrentRender.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useDescriptors.d.ts +133 -0
- package/lib/typescript/commonjs/src/useDescriptors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useEventEmitter.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useFocusEffect.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useFocusEvents.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useIsFocused.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useIsomorphicLayoutEffect.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useKeyedChildListeners.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useLazyValue.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useNavigation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useNavigationBuilder.d.ts +181 -0
- package/lib/typescript/commonjs/src/useNavigationBuilder.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useNavigationCache.d.ts +65 -0
- package/lib/typescript/commonjs/src/useNavigationCache.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useNavigationContainerRef.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useNavigationHelpers.d.ts +96 -0
- package/lib/typescript/commonjs/src/useNavigationHelpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useNavigationIndependentTree.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useNavigationState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useOnAction.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useOnGetState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useOnPreventRemove.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useOnRouteFocus.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useOptionsGetters.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/usePreventRemove.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/usePreventRemoveContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useRegisterNavigator.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useRoute.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useRouteCache.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useSyncState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/validatePathConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/BaseNavigationContainer.d.ts +17 -0
- package/lib/typescript/module/src/BaseNavigationContainer.d.ts.map +1 -0
- package/lib/typescript/module/src/CurrentRenderContext.d.ts +9 -0
- package/lib/typescript/module/src/CurrentRenderContext.d.ts.map +1 -0
- package/lib/typescript/module/src/DeprecatedNavigationInChildContext.d.ts +6 -0
- package/lib/typescript/module/src/DeprecatedNavigationInChildContext.d.ts.map +1 -0
- package/lib/typescript/module/src/EnsureSingleNavigator.d.ts +14 -0
- package/lib/typescript/module/src/EnsureSingleNavigator.d.ts.map +1 -0
- package/lib/typescript/module/src/Group.d.ts +7 -0
- package/lib/typescript/module/src/Group.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationBuilderContext.d.ts +34 -0
- package/lib/typescript/module/src/NavigationBuilderContext.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationContainerRefContext.d.ts +8 -0
- package/lib/typescript/module/src/NavigationContainerRefContext.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationContext.d.ts +8 -0
- package/lib/typescript/module/src/NavigationContext.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationHelpersContext.d.ts +9 -0
- package/lib/typescript/module/src/NavigationHelpersContext.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationIndependentTree.d.ts +8 -0
- package/lib/typescript/module/src/NavigationIndependentTree.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationIndependentTreeContext.d.ts +6 -0
- package/lib/typescript/module/src/NavigationIndependentTreeContext.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationRouteContext.d.ts +7 -0
- package/lib/typescript/module/src/NavigationRouteContext.d.ts.map +1 -0
- package/lib/typescript/module/src/NavigationStateContext.d.ts +13 -0
- package/lib/typescript/module/src/NavigationStateContext.d.ts.map +1 -0
- package/lib/typescript/module/src/PreventRemoveContext.d.ts +13 -0
- package/lib/typescript/module/src/PreventRemoveContext.d.ts.map +1 -0
- package/lib/typescript/module/src/PreventRemoveProvider.d.ts +10 -0
- package/lib/typescript/module/src/PreventRemoveProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/SceneView.d.ts +21 -0
- package/lib/typescript/module/src/SceneView.d.ts.map +1 -0
- package/lib/typescript/module/src/Screen.d.ts +7 -0
- package/lib/typescript/module/src/Screen.d.ts.map +1 -0
- package/lib/typescript/module/src/StaticContainer.d.ts +6 -0
- package/lib/typescript/module/src/StaticContainer.d.ts.map +1 -0
- package/lib/typescript/module/src/StaticNavigation.d.ts +188 -0
- package/lib/typescript/module/src/StaticNavigation.d.ts.map +1 -0
- package/lib/typescript/module/src/UnhandledActionContext.d.ts +4 -0
- package/lib/typescript/module/src/UnhandledActionContext.d.ts.map +1 -0
- package/lib/typescript/module/src/checkDuplicateRouteNames.d.ts +3 -0
- package/lib/typescript/module/src/checkDuplicateRouteNames.d.ts.map +1 -0
- package/lib/typescript/module/src/checkSerializable.d.ts +10 -0
- package/lib/typescript/module/src/checkSerializable.d.ts.map +1 -0
- package/lib/typescript/module/src/createNavigationContainerRef.d.ts +4 -0
- package/lib/typescript/module/src/createNavigationContainerRef.d.ts.map +1 -0
- package/lib/typescript/module/src/createNavigatorFactory.d.ts +10 -0
- package/lib/typescript/module/src/createNavigatorFactory.d.ts.map +1 -0
- package/lib/typescript/module/src/deepFreeze.d.ts +3 -0
- package/lib/typescript/module/src/deepFreeze.d.ts.map +1 -0
- package/lib/typescript/module/src/findFocusedRoute.d.ts +5 -0
- package/lib/typescript/module/src/findFocusedRoute.d.ts.map +1 -0
- package/lib/typescript/module/src/getActionFromState.d.ts +17 -0
- package/lib/typescript/module/src/getActionFromState.d.ts.map +1 -0
- package/lib/typescript/module/src/getFocusedRouteNameFromRoute.d.ts +3 -0
- package/lib/typescript/module/src/getFocusedRouteNameFromRoute.d.ts.map +1 -0
- package/lib/typescript/module/src/getPathFromState.d.ts +40 -0
- package/lib/typescript/module/src/getPathFromState.d.ts.map +1 -0
- package/lib/typescript/module/src/getStateFromPath.d.ts +34 -0
- package/lib/typescript/module/src/getStateFromPath.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +34 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/isArrayEqual.d.ts +6 -0
- package/lib/typescript/module/src/isArrayEqual.d.ts.map +1 -0
- package/lib/typescript/module/src/isRecordEqual.d.ts +5 -0
- package/lib/typescript/module/src/isRecordEqual.d.ts.map +1 -0
- package/lib/typescript/module/src/theming/ThemeContext.d.ts +3 -0
- package/lib/typescript/module/src/theming/ThemeContext.d.ts.map +1 -0
- package/lib/typescript/module/src/theming/ThemeProvider.d.ts +8 -0
- package/lib/typescript/module/src/theming/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/module/src/theming/useTheme.d.ts +2 -0
- package/lib/typescript/module/src/theming/useTheme.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +702 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/lib/typescript/module/src/useChildListeners.d.ts +12 -0
- package/lib/typescript/module/src/useChildListeners.d.ts.map +1 -0
- package/lib/typescript/module/src/useComponent.d.ts +7 -0
- package/lib/typescript/module/src/useComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/useCurrentRender.d.ts +14 -0
- package/lib/typescript/module/src/useCurrentRender.d.ts.map +1 -0
- package/lib/typescript/module/src/useDescriptors.d.ts +133 -0
- package/lib/typescript/module/src/useDescriptors.d.ts.map +1 -0
- package/lib/typescript/module/src/useEventEmitter.d.ts +9 -0
- package/lib/typescript/module/src/useEventEmitter.d.ts.map +1 -0
- package/lib/typescript/module/src/useFocusEffect.d.ts +11 -0
- package/lib/typescript/module/src/useFocusEffect.d.ts.map +1 -0
- package/lib/typescript/module/src/useFocusEvents.d.ts +13 -0
- package/lib/typescript/module/src/useFocusEvents.d.ts.map +1 -0
- package/lib/typescript/module/src/useFocusedListenersChildrenAdapter.d.ts +13 -0
- package/lib/typescript/module/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -0
- package/lib/typescript/module/src/useIsFocused.d.ts +6 -0
- package/lib/typescript/module/src/useIsFocused.d.ts.map +1 -0
- package/lib/typescript/module/src/useIsomorphicLayoutEffect.d.ts +6 -0
- package/lib/typescript/module/src/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/lib/typescript/module/src/useIsomorphicLayoutEffect.native.d.ts +3 -0
- package/lib/typescript/module/src/useIsomorphicLayoutEffect.native.d.ts.map +1 -0
- package/lib/typescript/module/src/useKeyedChildListeners.d.ts +12 -0
- package/lib/typescript/module/src/useKeyedChildListeners.d.ts.map +1 -0
- package/lib/typescript/module/src/useLazyValue.d.ts +2 -0
- package/lib/typescript/module/src/useLazyValue.d.ts.map +1 -0
- package/lib/typescript/module/src/useNavigation.d.ts +11 -0
- package/lib/typescript/module/src/useNavigation.d.ts.map +1 -0
- package/lib/typescript/module/src/useNavigationBuilder.d.ts +181 -0
- package/lib/typescript/module/src/useNavigationBuilder.d.ts.map +1 -0
- package/lib/typescript/module/src/useNavigationCache.d.ts +65 -0
- package/lib/typescript/module/src/useNavigationCache.d.ts.map +1 -0
- package/lib/typescript/module/src/useNavigationContainerRef.d.ts +3 -0
- package/lib/typescript/module/src/useNavigationContainerRef.d.ts.map +1 -0
- package/lib/typescript/module/src/useNavigationHelpers.d.ts +96 -0
- package/lib/typescript/module/src/useNavigationHelpers.d.ts.map +1 -0
- package/lib/typescript/module/src/useNavigationIndependentTree.d.ts +2 -0
- package/lib/typescript/module/src/useNavigationIndependentTree.d.ts.map +1 -0
- package/lib/typescript/module/src/useNavigationState.d.ts +10 -0
- package/lib/typescript/module/src/useNavigationState.d.ts.map +1 -0
- package/lib/typescript/module/src/useOnAction.d.ts +26 -0
- package/lib/typescript/module/src/useOnAction.d.ts.map +1 -0
- package/lib/typescript/module/src/useOnGetState.d.ts +9 -0
- package/lib/typescript/module/src/useOnGetState.d.ts.map +1 -0
- package/lib/typescript/module/src/useOnPreventRemove.d.ts +17 -0
- package/lib/typescript/module/src/useOnPreventRemove.d.ts.map +1 -0
- package/lib/typescript/module/src/useOnRouteFocus.d.ts +15 -0
- package/lib/typescript/module/src/useOnRouteFocus.d.ts.map +1 -0
- package/lib/typescript/module/src/useOptionsGetters.d.ts +13 -0
- package/lib/typescript/module/src/useOptionsGetters.d.ts.map +1 -0
- package/lib/typescript/module/src/usePreventRemove.d.ts +13 -0
- package/lib/typescript/module/src/usePreventRemove.d.ts.map +1 -0
- package/lib/typescript/module/src/usePreventRemoveContext.d.ts +5 -0
- package/lib/typescript/module/src/usePreventRemoveContext.d.ts.map +1 -0
- package/lib/typescript/module/src/useRegisterNavigator.d.ts +6 -0
- package/lib/typescript/module/src/useRegisterNavigator.d.ts.map +1 -0
- package/lib/typescript/module/src/useRoute.d.ts +9 -0
- package/lib/typescript/module/src/useRoute.d.ts.map +1 -0
- package/lib/typescript/module/src/useRouteCache.d.ts +14 -0
- package/lib/typescript/module/src/useRouteCache.d.ts.map +1 -0
- package/lib/typescript/module/src/useSyncState.d.ts +2 -0
- package/lib/typescript/module/src/useSyncState.d.ts.map +1 -0
- package/lib/typescript/module/src/validatePathConfig.d.ts +2 -0
- package/lib/typescript/module/src/validatePathConfig.d.ts.map +1 -0
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +18 -11
- package/src/BaseNavigationContainer.tsx +1 -1
- package/src/StaticNavigation.tsx +2 -0
- package/src/getPathFromState.tsx +20 -4
- package/src/getStateFromPath.tsx +124 -63
- package/src/types.tsx +33 -46
- package/src/useNavigationBuilder.tsx +18 -1
- package/src/validatePathConfig.tsx +1 -1
- package/lib/commonjs/BaseNavigationContainer.cjs +0 -356
- package/lib/commonjs/BaseNavigationContainer.cjs.map +0 -1
- package/lib/commonjs/CurrentRenderContext.cjs +0 -15
- package/lib/commonjs/DeprecatedNavigationInChildContext.cjs +0 -14
- package/lib/commonjs/EnsureSingleNavigator.cjs +0 -43
- package/lib/commonjs/Group.cjs +0 -14
- package/lib/commonjs/NavigationBuilderContext.cjs +0 -17
- package/lib/commonjs/NavigationContainerRefContext.cjs +0 -14
- package/lib/commonjs/NavigationContext.cjs +0 -14
- package/lib/commonjs/NavigationHelpersContext.cjs +0 -15
- package/lib/commonjs/NavigationIndependentTree.cjs +0 -35
- package/lib/commonjs/NavigationIndependentTreeContext.cjs +0 -14
- package/lib/commonjs/NavigationRouteContext.cjs +0 -14
- package/lib/commonjs/NavigationStateContext.cjs +0 -29
- package/lib/commonjs/PreventRemoveContext.cjs +0 -16
- package/lib/commonjs/PreventRemoveProvider.cjs +0 -91
- package/lib/commonjs/SceneView.cjs +0 -96
- package/lib/commonjs/Screen.cjs +0 -14
- package/lib/commonjs/StaticContainer.cjs +0 -31
- package/lib/commonjs/StaticNavigation.cjs +0 -255
- package/lib/commonjs/StaticNavigation.cjs.map +0 -1
- package/lib/commonjs/UnhandledActionContext.cjs +0 -11
- package/lib/commonjs/checkDuplicateRouteNames.cjs +0 -25
- package/lib/commonjs/checkSerializable.cjs +0 -50
- package/lib/commonjs/createNavigationContainerRef.cjs +0 -69
- package/lib/commonjs/createNavigatorFactory.cjs +0 -34
- package/lib/commonjs/deepFreeze.cjs +0 -37
- package/lib/commonjs/findFocusedRoute.cjs +0 -15
- package/lib/commonjs/getActionFromState.cjs +0 -86
- package/lib/commonjs/getFocusedRouteNameFromRoute.cjs +0 -22
- package/lib/commonjs/getPathFromState.cjs +0 -211
- package/lib/commonjs/getPathFromState.cjs.map +0 -1
- package/lib/commonjs/getStateFromPath.cjs +0 -438
- package/lib/commonjs/getStateFromPath.cjs.map +0 -1
- package/lib/commonjs/index.cjs +0 -287
- package/lib/commonjs/isArrayEqual.cjs +0 -20
- package/lib/commonjs/isRecordEqual.cjs +0 -21
- package/lib/commonjs/theming/ThemeContext.cjs +0 -12
- package/lib/commonjs/theming/ThemeProvider.cjs +0 -21
- package/lib/commonjs/theming/useTheme.cjs +0 -18
- package/lib/commonjs/types.cjs +0 -9
- package/lib/commonjs/types.cjs.map +0 -1
- package/lib/commonjs/useChildListeners.cjs +0 -36
- package/lib/commonjs/useComponent.cjs +0 -40
- package/lib/commonjs/useCurrentRender.cjs +0 -25
- package/lib/commonjs/useDescriptors.cjs +0 -188
- package/lib/commonjs/useEventEmitter.cjs +0 -105
- package/lib/commonjs/useFocusEffect.cjs +0 -80
- package/lib/commonjs/useFocusEvents.cjs +0 -70
- package/lib/commonjs/useFocusedListenersChildrenAdapter.cjs +0 -48
- package/lib/commonjs/useIsFocused.cjs +0 -28
- package/lib/commonjs/useIsomorphicLayoutEffect.cjs +0 -12
- package/lib/commonjs/useIsomorphicLayoutEffect.native.cjs +0 -9
- package/lib/commonjs/useKeyedChildListeners.cjs +0 -33
- package/lib/commonjs/useLazyValue.cjs +0 -17
- package/lib/commonjs/useNavigation.cjs +0 -27
- package/lib/commonjs/useNavigationBuilder.cjs +0 -478
- package/lib/commonjs/useNavigationBuilder.cjs.map +0 -1
- package/lib/commonjs/useNavigationCache.cjs +0 -162
- package/lib/commonjs/useNavigationContainerRef.cjs +0 -18
- package/lib/commonjs/useNavigationHelpers.cjs +0 -76
- package/lib/commonjs/useNavigationIndependentTree.cjs +0 -14
- package/lib/commonjs/useNavigationState.cjs +0 -26
- package/lib/commonjs/useOnAction.cjs +0 -106
- package/lib/commonjs/useOnGetState.cjs +0 -48
- package/lib/commonjs/useOnPreventRemove.cjs +0 -72
- package/lib/commonjs/useOnRouteFocus.cjs +0 -36
- package/lib/commonjs/useOptionsGetters.cjs +0 -78
- package/lib/commonjs/usePreventRemove.cjs +0 -48
- package/lib/commonjs/usePreventRemoveContext.cjs +0 -18
- package/lib/commonjs/useRegisterNavigator.cjs +0 -32
- package/lib/commonjs/useRoute.cjs +0 -23
- package/lib/commonjs/useRouteCache.cjs +0 -69
- package/lib/commonjs/useSyncState.cjs +0 -48
- package/lib/commonjs/validatePathConfig.cjs +0 -49
- package/lib/commonjs/validatePathConfig.cjs.map +0 -1
- package/lib/module/BaseNavigationContainer.mjs +0 -347
- package/lib/module/BaseNavigationContainer.mjs.map +0 -1
- package/lib/module/CurrentRenderContext.mjs +0 -8
- package/lib/module/CurrentRenderContext.mjs.map +0 -1
- package/lib/module/DeprecatedNavigationInChildContext.mjs +0 -7
- package/lib/module/DeprecatedNavigationInChildContext.mjs.map +0 -1
- package/lib/module/EnsureSingleNavigator.mjs +0 -34
- package/lib/module/EnsureSingleNavigator.mjs.map +0 -1
- package/lib/module/Group.mjs +0 -8
- package/lib/module/Group.mjs.map +0 -1
- package/lib/module/NavigationBuilderContext.mjs +0 -9
- package/lib/module/NavigationBuilderContext.mjs.map +0 -1
- package/lib/module/NavigationContainerRefContext.mjs +0 -6
- package/lib/module/NavigationContainerRefContext.mjs.map +0 -1
- package/lib/module/NavigationContext.mjs +0 -6
- package/lib/module/NavigationContext.mjs.map +0 -1
- package/lib/module/NavigationHelpersContext.mjs +0 -7
- package/lib/module/NavigationHelpersContext.mjs.map +0 -1
- package/lib/module/NavigationIndependentTree.mjs +0 -28
- package/lib/module/NavigationIndependentTree.mjs.map +0 -1
- package/lib/module/NavigationIndependentTreeContext.mjs +0 -7
- package/lib/module/NavigationIndependentTreeContext.mjs.map +0 -1
- package/lib/module/NavigationRouteContext.mjs +0 -7
- package/lib/module/NavigationRouteContext.mjs.map +0 -1
- package/lib/module/NavigationStateContext.mjs +0 -21
- package/lib/module/NavigationStateContext.mjs.map +0 -1
- package/lib/module/PreventRemoveContext.mjs +0 -9
- package/lib/module/PreventRemoveContext.mjs.map +0 -1
- package/lib/module/PreventRemoveProvider.mjs +0 -82
- package/lib/module/PreventRemoveProvider.mjs.map +0 -1
- package/lib/module/SceneView.mjs +0 -88
- package/lib/module/SceneView.mjs.map +0 -1
- package/lib/module/Screen.mjs +0 -8
- package/lib/module/Screen.mjs.map +0 -1
- package/lib/module/StaticContainer.mjs +0 -24
- package/lib/module/StaticContainer.mjs.map +0 -1
- package/lib/module/StaticNavigation.mjs +0 -246
- package/lib/module/StaticNavigation.mjs.map +0 -1
- package/lib/module/UnhandledActionContext.mjs +0 -3
- package/lib/module/UnhandledActionContext.mjs.map +0 -1
- package/lib/module/checkDuplicateRouteNames.mjs +0 -19
- package/lib/module/checkDuplicateRouteNames.mjs.map +0 -1
- package/lib/module/checkSerializable.mjs +0 -44
- package/lib/module/checkSerializable.mjs.map +0 -1
- package/lib/module/createNavigationContainerRef.mjs +0 -62
- package/lib/module/createNavigationContainerRef.mjs.map +0 -1
- package/lib/module/createNavigatorFactory.mjs +0 -29
- package/lib/module/createNavigatorFactory.mjs.map +0 -1
- package/lib/module/deepFreeze.mjs +0 -29
- package/lib/module/deepFreeze.mjs.map +0 -1
- package/lib/module/findFocusedRoute.mjs +0 -9
- package/lib/module/findFocusedRoute.mjs.map +0 -1
- package/lib/module/getActionFromState.mjs +0 -80
- package/lib/module/getActionFromState.mjs.map +0 -1
- package/lib/module/getFocusedRouteNameFromRoute.mjs +0 -16
- package/lib/module/getFocusedRouteNameFromRoute.mjs.map +0 -1
- package/lib/module/getPathFromState.mjs +0 -203
- package/lib/module/getPathFromState.mjs.map +0 -1
- package/lib/module/getStateFromPath.mjs +0 -429
- package/lib/module/getStateFromPath.mjs.map +0 -1
- package/lib/module/index.mjs +0 -34
- package/lib/module/index.mjs.map +0 -1
- package/lib/module/isArrayEqual.mjs +0 -14
- package/lib/module/isArrayEqual.mjs.map +0 -1
- package/lib/module/isRecordEqual.mjs +0 -15
- package/lib/module/isRecordEqual.mjs.map +0 -1
- package/lib/module/theming/ThemeContext.mjs +0 -4
- package/lib/module/theming/ThemeContext.mjs.map +0 -1
- package/lib/module/theming/ThemeProvider.mjs +0 -13
- package/lib/module/theming/ThemeProvider.mjs.map +0 -1
- package/lib/module/theming/useTheme.mjs +0 -10
- package/lib/module/theming/useTheme.mjs.map +0 -1
- package/lib/module/types.mjs +0 -2
- package/lib/module/types.mjs.map +0 -1
- package/lib/module/useChildListeners.mjs +0 -28
- package/lib/module/useChildListeners.mjs.map +0 -1
- package/lib/module/useComponent.mjs +0 -32
- package/lib/module/useComponent.mjs.map +0 -1
- package/lib/module/useCurrentRender.mjs +0 -17
- package/lib/module/useCurrentRender.mjs.map +0 -1
- package/lib/module/useDescriptors.mjs +0 -180
- package/lib/module/useDescriptors.mjs.map +0 -1
- package/lib/module/useEventEmitter.mjs +0 -97
- package/lib/module/useEventEmitter.mjs.map +0 -1
- package/lib/module/useFocusEffect.mjs +0 -72
- package/lib/module/useFocusEffect.mjs.map +0 -1
- package/lib/module/useFocusEvents.mjs +0 -62
- package/lib/module/useFocusEvents.mjs.map +0 -1
- package/lib/module/useFocusedListenersChildrenAdapter.mjs +0 -40
- package/lib/module/useFocusedListenersChildrenAdapter.mjs.map +0 -1
- package/lib/module/useIsFocused.mjs +0 -21
- package/lib/module/useIsFocused.mjs.map +0 -1
- package/lib/module/useIsomorphicLayoutEffect.mjs +0 -7
- package/lib/module/useIsomorphicLayoutEffect.mjs.map +0 -1
- package/lib/module/useIsomorphicLayoutEffect.native.mjs +0 -3
- package/lib/module/useIsomorphicLayoutEffect.native.mjs.map +0 -1
- package/lib/module/useKeyedChildListeners.mjs +0 -25
- package/lib/module/useKeyedChildListeners.mjs.map +0 -1
- package/lib/module/useLazyValue.mjs +0 -9
- package/lib/module/useLazyValue.mjs.map +0 -1
- package/lib/module/useNavigation.mjs +0 -19
- package/lib/module/useNavigation.mjs.map +0 -1
- package/lib/module/useNavigationBuilder.mjs +0 -470
- package/lib/module/useNavigationBuilder.mjs.map +0 -1
- package/lib/module/useNavigationCache.mjs +0 -154
- package/lib/module/useNavigationCache.mjs.map +0 -1
- package/lib/module/useNavigationContainerRef.mjs +0 -10
- package/lib/module/useNavigationContainerRef.mjs.map +0 -1
- package/lib/module/useNavigationHelpers.mjs +0 -68
- package/lib/module/useNavigationHelpers.mjs.map +0 -1
- package/lib/module/useNavigationIndependentTree.mjs +0 -6
- package/lib/module/useNavigationIndependentTree.mjs.map +0 -1
- package/lib/module/useNavigationState.mjs +0 -18
- package/lib/module/useNavigationState.mjs.map +0 -1
- package/lib/module/useOnAction.mjs +0 -98
- package/lib/module/useOnAction.mjs.map +0 -1
- package/lib/module/useOnGetState.mjs +0 -40
- package/lib/module/useOnGetState.mjs.map +0 -1
- package/lib/module/useOnPreventRemove.mjs +0 -62
- package/lib/module/useOnPreventRemove.mjs.map +0 -1
- package/lib/module/useOnRouteFocus.mjs +0 -28
- package/lib/module/useOnRouteFocus.mjs.map +0 -1
- package/lib/module/useOptionsGetters.mjs +0 -70
- package/lib/module/useOptionsGetters.mjs.map +0 -1
- package/lib/module/usePreventRemove.mjs +0 -40
- package/lib/module/usePreventRemove.mjs.map +0 -1
- package/lib/module/usePreventRemoveContext.mjs +0 -10
- package/lib/module/usePreventRemoveContext.mjs.map +0 -1
- package/lib/module/useRegisterNavigator.mjs +0 -25
- package/lib/module/useRegisterNavigator.mjs.map +0 -1
- package/lib/module/useRoute.mjs +0 -15
- package/lib/module/useRoute.mjs.map +0 -1
- package/lib/module/useRouteCache.mjs +0 -60
- package/lib/module/useRouteCache.mjs.map +0 -1
- package/lib/module/useSyncState.mjs +0 -40
- package/lib/module/useSyncState.mjs.map +0 -1
- package/lib/module/validatePathConfig.mjs +0 -43
- package/lib/module/validatePathConfig.mjs.map +0 -1
- package/lib/typescript/src/BaseNavigationContainer.d.ts.map +0 -1
- package/lib/typescript/src/CurrentRenderContext.d.ts.map +0 -1
- package/lib/typescript/src/DeprecatedNavigationInChildContext.d.ts.map +0 -1
- package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +0 -1
- package/lib/typescript/src/Group.d.ts.map +0 -1
- package/lib/typescript/src/NavigationBuilderContext.d.ts.map +0 -1
- package/lib/typescript/src/NavigationContainerRefContext.d.ts.map +0 -1
- package/lib/typescript/src/NavigationContext.d.ts.map +0 -1
- package/lib/typescript/src/NavigationHelpersContext.d.ts.map +0 -1
- package/lib/typescript/src/NavigationIndependentTree.d.ts.map +0 -1
- package/lib/typescript/src/NavigationIndependentTreeContext.d.ts.map +0 -1
- package/lib/typescript/src/NavigationRouteContext.d.ts.map +0 -1
- package/lib/typescript/src/NavigationStateContext.d.ts.map +0 -1
- package/lib/typescript/src/PreventRemoveContext.d.ts.map +0 -1
- package/lib/typescript/src/PreventRemoveProvider.d.ts.map +0 -1
- package/lib/typescript/src/SceneView.d.ts.map +0 -1
- package/lib/typescript/src/Screen.d.ts.map +0 -1
- package/lib/typescript/src/StaticContainer.d.ts.map +0 -1
- package/lib/typescript/src/StaticNavigation.d.ts.map +0 -1
- package/lib/typescript/src/UnhandledActionContext.d.ts.map +0 -1
- package/lib/typescript/src/checkDuplicateRouteNames.d.ts.map +0 -1
- package/lib/typescript/src/checkSerializable.d.ts.map +0 -1
- package/lib/typescript/src/createNavigationContainerRef.d.ts.map +0 -1
- package/lib/typescript/src/createNavigatorFactory.d.ts.map +0 -1
- package/lib/typescript/src/deepFreeze.d.ts.map +0 -1
- package/lib/typescript/src/findFocusedRoute.d.ts.map +0 -1
- package/lib/typescript/src/getActionFromState.d.ts.map +0 -1
- package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts.map +0 -1
- package/lib/typescript/src/getPathFromState.d.ts.map +0 -1
- package/lib/typescript/src/getStateFromPath.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/isArrayEqual.d.ts.map +0 -1
- package/lib/typescript/src/isRecordEqual.d.ts.map +0 -1
- package/lib/typescript/src/theming/ThemeContext.d.ts.map +0 -1
- package/lib/typescript/src/theming/ThemeProvider.d.ts.map +0 -1
- package/lib/typescript/src/theming/useTheme.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts +0 -695
- package/lib/typescript/src/types.d.ts.map +0 -1
- package/lib/typescript/src/useChildListeners.d.ts.map +0 -1
- package/lib/typescript/src/useComponent.d.ts.map +0 -1
- package/lib/typescript/src/useCurrentRender.d.ts.map +0 -1
- package/lib/typescript/src/useDescriptors.d.ts +0 -133
- package/lib/typescript/src/useDescriptors.d.ts.map +0 -1
- package/lib/typescript/src/useEventEmitter.d.ts.map +0 -1
- package/lib/typescript/src/useFocusEffect.d.ts.map +0 -1
- package/lib/typescript/src/useFocusEvents.d.ts.map +0 -1
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +0 -1
- package/lib/typescript/src/useIsFocused.d.ts.map +0 -1
- package/lib/typescript/src/useIsomorphicLayoutEffect.d.ts.map +0 -1
- package/lib/typescript/src/useIsomorphicLayoutEffect.native.d.ts.map +0 -1
- package/lib/typescript/src/useKeyedChildListeners.d.ts.map +0 -1
- package/lib/typescript/src/useLazyValue.d.ts.map +0 -1
- package/lib/typescript/src/useNavigation.d.ts.map +0 -1
- package/lib/typescript/src/useNavigationBuilder.d.ts +0 -181
- package/lib/typescript/src/useNavigationBuilder.d.ts.map +0 -1
- package/lib/typescript/src/useNavigationCache.d.ts +0 -65
- package/lib/typescript/src/useNavigationCache.d.ts.map +0 -1
- package/lib/typescript/src/useNavigationContainerRef.d.ts.map +0 -1
- package/lib/typescript/src/useNavigationHelpers.d.ts +0 -96
- package/lib/typescript/src/useNavigationHelpers.d.ts.map +0 -1
- package/lib/typescript/src/useNavigationIndependentTree.d.ts.map +0 -1
- package/lib/typescript/src/useNavigationState.d.ts.map +0 -1
- package/lib/typescript/src/useOnAction.d.ts.map +0 -1
- package/lib/typescript/src/useOnGetState.d.ts.map +0 -1
- package/lib/typescript/src/useOnPreventRemove.d.ts.map +0 -1
- package/lib/typescript/src/useOnRouteFocus.d.ts.map +0 -1
- package/lib/typescript/src/useOptionsGetters.d.ts.map +0 -1
- package/lib/typescript/src/usePreventRemove.d.ts.map +0 -1
- package/lib/typescript/src/usePreventRemoveContext.d.ts.map +0 -1
- package/lib/typescript/src/useRegisterNavigator.d.ts.map +0 -1
- package/lib/typescript/src/useRoute.d.ts.map +0 -1
- package/lib/typescript/src/useRouteCache.d.ts.map +0 -1
- package/lib/typescript/src/useSyncState.d.ts.map +0 -1
- package/lib/typescript/src/validatePathConfig.d.ts.map +0 -1
- package/lib/typescript/utils/usePrevious.d.ts +0 -6
- package/lib/typescript/utils/usePrevious.d.ts.map +0 -1
- /package/lib/commonjs/{CurrentRenderContext.cjs.map → CurrentRenderContext.js.map} +0 -0
- /package/lib/commonjs/{DeprecatedNavigationInChildContext.cjs.map → DeprecatedNavigationInChildContext.js.map} +0 -0
- /package/lib/commonjs/{EnsureSingleNavigator.cjs.map → EnsureSingleNavigator.js.map} +0 -0
- /package/lib/commonjs/{Group.cjs.map → Group.js.map} +0 -0
- /package/lib/commonjs/{NavigationBuilderContext.cjs.map → NavigationBuilderContext.js.map} +0 -0
- /package/lib/commonjs/{NavigationContainerRefContext.cjs.map → NavigationContainerRefContext.js.map} +0 -0
- /package/lib/commonjs/{NavigationContext.cjs.map → NavigationContext.js.map} +0 -0
- /package/lib/commonjs/{NavigationHelpersContext.cjs.map → NavigationHelpersContext.js.map} +0 -0
- /package/lib/commonjs/{NavigationIndependentTree.cjs.map → NavigationIndependentTree.js.map} +0 -0
- /package/lib/commonjs/{NavigationIndependentTreeContext.cjs.map → NavigationIndependentTreeContext.js.map} +0 -0
- /package/lib/commonjs/{NavigationRouteContext.cjs.map → NavigationRouteContext.js.map} +0 -0
- /package/lib/commonjs/{NavigationStateContext.cjs.map → NavigationStateContext.js.map} +0 -0
- /package/lib/commonjs/{PreventRemoveContext.cjs.map → PreventRemoveContext.js.map} +0 -0
- /package/lib/commonjs/{PreventRemoveProvider.cjs.map → PreventRemoveProvider.js.map} +0 -0
- /package/lib/commonjs/{SceneView.cjs.map → SceneView.js.map} +0 -0
- /package/lib/commonjs/{Screen.cjs.map → Screen.js.map} +0 -0
- /package/lib/commonjs/{StaticContainer.cjs.map → StaticContainer.js.map} +0 -0
- /package/lib/commonjs/{UnhandledActionContext.cjs.map → UnhandledActionContext.js.map} +0 -0
- /package/lib/commonjs/{checkDuplicateRouteNames.cjs.map → checkDuplicateRouteNames.js.map} +0 -0
- /package/lib/commonjs/{checkSerializable.cjs.map → checkSerializable.js.map} +0 -0
- /package/lib/commonjs/{createNavigationContainerRef.cjs.map → createNavigationContainerRef.js.map} +0 -0
- /package/lib/commonjs/{createNavigatorFactory.cjs.map → createNavigatorFactory.js.map} +0 -0
- /package/lib/commonjs/{deepFreeze.cjs.map → deepFreeze.js.map} +0 -0
- /package/lib/commonjs/{findFocusedRoute.cjs.map → findFocusedRoute.js.map} +0 -0
- /package/lib/commonjs/{getActionFromState.cjs.map → getActionFromState.js.map} +0 -0
- /package/lib/commonjs/{getFocusedRouteNameFromRoute.cjs.map → getFocusedRouteNameFromRoute.js.map} +0 -0
- /package/lib/commonjs/{index.cjs.map → index.js.map} +0 -0
- /package/lib/commonjs/{isArrayEqual.cjs.map → isArrayEqual.js.map} +0 -0
- /package/lib/commonjs/{isRecordEqual.cjs.map → isRecordEqual.js.map} +0 -0
- /package/lib/commonjs/theming/{ThemeContext.cjs.map → ThemeContext.js.map} +0 -0
- /package/lib/commonjs/theming/{ThemeProvider.cjs.map → ThemeProvider.js.map} +0 -0
- /package/lib/commonjs/theming/{useTheme.cjs.map → useTheme.js.map} +0 -0
- /package/lib/commonjs/{useChildListeners.cjs.map → useChildListeners.js.map} +0 -0
- /package/lib/commonjs/{useComponent.cjs.map → useComponent.js.map} +0 -0
- /package/lib/commonjs/{useCurrentRender.cjs.map → useCurrentRender.js.map} +0 -0
- /package/lib/commonjs/{useDescriptors.cjs.map → useDescriptors.js.map} +0 -0
- /package/lib/commonjs/{useEventEmitter.cjs.map → useEventEmitter.js.map} +0 -0
- /package/lib/commonjs/{useFocusEffect.cjs.map → useFocusEffect.js.map} +0 -0
- /package/lib/commonjs/{useFocusEvents.cjs.map → useFocusEvents.js.map} +0 -0
- /package/lib/commonjs/{useFocusedListenersChildrenAdapter.cjs.map → useFocusedListenersChildrenAdapter.js.map} +0 -0
- /package/lib/commonjs/{useIsFocused.cjs.map → useIsFocused.js.map} +0 -0
- /package/lib/commonjs/{useIsomorphicLayoutEffect.cjs.map → useIsomorphicLayoutEffect.js.map} +0 -0
- /package/lib/commonjs/{useIsomorphicLayoutEffect.native.cjs.map → useIsomorphicLayoutEffect.native.js.map} +0 -0
- /package/lib/commonjs/{useKeyedChildListeners.cjs.map → useKeyedChildListeners.js.map} +0 -0
- /package/lib/commonjs/{useLazyValue.cjs.map → useLazyValue.js.map} +0 -0
- /package/lib/commonjs/{useNavigation.cjs.map → useNavigation.js.map} +0 -0
- /package/lib/commonjs/{useNavigationCache.cjs.map → useNavigationCache.js.map} +0 -0
- /package/lib/commonjs/{useNavigationContainerRef.cjs.map → useNavigationContainerRef.js.map} +0 -0
- /package/lib/commonjs/{useNavigationHelpers.cjs.map → useNavigationHelpers.js.map} +0 -0
- /package/lib/commonjs/{useNavigationIndependentTree.cjs.map → useNavigationIndependentTree.js.map} +0 -0
- /package/lib/commonjs/{useNavigationState.cjs.map → useNavigationState.js.map} +0 -0
- /package/lib/commonjs/{useOnAction.cjs.map → useOnAction.js.map} +0 -0
- /package/lib/commonjs/{useOnGetState.cjs.map → useOnGetState.js.map} +0 -0
- /package/lib/commonjs/{useOnPreventRemove.cjs.map → useOnPreventRemove.js.map} +0 -0
- /package/lib/commonjs/{useOnRouteFocus.cjs.map → useOnRouteFocus.js.map} +0 -0
- /package/lib/commonjs/{useOptionsGetters.cjs.map → useOptionsGetters.js.map} +0 -0
- /package/lib/commonjs/{usePreventRemove.cjs.map → usePreventRemove.js.map} +0 -0
- /package/lib/commonjs/{usePreventRemoveContext.cjs.map → usePreventRemoveContext.js.map} +0 -0
- /package/lib/commonjs/{useRegisterNavigator.cjs.map → useRegisterNavigator.js.map} +0 -0
- /package/lib/commonjs/{useRoute.cjs.map → useRoute.js.map} +0 -0
- /package/lib/commonjs/{useRouteCache.cjs.map → useRouteCache.js.map} +0 -0
- /package/lib/commonjs/{useSyncState.cjs.map → useSyncState.js.map} +0 -0
- /package/lib/typescript/{src → commonjs/src}/BaseNavigationContainer.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/CurrentRenderContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/DeprecatedNavigationInChildContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/EnsureSingleNavigator.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Group.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/NavigationBuilderContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/NavigationContainerRefContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/NavigationContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/NavigationHelpersContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/NavigationIndependentTree.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/NavigationIndependentTreeContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/NavigationRouteContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/NavigationStateContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/PreventRemoveContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/PreventRemoveProvider.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/SceneView.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/Screen.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/StaticContainer.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/StaticNavigation.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/UnhandledActionContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/checkDuplicateRouteNames.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/checkSerializable.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/createNavigationContainerRef.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/createNavigatorFactory.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/deepFreeze.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/findFocusedRoute.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/getActionFromState.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/getFocusedRouteNameFromRoute.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/getPathFromState.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/getStateFromPath.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/isArrayEqual.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/isRecordEqual.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/theming/ThemeContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/theming/ThemeProvider.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/theming/useTheme.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useChildListeners.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useComponent.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useCurrentRender.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useEventEmitter.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useFocusEffect.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useFocusEvents.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useFocusedListenersChildrenAdapter.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useIsFocused.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useIsomorphicLayoutEffect.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useIsomorphicLayoutEffect.native.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useKeyedChildListeners.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useLazyValue.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useNavigation.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useNavigationContainerRef.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useNavigationIndependentTree.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useNavigationState.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useOnAction.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useOnGetState.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useOnPreventRemove.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useOnRouteFocus.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useOptionsGetters.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/usePreventRemove.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/usePreventRemoveContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useRegisterNavigator.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useRoute.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useRouteCache.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/useSyncState.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/validatePathConfig.d.ts +0 -0
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import * as queryString from 'query-string';
|
|
2
|
-
import { validatePathConfig } from "./validatePathConfig.mjs";
|
|
3
|
-
const getActiveRoute = state => {
|
|
4
|
-
const route = typeof state.index === 'number' ? state.routes[state.index] : state.routes[state.routes.length - 1];
|
|
5
|
-
if (route.state) {
|
|
6
|
-
return getActiveRoute(route.state);
|
|
7
|
-
}
|
|
8
|
-
return route;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Utility to serialize a navigation state object to a path string.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```js
|
|
16
|
-
* getPathFromState(
|
|
17
|
-
* {
|
|
18
|
-
* routes: [
|
|
19
|
-
* {
|
|
20
|
-
* name: 'Chat',
|
|
21
|
-
* params: { author: 'Jane', id: 42 },
|
|
22
|
-
* },
|
|
23
|
-
* ],
|
|
24
|
-
* },
|
|
25
|
-
* {
|
|
26
|
-
* screens: {
|
|
27
|
-
* Chat: {
|
|
28
|
-
* path: 'chat/:author/:id',
|
|
29
|
-
* stringify: { author: author => author.toLowerCase() }
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* )
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @param state Navigation state to serialize.
|
|
37
|
-
* @param options Extra options to fine-tune how to serialize the path.
|
|
38
|
-
* @returns Path representing the state, e.g. /foo/bar?count=42.
|
|
39
|
-
*/
|
|
40
|
-
export function getPathFromState(state, options) {
|
|
41
|
-
if (state == null) {
|
|
42
|
-
throw Error("Got 'undefined' for the navigation state. You must pass a valid state object.");
|
|
43
|
-
}
|
|
44
|
-
if (options) {
|
|
45
|
-
validatePathConfig(options);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Create a normalized configs object which will be easier to use
|
|
49
|
-
const configs = options?.screens ? createNormalizedConfigs(options?.screens) : {};
|
|
50
|
-
let path = '/';
|
|
51
|
-
let current = state;
|
|
52
|
-
const allParams = {};
|
|
53
|
-
while (current) {
|
|
54
|
-
let index = typeof current.index === 'number' ? current.index : 0;
|
|
55
|
-
let route = current.routes[index];
|
|
56
|
-
let pattern;
|
|
57
|
-
let focusedParams;
|
|
58
|
-
const focusedRoute = getActiveRoute(state);
|
|
59
|
-
let currentOptions = configs;
|
|
60
|
-
|
|
61
|
-
// Keep all the route names that appeared during going deeper in config in case the pattern is resolved to undefined
|
|
62
|
-
const nestedRouteNames = [];
|
|
63
|
-
let hasNext = true;
|
|
64
|
-
while (route.name in currentOptions && hasNext) {
|
|
65
|
-
pattern = currentOptions[route.name].pattern;
|
|
66
|
-
nestedRouteNames.push(route.name);
|
|
67
|
-
if (route.params) {
|
|
68
|
-
const stringify = currentOptions[route.name]?.stringify;
|
|
69
|
-
const currentParams = Object.fromEntries(Object.entries(route.params).map(([key, value]) => [key, stringify?.[key] ? stringify[key](value) : String(value)]));
|
|
70
|
-
if (pattern) {
|
|
71
|
-
Object.assign(allParams, currentParams);
|
|
72
|
-
}
|
|
73
|
-
if (focusedRoute === route) {
|
|
74
|
-
// If this is the focused route, keep the params for later use
|
|
75
|
-
// We save it here since it's been stringified already
|
|
76
|
-
focusedParams = {
|
|
77
|
-
...currentParams
|
|
78
|
-
};
|
|
79
|
-
pattern?.split('/').filter(p => p.startsWith(':'))
|
|
80
|
-
// eslint-disable-next-line no-loop-func
|
|
81
|
-
.forEach(p => {
|
|
82
|
-
const name = getParamName(p);
|
|
83
|
-
|
|
84
|
-
// Remove the params present in the pattern since we'll only use the rest for query string
|
|
85
|
-
if (focusedParams) {
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
87
|
-
delete focusedParams[name];
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// If there is no `screens` property or no nested state, we return pattern
|
|
94
|
-
if (!currentOptions[route.name].screens || route.state === undefined) {
|
|
95
|
-
hasNext = false;
|
|
96
|
-
} else {
|
|
97
|
-
index = typeof route.state.index === 'number' ? route.state.index : route.state.routes.length - 1;
|
|
98
|
-
const nextRoute = route.state.routes[index];
|
|
99
|
-
const nestedConfig = currentOptions[route.name].screens;
|
|
100
|
-
|
|
101
|
-
// if there is config for next route name, we go deeper
|
|
102
|
-
if (nestedConfig && nextRoute.name in nestedConfig) {
|
|
103
|
-
route = nextRoute;
|
|
104
|
-
currentOptions = nestedConfig;
|
|
105
|
-
} else {
|
|
106
|
-
// If not, there is no sense in going deeper in config
|
|
107
|
-
hasNext = false;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (pattern === undefined) {
|
|
112
|
-
pattern = nestedRouteNames.join('/');
|
|
113
|
-
}
|
|
114
|
-
if (currentOptions[route.name] !== undefined) {
|
|
115
|
-
path += pattern.split('/').map(p => {
|
|
116
|
-
const name = getParamName(p);
|
|
117
|
-
|
|
118
|
-
// We don't know what to show for wildcard patterns
|
|
119
|
-
// Showing the route name seems ok, though whatever we show here will be incorrect
|
|
120
|
-
// Since the page doesn't actually exist
|
|
121
|
-
if (p === '*') {
|
|
122
|
-
return route.name;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// If the path has a pattern for a param, put the param in the path
|
|
126
|
-
if (p.startsWith(':')) {
|
|
127
|
-
const value = allParams[name];
|
|
128
|
-
if (value === undefined && p.endsWith('?')) {
|
|
129
|
-
// Optional params without value assigned in route.params should be ignored
|
|
130
|
-
return '';
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Valid characters according to
|
|
134
|
-
// https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (see pchar definition)
|
|
135
|
-
return String(value).replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]/g, char => encodeURIComponent(char));
|
|
136
|
-
}
|
|
137
|
-
return encodeURIComponent(p);
|
|
138
|
-
}).join('/');
|
|
139
|
-
} else {
|
|
140
|
-
path += encodeURIComponent(route.name);
|
|
141
|
-
}
|
|
142
|
-
if (!focusedParams) {
|
|
143
|
-
focusedParams = focusedRoute.params;
|
|
144
|
-
}
|
|
145
|
-
if (route.state) {
|
|
146
|
-
path += '/';
|
|
147
|
-
} else if (focusedParams) {
|
|
148
|
-
for (const param in focusedParams) {
|
|
149
|
-
if (focusedParams[param] === 'undefined') {
|
|
150
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
151
|
-
delete focusedParams[param];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
const query = queryString.stringify(focusedParams, {
|
|
155
|
-
sort: false
|
|
156
|
-
});
|
|
157
|
-
if (query) {
|
|
158
|
-
path += `?${query}`;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
current = route.state;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Remove multiple as well as trailing slashes
|
|
165
|
-
path = path.replace(/\/+/g, '/');
|
|
166
|
-
path = path.length > 1 ? path.replace(/\/$/, '') : path;
|
|
167
|
-
|
|
168
|
-
// Include the root path if specified
|
|
169
|
-
if (options?.path) {
|
|
170
|
-
path = joinPaths(options.path, path);
|
|
171
|
-
}
|
|
172
|
-
return path;
|
|
173
|
-
}
|
|
174
|
-
const getParamName = pattern => pattern.replace(/^:/, '').replace(/\?$/, '');
|
|
175
|
-
const joinPaths = (...paths) => [].concat(...paths.map(p => p.split('/'))).filter(Boolean).join('/');
|
|
176
|
-
const createConfigItem = (config, parentPattern) => {
|
|
177
|
-
if (typeof config === 'string') {
|
|
178
|
-
// If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern
|
|
179
|
-
const pattern = parentPattern ? joinPaths(parentPattern, config) : config;
|
|
180
|
-
return {
|
|
181
|
-
pattern
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
if (config.exact && config.path === undefined) {
|
|
185
|
-
throw new Error("A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.");
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// If an object is specified as the value (e.g. Foo: { ... }),
|
|
189
|
-
// It can have `path` property and `screens` prop which has nested configs
|
|
190
|
-
const pattern = config.exact !== true ? joinPaths(parentPattern || '', config.path || '') : config.path || '';
|
|
191
|
-
const screens = config.screens ? createNormalizedConfigs(config.screens, pattern) : undefined;
|
|
192
|
-
return {
|
|
193
|
-
// Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.
|
|
194
|
-
pattern: pattern?.split('/').filter(Boolean).join('/'),
|
|
195
|
-
stringify: config.stringify,
|
|
196
|
-
screens
|
|
197
|
-
};
|
|
198
|
-
};
|
|
199
|
-
const createNormalizedConfigs = (options, pattern) => Object.fromEntries(Object.entries(options).map(([name, c]) => {
|
|
200
|
-
const result = createConfigItem(c, pattern);
|
|
201
|
-
return [name, result];
|
|
202
|
-
}));
|
|
203
|
-
//# sourceMappingURL=getPathFromState.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["queryString","validatePathConfig","getActiveRoute","state","route","index","routes","length","getPathFromState","options","Error","configs","screens","createNormalizedConfigs","path","current","allParams","pattern","focusedParams","focusedRoute","currentOptions","nestedRouteNames","hasNext","name","push","params","stringify","currentParams","Object","fromEntries","entries","map","key","value","String","assign","split","filter","p","startsWith","forEach","getParamName","undefined","nextRoute","nestedConfig","join","endsWith","replace","char","encodeURIComponent","param","query","sort","joinPaths","paths","concat","Boolean","createConfigItem","config","parentPattern","exact","c","result"],"sourceRoot":"../../src","sources":["getPathFromState.tsx"],"mappings":"AAKA,OAAO,KAAKA,WAAW,MAAM,cAAc;AAG3C,SAASC,kBAAkB,QAAQ,0BAAsB;AAkBzD,MAAMC,cAAc,GAAIC,KAAY,IAAwC;EAC1E,MAAMC,KAAK,GACT,OAAOD,KAAK,CAACE,KAAK,KAAK,QAAQ,GAC3BF,KAAK,CAACG,MAAM,CAACH,KAAK,CAACE,KAAK,CAAC,GACzBF,KAAK,CAACG,MAAM,CAACH,KAAK,CAACG,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;EAE3C,IAAIH,KAAK,CAACD,KAAK,EAAE;IACf,OAAOD,cAAc,CAACE,KAAK,CAACD,KAAK,CAAC;EACpC;EAEA,OAAOC,KAAK;AACd,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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p';
|
|
2
|
-
import * as queryString from 'query-string';
|
|
3
|
-
import { findFocusedRoute } from "./findFocusedRoute.mjs";
|
|
4
|
-
import { validatePathConfig } from "./validatePathConfig.mjs";
|
|
5
|
-
/**
|
|
6
|
-
* Utility to parse a path string to initial state object accepted by the container.
|
|
7
|
-
* This is useful for deep linking when we need to handle the incoming URL.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```js
|
|
11
|
-
* getStateFromPath(
|
|
12
|
-
* '/chat/jane/42',
|
|
13
|
-
* {
|
|
14
|
-
* screens: {
|
|
15
|
-
* Chat: {
|
|
16
|
-
* path: 'chat/:author/:id',
|
|
17
|
-
* parse: { id: Number }
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* )
|
|
22
|
-
* ```
|
|
23
|
-
* @param path Path string to parse and convert, e.g. /foo/bar?count=42.
|
|
24
|
-
* @param options Extra options to fine-tune how to parse the path.
|
|
25
|
-
*/
|
|
26
|
-
export function getStateFromPath(path, options) {
|
|
27
|
-
if (options) {
|
|
28
|
-
validatePathConfig(options);
|
|
29
|
-
}
|
|
30
|
-
const initialRoutes = [];
|
|
31
|
-
if (options?.initialRouteName) {
|
|
32
|
-
initialRoutes.push({
|
|
33
|
-
initialRouteName: options.initialRouteName,
|
|
34
|
-
parentScreens: []
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const screens = options?.screens;
|
|
38
|
-
let remaining = path.replace(/\/+/g, '/') // Replace multiple slash (//) with single ones
|
|
39
|
-
.replace(/^\//, '') // Remove extra leading slash
|
|
40
|
-
.replace(/\?.*$/, ''); // Remove query params which we will handle later
|
|
41
|
-
|
|
42
|
-
// Make sure there is a trailing slash
|
|
43
|
-
remaining = remaining.endsWith('/') ? remaining : `${remaining}/`;
|
|
44
|
-
const prefix = options?.path?.replace(/^\//, ''); // Remove extra leading slash
|
|
45
|
-
|
|
46
|
-
if (prefix) {
|
|
47
|
-
// Make sure there is a trailing slash
|
|
48
|
-
const normalizedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`;
|
|
49
|
-
|
|
50
|
-
// If the path doesn't start with the prefix, it's not a match
|
|
51
|
-
if (!remaining.startsWith(normalizedPrefix)) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Remove the prefix from the path
|
|
56
|
-
remaining = remaining.replace(normalizedPrefix, '');
|
|
57
|
-
}
|
|
58
|
-
if (screens === undefined) {
|
|
59
|
-
// When no config is specified, use the path segments as route names
|
|
60
|
-
const routes = remaining.split('/').filter(Boolean).map(segment => {
|
|
61
|
-
const name = decodeURIComponent(segment);
|
|
62
|
-
return {
|
|
63
|
-
name
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
if (routes.length) {
|
|
67
|
-
return createNestedStateObject(path, routes, initialRoutes);
|
|
68
|
-
}
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Create a normalized configs array which will be easier to use
|
|
73
|
-
const configs = [].concat(...Object.keys(screens).map(key => createNormalizedConfigs(key, screens, [], initialRoutes, []))).sort((a, b) => {
|
|
74
|
-
// Sort config so that:
|
|
75
|
-
// - the most exhaustive ones are always at the beginning
|
|
76
|
-
// - patterns with wildcard are always at the end
|
|
77
|
-
|
|
78
|
-
// If 2 patterns are same, move the one with less route names up
|
|
79
|
-
// This is an error state, so it's only useful for consistent error messages
|
|
80
|
-
if (a.pattern === b.pattern) {
|
|
81
|
-
return b.routeNames.join('>').localeCompare(a.routeNames.join('>'));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// If one of the patterns starts with the other, it's more exhaustive
|
|
85
|
-
// So move it up
|
|
86
|
-
if (a.pattern.startsWith(b.pattern)) {
|
|
87
|
-
return -1;
|
|
88
|
-
}
|
|
89
|
-
if (b.pattern.startsWith(a.pattern)) {
|
|
90
|
-
return 1;
|
|
91
|
-
}
|
|
92
|
-
const aParts = a.pattern.split('/');
|
|
93
|
-
const bParts = b.pattern.split('/');
|
|
94
|
-
for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) {
|
|
95
|
-
// if b is longer, b get higher priority
|
|
96
|
-
if (aParts[i] == null) {
|
|
97
|
-
return 1;
|
|
98
|
-
}
|
|
99
|
-
// if a is longer, a get higher priority
|
|
100
|
-
if (bParts[i] == null) {
|
|
101
|
-
return -1;
|
|
102
|
-
}
|
|
103
|
-
const aWildCard = aParts[i] === '*' || aParts[i].startsWith(':');
|
|
104
|
-
const bWildCard = bParts[i] === '*' || bParts[i].startsWith(':');
|
|
105
|
-
// if both are wildcard we compare next component
|
|
106
|
-
if (aWildCard && bWildCard) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
// if only a is wild card, b get higher priority
|
|
110
|
-
if (aWildCard) {
|
|
111
|
-
return 1;
|
|
112
|
-
}
|
|
113
|
-
// if only b is wild card, a get higher priority
|
|
114
|
-
if (bWildCard) {
|
|
115
|
-
return -1;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return bParts.length - aParts.length;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
// Check for duplicate patterns in the config
|
|
122
|
-
configs.reduce((acc, config) => {
|
|
123
|
-
if (acc[config.pattern]) {
|
|
124
|
-
const a = acc[config.pattern].routeNames;
|
|
125
|
-
const b = config.routeNames;
|
|
126
|
-
|
|
127
|
-
// It's not a problem if the path string omitted from a inner most screen
|
|
128
|
-
// For example, it's ok if a path resolves to `A > B > C` or `A > B`
|
|
129
|
-
const intersects = a.length > b.length ? b.every((it, i) => a[i] === it) : a.every((it, i) => b[i] === it);
|
|
130
|
-
if (!intersects) {
|
|
131
|
-
throw new Error(`Found conflicting screens with the same pattern. The pattern '${config.pattern}' resolves to both '${a.join(' > ')}' and '${b.join(' > ')}'. Patterns must be unique and cannot resolve to more than one screen.`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return Object.assign(acc, {
|
|
135
|
-
[config.pattern]: config
|
|
136
|
-
});
|
|
137
|
-
}, {});
|
|
138
|
-
if (remaining === '/') {
|
|
139
|
-
// We need to add special handling of empty path so navigation to empty path also works
|
|
140
|
-
// When handling empty path, we should only look at the root level config
|
|
141
|
-
const match = configs.find(config => config.path === '' && config.routeNames.every(
|
|
142
|
-
// Make sure that none of the parent configs have a non-empty path defined
|
|
143
|
-
name => !configs.find(c => c.screen === name)?.path));
|
|
144
|
-
if (match) {
|
|
145
|
-
return createNestedStateObject(path, match.routeNames.map(name => ({
|
|
146
|
-
name
|
|
147
|
-
})), initialRoutes, configs);
|
|
148
|
-
}
|
|
149
|
-
return undefined;
|
|
150
|
-
}
|
|
151
|
-
let result;
|
|
152
|
-
let current;
|
|
153
|
-
|
|
154
|
-
// We match the whole path against the regex instead of segments
|
|
155
|
-
// This makes sure matches such as wildcard will catch any unmatched routes, even if nested
|
|
156
|
-
const {
|
|
157
|
-
routes,
|
|
158
|
-
remainingPath
|
|
159
|
-
} = matchAgainstConfigs(remaining, configs.map(c => ({
|
|
160
|
-
...c,
|
|
161
|
-
// Add `$` to the regex to make sure it matches till end of the path and not just beginning
|
|
162
|
-
regex: c.regex ? new RegExp(c.regex.source + '$') : undefined
|
|
163
|
-
})));
|
|
164
|
-
if (routes !== undefined) {
|
|
165
|
-
// This will always be empty if full path matched
|
|
166
|
-
current = createNestedStateObject(path, routes, initialRoutes, configs);
|
|
167
|
-
remaining = remainingPath;
|
|
168
|
-
result = current;
|
|
169
|
-
}
|
|
170
|
-
if (current == null || result == null) {
|
|
171
|
-
return undefined;
|
|
172
|
-
}
|
|
173
|
-
return result;
|
|
174
|
-
}
|
|
175
|
-
const joinPaths = (...paths) => [].concat(...paths.map(p => p.split('/'))).filter(Boolean).join('/');
|
|
176
|
-
const matchAgainstConfigs = (remaining, configs) => {
|
|
177
|
-
let routes;
|
|
178
|
-
let remainingPath = remaining;
|
|
179
|
-
|
|
180
|
-
// Go through all configs, and see if the next path segment matches our regex
|
|
181
|
-
for (const config of configs) {
|
|
182
|
-
if (!config.regex) {
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
const match = remainingPath.match(config.regex);
|
|
186
|
-
|
|
187
|
-
// If our regex matches, we need to extract params from the path
|
|
188
|
-
if (match) {
|
|
189
|
-
const matchResult = config.pattern?.split('/').reduce((acc, p, index) => {
|
|
190
|
-
if (!p.startsWith(':')) {
|
|
191
|
-
return acc;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Path parameter so increment position for the segment
|
|
195
|
-
acc.pos += 1;
|
|
196
|
-
const decodedParamSegment = decodeURIComponent(
|
|
197
|
-
// The param segments appear every second item starting from 2 in the regex match result
|
|
198
|
-
match[(acc.pos + 1) * 2]
|
|
199
|
-
// Remove trailing slash
|
|
200
|
-
.replace(/\/$/, ''));
|
|
201
|
-
Object.assign(acc.matchedParams, {
|
|
202
|
-
[p]: Object.assign(acc.matchedParams[p] || {}, {
|
|
203
|
-
[index]: decodedParamSegment
|
|
204
|
-
})
|
|
205
|
-
});
|
|
206
|
-
return acc;
|
|
207
|
-
}, {
|
|
208
|
-
pos: -1,
|
|
209
|
-
matchedParams: {}
|
|
210
|
-
});
|
|
211
|
-
const matchedParams = matchResult.matchedParams || {};
|
|
212
|
-
routes = config.routeNames.map(name => {
|
|
213
|
-
const routeConfig = configs.find(c => {
|
|
214
|
-
// Check matching name AND pattern in case same screen is used at different levels in config
|
|
215
|
-
return c.screen === name && config.pattern.startsWith(c.pattern);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
// Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.
|
|
219
|
-
const normalizedPath = routeConfig?.path.split('/').filter(Boolean).join('/');
|
|
220
|
-
|
|
221
|
-
// Get the number of segments in the initial pattern
|
|
222
|
-
const numInitialSegments = routeConfig?.pattern
|
|
223
|
-
// Extract the prefix from the pattern by removing the ending path pattern (e.g pattern=`a/b/c/d` and normalizedPath=`c/d` becomes `a/b`)
|
|
224
|
-
.replace(new RegExp(`${escape(normalizedPath)}$`), '')?.split('/').length;
|
|
225
|
-
const params = normalizedPath?.split('/').reduce((acc, p, index) => {
|
|
226
|
-
if (!p.startsWith(':')) {
|
|
227
|
-
return acc;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Get the real index of the path parameter in the matched path
|
|
231
|
-
// by offsetting by the number of segments in the initial pattern
|
|
232
|
-
const offset = numInitialSegments ? numInitialSegments - 1 : 0;
|
|
233
|
-
const value = matchedParams[p]?.[index + offset];
|
|
234
|
-
if (value) {
|
|
235
|
-
const key = p.replace(/^:/, '').replace(/\?$/, '');
|
|
236
|
-
acc[key] = routeConfig?.parse?.[key] ? routeConfig.parse[key](value) : value;
|
|
237
|
-
}
|
|
238
|
-
return acc;
|
|
239
|
-
}, {});
|
|
240
|
-
if (params && Object.keys(params).length) {
|
|
241
|
-
return {
|
|
242
|
-
name,
|
|
243
|
-
params
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
return {
|
|
247
|
-
name
|
|
248
|
-
};
|
|
249
|
-
});
|
|
250
|
-
remainingPath = remainingPath.replace(match[1], '');
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
routes,
|
|
256
|
-
remainingPath
|
|
257
|
-
};
|
|
258
|
-
};
|
|
259
|
-
const createNormalizedConfigs = (screen, routeConfig, routeNames = [], initials, parentScreens, parentPattern) => {
|
|
260
|
-
const configs = [];
|
|
261
|
-
routeNames.push(screen);
|
|
262
|
-
parentScreens.push(screen);
|
|
263
|
-
|
|
264
|
-
// @ts-expect-error: we can't strongly typecheck this for now
|
|
265
|
-
const config = routeConfig[screen];
|
|
266
|
-
if (typeof config === 'string') {
|
|
267
|
-
// If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern
|
|
268
|
-
const pattern = parentPattern ? joinPaths(parentPattern, config) : config;
|
|
269
|
-
configs.push(createConfigItem(screen, routeNames, pattern, config));
|
|
270
|
-
} else if (typeof config === 'object') {
|
|
271
|
-
let pattern;
|
|
272
|
-
|
|
273
|
-
// if an object is specified as the value (e.g. Foo: { ... }),
|
|
274
|
-
// it can have `path` property and
|
|
275
|
-
// it could have `screens` prop which has nested configs
|
|
276
|
-
if (typeof config.path === 'string') {
|
|
277
|
-
if (config.exact && config.path === undefined) {
|
|
278
|
-
throw new Error("A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.");
|
|
279
|
-
}
|
|
280
|
-
pattern = config.exact !== true ? joinPaths(parentPattern || '', config.path || '') : config.path || '';
|
|
281
|
-
configs.push(createConfigItem(screen, routeNames, pattern, config.path, config.parse));
|
|
282
|
-
}
|
|
283
|
-
if (config.screens) {
|
|
284
|
-
// property `initialRouteName` without `screens` has no purpose
|
|
285
|
-
if (config.initialRouteName) {
|
|
286
|
-
initials.push({
|
|
287
|
-
initialRouteName: config.initialRouteName,
|
|
288
|
-
parentScreens
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
Object.keys(config.screens).forEach(nestedConfig => {
|
|
292
|
-
const result = createNormalizedConfigs(nestedConfig, config.screens, routeNames, initials, [...parentScreens], pattern ?? parentPattern);
|
|
293
|
-
configs.push(...result);
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
routeNames.pop();
|
|
298
|
-
return configs;
|
|
299
|
-
};
|
|
300
|
-
const createConfigItem = (screen, routeNames, pattern, path, parse) => {
|
|
301
|
-
// Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.
|
|
302
|
-
pattern = pattern.split('/').filter(Boolean).join('/');
|
|
303
|
-
const regex = pattern ? new RegExp(`^(${pattern.split('/').map(it => {
|
|
304
|
-
if (it.startsWith(':')) {
|
|
305
|
-
return `(([^/]+\\/)${it.endsWith('?') ? '?' : ''})`;
|
|
306
|
-
}
|
|
307
|
-
return `${it === '*' ? '.*' : escape(it)}\\/`;
|
|
308
|
-
}).join('')})`) : undefined;
|
|
309
|
-
return {
|
|
310
|
-
screen,
|
|
311
|
-
regex,
|
|
312
|
-
pattern,
|
|
313
|
-
path,
|
|
314
|
-
// The routeNames array is mutated, so copy it to keep the current state
|
|
315
|
-
routeNames: [...routeNames],
|
|
316
|
-
parse
|
|
317
|
-
};
|
|
318
|
-
};
|
|
319
|
-
const findParseConfigForRoute = (routeName, flatConfig) => {
|
|
320
|
-
for (const config of flatConfig) {
|
|
321
|
-
if (routeName === config.routeNames[config.routeNames.length - 1]) {
|
|
322
|
-
return config.parse;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return undefined;
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
// Try to find an initial route connected with the one passed
|
|
329
|
-
const findInitialRoute = (routeName, parentScreens, initialRoutes) => {
|
|
330
|
-
for (const config of initialRoutes) {
|
|
331
|
-
if (parentScreens.length === config.parentScreens.length) {
|
|
332
|
-
let sameParents = true;
|
|
333
|
-
for (let i = 0; i < parentScreens.length; i++) {
|
|
334
|
-
if (parentScreens[i].localeCompare(config.parentScreens[i]) !== 0) {
|
|
335
|
-
sameParents = false;
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
if (sameParents) {
|
|
340
|
-
return routeName !== config.initialRouteName ? config.initialRouteName : undefined;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return undefined;
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
// returns state object with values depending on whether
|
|
348
|
-
// it is the end of state and if there is initialRoute for this level
|
|
349
|
-
const createStateObject = (initialRoute, route, isEmpty) => {
|
|
350
|
-
if (isEmpty) {
|
|
351
|
-
if (initialRoute) {
|
|
352
|
-
return {
|
|
353
|
-
index: 1,
|
|
354
|
-
routes: [{
|
|
355
|
-
name: initialRoute
|
|
356
|
-
}, route]
|
|
357
|
-
};
|
|
358
|
-
} else {
|
|
359
|
-
return {
|
|
360
|
-
routes: [route]
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
} else {
|
|
364
|
-
if (initialRoute) {
|
|
365
|
-
return {
|
|
366
|
-
index: 1,
|
|
367
|
-
routes: [{
|
|
368
|
-
name: initialRoute
|
|
369
|
-
}, {
|
|
370
|
-
...route,
|
|
371
|
-
state: {
|
|
372
|
-
routes: []
|
|
373
|
-
}
|
|
374
|
-
}]
|
|
375
|
-
};
|
|
376
|
-
} else {
|
|
377
|
-
return {
|
|
378
|
-
routes: [{
|
|
379
|
-
...route,
|
|
380
|
-
state: {
|
|
381
|
-
routes: []
|
|
382
|
-
}
|
|
383
|
-
}]
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
const createNestedStateObject = (path, routes, initialRoutes, flatConfig) => {
|
|
389
|
-
let route = routes.shift();
|
|
390
|
-
const parentScreens = [];
|
|
391
|
-
let initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
|
|
392
|
-
parentScreens.push(route.name);
|
|
393
|
-
const state = createStateObject(initialRoute, route, routes.length === 0);
|
|
394
|
-
if (routes.length > 0) {
|
|
395
|
-
let nestedState = state;
|
|
396
|
-
while (route = routes.shift()) {
|
|
397
|
-
initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
|
|
398
|
-
const nestedStateIndex = nestedState.index || nestedState.routes.length - 1;
|
|
399
|
-
nestedState.routes[nestedStateIndex].state = createStateObject(initialRoute, route, routes.length === 0);
|
|
400
|
-
if (routes.length > 0) {
|
|
401
|
-
nestedState = nestedState.routes[nestedStateIndex].state;
|
|
402
|
-
}
|
|
403
|
-
parentScreens.push(route.name);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
route = findFocusedRoute(state);
|
|
407
|
-
route.path = path;
|
|
408
|
-
const params = parseQueryParams(path, flatConfig ? findParseConfigForRoute(route.name, flatConfig) : undefined);
|
|
409
|
-
if (params) {
|
|
410
|
-
route.params = {
|
|
411
|
-
...route.params,
|
|
412
|
-
...params
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
return state;
|
|
416
|
-
};
|
|
417
|
-
const parseQueryParams = (path, parseConfig) => {
|
|
418
|
-
const query = path.split('?')[1];
|
|
419
|
-
const params = queryString.parse(query);
|
|
420
|
-
if (parseConfig) {
|
|
421
|
-
Object.keys(params).forEach(name => {
|
|
422
|
-
if (Object.hasOwnProperty.call(parseConfig, name) && typeof params[name] === 'string') {
|
|
423
|
-
params[name] = parseConfig[name](params[name]);
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
return Object.keys(params).length ? params : undefined;
|
|
428
|
-
};
|
|
429
|
-
//# sourceMappingURL=getStateFromPath.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["escape","queryString","findFocusedRoute","validatePathConfig","getStateFromPath","path","options","initialRoutes","initialRouteName","push","parentScreens","screens","remaining","replace","endsWith","prefix","normalizedPrefix","startsWith","undefined","routes","split","filter","Boolean","map","segment","name","decodeURIComponent","length","createNestedStateObject","configs","concat","Object","keys","key","createNormalizedConfigs","sort","a","b","pattern","routeNames","join","localeCompare","aParts","bParts","i","Math","max","aWildCard","bWildCard","reduce","acc","config","intersects","every","it","Error","assign","match","find","c","screen","result","current","remainingPath","matchAgainstConfigs","regex","RegExp","source","joinPaths","paths","p","matchResult","index","pos","decodedParamSegment","matchedParams","routeConfig","normalizedPath","numInitialSegments","params","offset","value","parse","initials","parentPattern","createConfigItem","exact","forEach","nestedConfig","pop","findParseConfigForRoute","routeName","flatConfig","findInitialRoute","sameParents","createStateObject","initialRoute","route","isEmpty","state","shift","nestedState","nestedStateIndex","parseQueryParams","parseConfig","query","hasOwnProperty","call"],"sourceRoot":"../../src","sources":["getStateFromPath.tsx"],"mappings":"AAKA,OAAOA,MAAM,MAAM,sBAAsB;AACzC,OAAO,KAAKC,WAAW,MAAM,cAAc;AAE3C,SAASC,gBAAgB,QAAQ,wBAAoB;AAErD,SAASC,kBAAkB,QAAQ,0BAAsB;AAkCzD;AACA;AACA;AACA;AACA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