one 1.1.309 → 1.1.310
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/dist/cjs/Root.cjs +212 -0
- package/dist/cjs/{Route.js → Route.cjs} +34 -19
- package/dist/cjs/{cleanUrl.js → cleanUrl.cjs} +27 -18
- package/dist/cjs/cli/label-process.cjs +31 -0
- package/dist/cjs/cli/{main.js → main.cjs} +28 -16
- package/dist/cjs/cli/{prebuild.js → prebuild.cjs} +25 -15
- package/dist/cjs/cli/run.cjs +70 -0
- package/dist/cjs/cli/{runAndroid.js → runAndroid.cjs} +25 -15
- package/dist/cjs/cli/{runIos.js → runIos.cjs} +25 -15
- package/dist/cjs/cli.cjs +258 -0
- package/dist/cjs/clientLoaderResolver.cjs +35 -0
- package/dist/cjs/config.cjs +32 -0
- package/dist/cjs/constants.cjs +30 -0
- package/dist/cjs/{createApp.js → createApp.cjs} +33 -17
- package/dist/cjs/createApp.native.cjs +38 -0
- package/dist/cjs/createApp.native.cjs.map +6 -0
- package/dist/cjs/{createHandleRequest.js → createHandleRequest.cjs} +60 -49
- package/dist/cjs/createRoute.cjs +42 -0
- package/dist/cjs/fallbackViews/{Sitemap.js → Sitemap.cjs} +35 -16
- package/dist/cjs/fallbackViews/{Unmatched.js → Unmatched.cjs} +32 -17
- package/dist/cjs/fork/NavigationContainer.cjs +105 -0
- package/dist/cjs/fork/NavigationContainer.native.cjs +103 -0
- package/dist/cjs/fork/NavigationContainer.native.cjs.map +6 -0
- package/dist/cjs/fork/createMemoryHistory.cjs +136 -0
- package/dist/cjs/fork/{extractPathFromURL.js → extractPathFromURL.cjs} +30 -21
- package/dist/cjs/fork/findFocusedRoute.cjs +30 -0
- package/dist/cjs/fork/{getPathFromState.js → getPathFromState.cjs} +120 -113
- package/dist/cjs/fork/getStateFromPath.cjs +366 -0
- package/dist/cjs/fork/useLinking.cjs +215 -0
- package/dist/cjs/fork/useLinking.native.cjs +126 -0
- package/dist/cjs/fork/useLinking.native.cjs.map +6 -0
- package/dist/cjs/fork/validatePathConfig.cjs +44 -0
- package/dist/cjs/{getLinkingConfig.js → getLinkingConfig.cjs} +21 -15
- package/dist/cjs/{getReactNavigationConfig.js → getReactNavigationConfig.cjs} +33 -32
- package/dist/cjs/getRoutes.cjs +276 -0
- package/dist/cjs/{getURL.js → getURL.cjs} +16 -11
- package/dist/cjs/getURL.native.cjs +48 -0
- package/dist/cjs/getURL.native.cjs.map +6 -0
- package/dist/cjs/head/Head.android.cjs +28 -0
- package/dist/cjs/head/Head.android.cjs.map +6 -0
- package/dist/cjs/head/Head.cjs +30 -0
- package/dist/cjs/head/Head.ios.cjs +210 -0
- package/dist/cjs/head/Head.ios.cjs.map +6 -0
- package/dist/cjs/head/HeadModule.cjs +27 -0
- package/dist/cjs/head/index.cjs +18 -0
- package/dist/cjs/head/types.cjs +16 -0
- package/dist/cjs/head/url.cjs +50 -0
- package/dist/cjs/{hooks.js → hooks.cjs} +52 -40
- package/dist/cjs/{imperative-api.js → imperative-api.cjs} +26 -19
- package/dist/cjs/import-mode/index.android.cjs +26 -0
- package/dist/cjs/import-mode/index.android.cjs.map +6 -0
- package/dist/cjs/import-mode/index.cjs +26 -0
- package/dist/cjs/import-mode/index.ios.cjs +26 -0
- package/dist/cjs/import-mode/index.ios.cjs.map +6 -0
- package/dist/cjs/import-mode/index.native.cjs +26 -0
- package/dist/cjs/import-mode/index.native.cjs.map +6 -0
- package/dist/cjs/import-mode/index.web.cjs +26 -0
- package/dist/cjs/{index.js → index.cjs} +50 -14
- package/dist/cjs/interfaces/router.cjs +27 -0
- package/dist/cjs/layouts/Drawer.cjs +31 -0
- package/dist/cjs/layouts/Stack.cjs +31 -0
- package/dist/cjs/layouts/Tabs.cjs +64 -0
- package/dist/cjs/layouts/withLayoutContext.cjs +91 -0
- package/dist/cjs/link/Link.cjs +120 -0
- package/dist/cjs/link/Redirect.cjs +39 -0
- package/dist/cjs/link/href.cjs +58 -0
- package/dist/cjs/link/linking.cjs +89 -0
- package/dist/cjs/link/path.cjs +69 -0
- package/dist/cjs/link/useLinkTo.cjs +54 -0
- package/dist/cjs/link/useLoadedNavigation.cjs +60 -0
- package/dist/cjs/{matchers.js → matchers.cjs} +16 -11
- package/dist/cjs/platform.cjs +26 -0
- package/dist/cjs/polyfills-mobile.cjs +33 -0
- package/dist/cjs/polyfills-server.cjs +25 -0
- package/dist/cjs/render.cjs +47 -0
- package/dist/cjs/render.native.cjs +28 -0
- package/dist/cjs/render.native.cjs.map +6 -0
- package/dist/cjs/router/RouterStore.cjs +16 -0
- package/dist/cjs/router/constants.cjs +26 -0
- package/dist/cjs/router/{getNormalizedStatePath.js → getNormalizedStatePath.cjs} +25 -23
- package/dist/cjs/router/lastAction.cjs +31 -0
- package/dist/cjs/router/{router.js → router.cjs} +104 -78
- package/dist/cjs/router/serverLocationContext.cjs +27 -0
- package/dist/cjs/router/{useInitializeOneRouter.js → useInitializeOneRouter.cjs} +26 -16
- package/dist/cjs/serve.cjs +185 -0
- package/dist/cjs/server/{createRoutesManifest.js → createRoutesManifest.cjs} +22 -16
- package/dist/cjs/server/{getServerManifest.js → getServerManifest.cjs} +58 -31
- package/dist/cjs/{server-render.js → server-render.cjs} +28 -17
- package/dist/cjs/sortRoutes.cjs +62 -0
- package/dist/cjs/typed-routes/generateRouteTypes.cjs +48 -0
- package/dist/cjs/typed-routes/{getTypedRoutesDeclarationFile.js → getTypedRoutesDeclarationFile.cjs} +37 -40
- package/dist/cjs/types.cjs +16 -0
- package/dist/cjs/{useFocusEffect.js → useFocusEffect.cjs} +33 -24
- package/dist/cjs/useLoader.cjs +114 -0
- package/dist/cjs/useNavigation.cjs +68 -0
- package/dist/cjs/useScreens.cjs +233 -0
- package/dist/cjs/{useViteRoutes.js → useViteRoutes.cjs} +36 -24
- package/dist/cjs/utils/assertIsReady.cjs +28 -0
- package/dist/cjs/utils/dynamicImport.cjs +27 -0
- package/dist/cjs/utils/existsAsync.cjs +33 -0
- package/dist/cjs/utils/getPageExport.cjs +32 -0
- package/dist/cjs/utils/{globDir.js → globDir.cjs} +23 -15
- package/dist/cjs/utils/{hashString.js → hashString.cjs} +22 -14
- package/dist/cjs/utils/isResponse.cjs +28 -0
- package/dist/cjs/utils/isStatus.cjs +28 -0
- package/dist/cjs/utils/promiseWithResolvers.cjs +37 -0
- package/dist/cjs/utils/rand.cjs +26 -0
- package/dist/cjs/utils/redirect.cjs +34 -0
- package/dist/cjs/utils/removeSearch.cjs +28 -0
- package/dist/cjs/utils/removeUndefined.cjs +30 -0
- package/dist/cjs/utils/{url.js → url.cjs} +16 -11
- package/dist/cjs/utils/weakKey.cjs +30 -0
- package/dist/cjs/utils/weakMemo.cjs +34 -0
- package/dist/cjs/views/EmptyRoute.cjs +30 -0
- package/dist/cjs/views/{ErrorBoundary.js → ErrorBoundary.cjs} +30 -16
- package/dist/cjs/views/LoadProgressBar.cjs +90 -0
- package/dist/cjs/views/Navigator.cjs +149 -0
- package/dist/cjs/views/{PreloadLinks.js → PreloadLinks.cjs} +20 -13
- package/dist/cjs/views/PreloadLinks.native.cjs +28 -0
- package/dist/cjs/views/PreloadLinks.native.cjs.map +6 -0
- package/dist/cjs/views/{RootErrorBoundary.js → RootErrorBoundary.cjs} +28 -16
- package/dist/cjs/views/Screen.cjs +39 -0
- package/dist/cjs/views/ScrollRestoration.cjs +74 -0
- package/dist/cjs/views/Try.cjs +68 -0
- package/dist/cjs/vite/build.cjs +425 -0
- package/dist/cjs/vite/{clientTreeShakePlugin.js → clientTreeShakePlugin.cjs} +53 -35
- package/dist/cjs/vite/constants.cjs +28 -0
- package/dist/cjs/vite/{createFileSystemRouter.js → createFileSystemRouter.cjs} +117 -84
- package/dist/cjs/vite/{customNodeExternals.js → customNodeExternals.cjs} +32 -20
- package/dist/cjs/vite/ensureTsConfig.cjs +68 -0
- package/dist/cjs/vite/findDepsToOptimize.cjs +74 -0
- package/dist/cjs/vite/{fixDependenciesPlugin.js → fixDependenciesPlugin.cjs} +17 -12
- package/dist/cjs/vite/generateTypesForRoutes.cjs +45 -0
- package/dist/cjs/vite/{getManifest.js → getManifest.cjs} +18 -12
- package/dist/cjs/vite/{headers.js → headers.cjs} +19 -14
- package/dist/cjs/vite/headers.native.cjs +32 -0
- package/dist/cjs/vite/headers.native.cjs.map +6 -0
- package/dist/cjs/vite/{loadEnv.js → loadEnv.cjs} +27 -16
- package/dist/cjs/vite/makePluginWebOnly.cjs +31 -0
- package/dist/cjs/vite/one.cjs +256 -0
- package/dist/cjs/vite/{removeReactNativeWebAnimatedPlugin.js → removeReactNativeWebAnimatedPlugin.cjs} +32 -25
- package/dist/cjs/vite/replaceLoader.cjs +37 -0
- package/dist/cjs/vite/resolveAPIRequest.cjs +90 -0
- package/dist/cjs/vite/server.cjs +13 -0
- package/dist/cjs/vite/types.cjs +16 -0
- package/dist/cjs/vite/{virtualEntryPlugin.js → virtualEntryPlugin.cjs} +28 -20
- package/dist/cjs/vite/{vitePluginSsrCss.js → vitePluginSsrCss.cjs} +56 -50
- package/dist/cjs/vite.cjs +40 -0
- package/dist/cjs/zero/getQueryKey.cjs +29 -0
- package/dist/cjs/zero/isZeroQuery.cjs +28 -0
- package/dist/cjs/zero/resolveQuery.cjs +41 -0
- package/dist/cjs/zero/{subscribeToQuery.js → subscribeToQuery.cjs} +16 -11
- package/dist/cjs/zero/types.cjs +16 -0
- package/dist/cjs/zero/useQuery.cjs +58 -0
- package/dist/cjs/zero/{useQueryZero.js → useQueryZero.cjs} +21 -15
- package/dist/cjs/zero.cjs +30 -0
- package/package.json +10 -10
- package/dist/cjs/Root.js +0 -182
- package/dist/cjs/cli/label-process.js +0 -25
- package/dist/cjs/cli/run.js +0 -52
- package/dist/cjs/cli.js +0 -209
- package/dist/cjs/clientLoaderResolver.js +0 -32
- package/dist/cjs/config.js +0 -27
- package/dist/cjs/constants.js +0 -23
- package/dist/cjs/createRoute.js +0 -37
- package/dist/cjs/fork/NavigationContainer.js +0 -85
- package/dist/cjs/fork/createMemoryHistory.js +0 -100
- package/dist/cjs/fork/findFocusedRoute.js +0 -26
- package/dist/cjs/fork/getStateFromPath.js +0 -381
- package/dist/cjs/fork/useLinking.js +0 -182
- package/dist/cjs/fork/validatePathConfig.js +0 -46
- package/dist/cjs/getRoutes.js +0 -294
- package/dist/cjs/head/Head.js +0 -23
- package/dist/cjs/head/HeadModule.js +0 -22
- package/dist/cjs/head/index.js +0 -15
- package/dist/cjs/head/types.js +0 -14
- package/dist/cjs/head/url.js +0 -52
- package/dist/cjs/import-mode/index.js +0 -21
- package/dist/cjs/import-mode/index.web.js +0 -21
- package/dist/cjs/interfaces/router.js +0 -23
- package/dist/cjs/layouts/Drawer.js +0 -24
- package/dist/cjs/layouts/Stack.js +0 -24
- package/dist/cjs/layouts/Tabs.js +0 -52
- package/dist/cjs/layouts/withLayoutContext.js +0 -77
- package/dist/cjs/link/Link.js +0 -98
- package/dist/cjs/link/Redirect.js +0 -31
- package/dist/cjs/link/href.js +0 -50
- package/dist/cjs/link/linking.js +0 -82
- package/dist/cjs/link/path.js +0 -65
- package/dist/cjs/link/useLinkTo.js +0 -42
- package/dist/cjs/link/useLoadedNavigation.js +0 -50
- package/dist/cjs/platform.js +0 -21
- package/dist/cjs/polyfills-mobile.js +0 -26
- package/dist/cjs/polyfills-server.js +0 -23
- package/dist/cjs/render.js +0 -44
- package/dist/cjs/router/RouterStore.js +0 -14
- package/dist/cjs/router/constants.js +0 -21
- package/dist/cjs/router/lastAction.js +0 -25
- package/dist/cjs/router/serverLocationContext.js +0 -22
- package/dist/cjs/serve.js +0 -175
- package/dist/cjs/sortRoutes.js +0 -64
- package/dist/cjs/typed-routes/generateRouteTypes.js +0 -33
- package/dist/cjs/types.js +0 -14
- package/dist/cjs/useLoader.js +0 -97
- package/dist/cjs/useNavigation.js +0 -60
- package/dist/cjs/useScreens.js +0 -176
- package/dist/cjs/utils/assertIsReady.js +0 -26
- package/dist/cjs/utils/dynamicImport.js +0 -24
- package/dist/cjs/utils/existsAsync.js +0 -28
- package/dist/cjs/utils/getPageExport.js +0 -27
- package/dist/cjs/utils/isResponse.js +0 -23
- package/dist/cjs/utils/isStatus.js +0 -23
- package/dist/cjs/utils/promiseWithResolvers.js +0 -26
- package/dist/cjs/utils/rand.js +0 -21
- package/dist/cjs/utils/redirect.js +0 -28
- package/dist/cjs/utils/removeSearch.js +0 -23
- package/dist/cjs/utils/removeUndefined.js +0 -26
- package/dist/cjs/utils/weakKey.js +0 -24
- package/dist/cjs/utils/weakMemo.js +0 -30
- package/dist/cjs/views/EmptyRoute.js +0 -25
- package/dist/cjs/views/LoadProgressBar.js +0 -83
- package/dist/cjs/views/Navigator.js +0 -101
- package/dist/cjs/views/Screen.js +0 -29
- package/dist/cjs/views/ScrollRestoration.js +0 -70
- package/dist/cjs/views/Try.js +0 -44
- package/dist/cjs/vite/build.js +0 -376
- package/dist/cjs/vite/constants.js +0 -22
- package/dist/cjs/vite/ensureTsConfig.js +0 -66
- package/dist/cjs/vite/findDepsToOptimize.js +0 -66
- package/dist/cjs/vite/generateTypesForRoutes.js +0 -36
- package/dist/cjs/vite/makePluginWebOnly.js +0 -27
- package/dist/cjs/vite/one.js +0 -255
- package/dist/cjs/vite/replaceLoader.js +0 -34
- package/dist/cjs/vite/resolveAPIRequest.js +0 -71
- package/dist/cjs/vite/server.js +0 -16
- package/dist/cjs/vite/types.js +0 -14
- package/dist/cjs/vite.js +0 -28
- package/dist/cjs/zero/getQueryKey.js +0 -24
- package/dist/cjs/zero/isZeroQuery.js +0 -23
- package/dist/cjs/zero/resolveQuery.js +0 -38
- package/dist/cjs/zero/types.js +0 -14
- package/dist/cjs/zero/useQuery.js +0 -47
- package/dist/cjs/zero.js +0 -23
- /package/dist/cjs/{Root.js.map → Root.cjs.map} +0 -0
- /package/dist/cjs/{Route.js.map → Route.cjs.map} +0 -0
- /package/dist/cjs/{cleanUrl.js.map → cleanUrl.cjs.map} +0 -0
- /package/dist/cjs/cli/{label-process.js.map → label-process.cjs.map} +0 -0
- /package/dist/cjs/cli/{main.js.map → main.cjs.map} +0 -0
- /package/dist/cjs/cli/{prebuild.js.map → prebuild.cjs.map} +0 -0
- /package/dist/cjs/cli/{run.js.map → run.cjs.map} +0 -0
- /package/dist/cjs/cli/{runAndroid.js.map → runAndroid.cjs.map} +0 -0
- /package/dist/cjs/cli/{runIos.js.map → runIos.cjs.map} +0 -0
- /package/dist/cjs/{cli.js.map → cli.cjs.map} +0 -0
- /package/dist/cjs/{clientLoaderResolver.js.map → clientLoaderResolver.cjs.map} +0 -0
- /package/dist/cjs/{config.js.map → config.cjs.map} +0 -0
- /package/dist/cjs/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/cjs/{createApp.js.map → createApp.cjs.map} +0 -0
- /package/dist/cjs/{createHandleRequest.js.map → createHandleRequest.cjs.map} +0 -0
- /package/dist/cjs/{createRoute.js.map → createRoute.cjs.map} +0 -0
- /package/dist/cjs/fallbackViews/{Sitemap.js.map → Sitemap.cjs.map} +0 -0
- /package/dist/cjs/fallbackViews/{Unmatched.js.map → Unmatched.cjs.map} +0 -0
- /package/dist/cjs/fork/{NavigationContainer.js.map → NavigationContainer.cjs.map} +0 -0
- /package/dist/cjs/fork/{createMemoryHistory.js.map → createMemoryHistory.cjs.map} +0 -0
- /package/dist/cjs/fork/{extractPathFromURL.js.map → extractPathFromURL.cjs.map} +0 -0
- /package/dist/cjs/fork/{findFocusedRoute.js.map → findFocusedRoute.cjs.map} +0 -0
- /package/dist/cjs/fork/{getPathFromState.js.map → getPathFromState.cjs.map} +0 -0
- /package/dist/cjs/fork/{getStateFromPath.js.map → getStateFromPath.cjs.map} +0 -0
- /package/dist/cjs/fork/{useLinking.js.map → useLinking.cjs.map} +0 -0
- /package/dist/cjs/fork/{validatePathConfig.js.map → validatePathConfig.cjs.map} +0 -0
- /package/dist/cjs/{getLinkingConfig.js.map → getLinkingConfig.cjs.map} +0 -0
- /package/dist/cjs/{getReactNavigationConfig.js.map → getReactNavigationConfig.cjs.map} +0 -0
- /package/dist/cjs/{getRoutes.js.map → getRoutes.cjs.map} +0 -0
- /package/dist/cjs/{getURL.js.map → getURL.cjs.map} +0 -0
- /package/dist/cjs/head/{Head.js.map → Head.cjs.map} +0 -0
- /package/dist/cjs/head/{HeadModule.js.map → HeadModule.cjs.map} +0 -0
- /package/dist/cjs/head/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/head/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/head/{url.js.map → url.cjs.map} +0 -0
- /package/dist/cjs/{hooks.js.map → hooks.cjs.map} +0 -0
- /package/dist/cjs/{imperative-api.js.map → imperative-api.cjs.map} +0 -0
- /package/dist/cjs/import-mode/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/import-mode/{index.web.js.map → index.web.cjs.map} +0 -0
- /package/dist/cjs/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{router.js.map → router.cjs.map} +0 -0
- /package/dist/cjs/layouts/{Drawer.js.map → Drawer.cjs.map} +0 -0
- /package/dist/cjs/layouts/{Stack.js.map → Stack.cjs.map} +0 -0
- /package/dist/cjs/layouts/{Tabs.js.map → Tabs.cjs.map} +0 -0
- /package/dist/cjs/layouts/{withLayoutContext.js.map → withLayoutContext.cjs.map} +0 -0
- /package/dist/cjs/link/{Link.js.map → Link.cjs.map} +0 -0
- /package/dist/cjs/link/{Redirect.js.map → Redirect.cjs.map} +0 -0
- /package/dist/cjs/link/{href.js.map → href.cjs.map} +0 -0
- /package/dist/cjs/link/{linking.js.map → linking.cjs.map} +0 -0
- /package/dist/cjs/link/{path.js.map → path.cjs.map} +0 -0
- /package/dist/cjs/link/{useLinkTo.js.map → useLinkTo.cjs.map} +0 -0
- /package/dist/cjs/link/{useLoadedNavigation.js.map → useLoadedNavigation.cjs.map} +0 -0
- /package/dist/cjs/{matchers.js.map → matchers.cjs.map} +0 -0
- /package/dist/cjs/{platform.js.map → platform.cjs.map} +0 -0
- /package/dist/cjs/{polyfills-mobile.js.map → polyfills-mobile.cjs.map} +0 -0
- /package/dist/cjs/{polyfills-server.js.map → polyfills-server.cjs.map} +0 -0
- /package/dist/cjs/{render.js.map → render.cjs.map} +0 -0
- /package/dist/cjs/router/{RouterStore.js.map → RouterStore.cjs.map} +0 -0
- /package/dist/cjs/router/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/cjs/router/{getNormalizedStatePath.js.map → getNormalizedStatePath.cjs.map} +0 -0
- /package/dist/cjs/router/{lastAction.js.map → lastAction.cjs.map} +0 -0
- /package/dist/cjs/router/{router.js.map → router.cjs.map} +0 -0
- /package/dist/cjs/router/{serverLocationContext.js.map → serverLocationContext.cjs.map} +0 -0
- /package/dist/cjs/router/{useInitializeOneRouter.js.map → useInitializeOneRouter.cjs.map} +0 -0
- /package/dist/cjs/{serve.js.map → serve.cjs.map} +0 -0
- /package/dist/cjs/server/{createRoutesManifest.js.map → createRoutesManifest.cjs.map} +0 -0
- /package/dist/cjs/server/{getServerManifest.js.map → getServerManifest.cjs.map} +0 -0
- /package/dist/cjs/{server-render.js.map → server-render.cjs.map} +0 -0
- /package/dist/cjs/{sortRoutes.js.map → sortRoutes.cjs.map} +0 -0
- /package/dist/cjs/typed-routes/{generateRouteTypes.js.map → generateRouteTypes.cjs.map} +0 -0
- /package/dist/cjs/typed-routes/{getTypedRoutesDeclarationFile.js.map → getTypedRoutesDeclarationFile.cjs.map} +0 -0
- /package/dist/cjs/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/{useFocusEffect.js.map → useFocusEffect.cjs.map} +0 -0
- /package/dist/cjs/{useLoader.js.map → useLoader.cjs.map} +0 -0
- /package/dist/cjs/{useNavigation.js.map → useNavigation.cjs.map} +0 -0
- /package/dist/cjs/{useScreens.js.map → useScreens.cjs.map} +0 -0
- /package/dist/cjs/{useViteRoutes.js.map → useViteRoutes.cjs.map} +0 -0
- /package/dist/cjs/utils/{assertIsReady.js.map → assertIsReady.cjs.map} +0 -0
- /package/dist/cjs/utils/{dynamicImport.js.map → dynamicImport.cjs.map} +0 -0
- /package/dist/cjs/utils/{existsAsync.js.map → existsAsync.cjs.map} +0 -0
- /package/dist/cjs/utils/{getPageExport.js.map → getPageExport.cjs.map} +0 -0
- /package/dist/cjs/utils/{globDir.js.map → globDir.cjs.map} +0 -0
- /package/dist/cjs/utils/{hashString.js.map → hashString.cjs.map} +0 -0
- /package/dist/cjs/utils/{isResponse.js.map → isResponse.cjs.map} +0 -0
- /package/dist/cjs/utils/{isStatus.js.map → isStatus.cjs.map} +0 -0
- /package/dist/cjs/utils/{promiseWithResolvers.js.map → promiseWithResolvers.cjs.map} +0 -0
- /package/dist/cjs/utils/{rand.js.map → rand.cjs.map} +0 -0
- /package/dist/cjs/utils/{redirect.js.map → redirect.cjs.map} +0 -0
- /package/dist/cjs/utils/{removeSearch.js.map → removeSearch.cjs.map} +0 -0
- /package/dist/cjs/utils/{removeUndefined.js.map → removeUndefined.cjs.map} +0 -0
- /package/dist/cjs/utils/{url.js.map → url.cjs.map} +0 -0
- /package/dist/cjs/utils/{weakKey.js.map → weakKey.cjs.map} +0 -0
- /package/dist/cjs/utils/{weakMemo.js.map → weakMemo.cjs.map} +0 -0
- /package/dist/cjs/views/{EmptyRoute.js.map → EmptyRoute.cjs.map} +0 -0
- /package/dist/cjs/views/{ErrorBoundary.js.map → ErrorBoundary.cjs.map} +0 -0
- /package/dist/cjs/views/{LoadProgressBar.js.map → LoadProgressBar.cjs.map} +0 -0
- /package/dist/cjs/views/{Navigator.js.map → Navigator.cjs.map} +0 -0
- /package/dist/cjs/views/{PreloadLinks.js.map → PreloadLinks.cjs.map} +0 -0
- /package/dist/cjs/views/{RootErrorBoundary.js.map → RootErrorBoundary.cjs.map} +0 -0
- /package/dist/cjs/views/{Screen.js.map → Screen.cjs.map} +0 -0
- /package/dist/cjs/views/{ScrollRestoration.js.map → ScrollRestoration.cjs.map} +0 -0
- /package/dist/cjs/views/{Try.js.map → Try.cjs.map} +0 -0
- /package/dist/cjs/vite/{build.js.map → build.cjs.map} +0 -0
- /package/dist/cjs/vite/{clientTreeShakePlugin.js.map → clientTreeShakePlugin.cjs.map} +0 -0
- /package/dist/cjs/vite/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/cjs/vite/{createFileSystemRouter.js.map → createFileSystemRouter.cjs.map} +0 -0
- /package/dist/cjs/vite/{customNodeExternals.js.map → customNodeExternals.cjs.map} +0 -0
- /package/dist/cjs/vite/{ensureTsConfig.js.map → ensureTsConfig.cjs.map} +0 -0
- /package/dist/cjs/vite/{findDepsToOptimize.js.map → findDepsToOptimize.cjs.map} +0 -0
- /package/dist/cjs/vite/{fixDependenciesPlugin.js.map → fixDependenciesPlugin.cjs.map} +0 -0
- /package/dist/cjs/vite/{generateTypesForRoutes.js.map → generateTypesForRoutes.cjs.map} +0 -0
- /package/dist/cjs/vite/{getManifest.js.map → getManifest.cjs.map} +0 -0
- /package/dist/cjs/vite/{headers.js.map → headers.cjs.map} +0 -0
- /package/dist/cjs/vite/{loadEnv.js.map → loadEnv.cjs.map} +0 -0
- /package/dist/cjs/vite/{makePluginWebOnly.js.map → makePluginWebOnly.cjs.map} +0 -0
- /package/dist/cjs/vite/{one.js.map → one.cjs.map} +0 -0
- /package/dist/cjs/vite/{removeReactNativeWebAnimatedPlugin.js.map → removeReactNativeWebAnimatedPlugin.cjs.map} +0 -0
- /package/dist/cjs/vite/{replaceLoader.js.map → replaceLoader.cjs.map} +0 -0
- /package/dist/cjs/vite/{resolveAPIRequest.js.map → resolveAPIRequest.cjs.map} +0 -0
- /package/dist/cjs/vite/{server.js.map → server.cjs.map} +0 -0
- /package/dist/cjs/vite/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/vite/{virtualEntryPlugin.js.map → virtualEntryPlugin.cjs.map} +0 -0
- /package/dist/cjs/vite/{vitePluginSsrCss.js.map → vitePluginSsrCss.cjs.map} +0 -0
- /package/dist/cjs/{vite.js.map → vite.cjs.map} +0 -0
- /package/dist/cjs/zero/{getQueryKey.js.map → getQueryKey.cjs.map} +0 -0
- /package/dist/cjs/zero/{isZeroQuery.js.map → isZeroQuery.cjs.map} +0 -0
- /package/dist/cjs/zero/{resolveQuery.js.map → resolveQuery.cjs.map} +0 -0
- /package/dist/cjs/zero/{subscribeToQuery.js.map → subscribeToQuery.cjs.map} +0 -0
- /package/dist/cjs/zero/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/zero/{useQuery.js.map → useQuery.cjs.map} +0 -0
- /package/dist/cjs/zero/{useQueryZero.js.map → useQueryZero.cjs.map} +0 -0
- /package/dist/cjs/{zero.js.map → zero.cjs.map} +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var createMemoryHistory_exports = {};
|
|
22
|
+
__export(createMemoryHistory_exports, {
|
|
23
|
+
default: () => createMemoryHistory
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(createMemoryHistory_exports);
|
|
26
|
+
var import_non_secure = require("nanoid/non-secure");
|
|
27
|
+
function createMemoryHistory() {
|
|
28
|
+
let index = 0,
|
|
29
|
+
items = [];
|
|
30
|
+
const pending = [],
|
|
31
|
+
interrupt = () => {
|
|
32
|
+
pending.forEach(it => {
|
|
33
|
+
const cb = it.cb;
|
|
34
|
+
it.cb = () => cb(!0);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
get index() {
|
|
39
|
+
const id = window.history.state?.id;
|
|
40
|
+
if (id) {
|
|
41
|
+
const index2 = items.findIndex(item => item.id === id);
|
|
42
|
+
return index2 > -1 ? index2 : 0;
|
|
43
|
+
}
|
|
44
|
+
return 0;
|
|
45
|
+
},
|
|
46
|
+
get(index2) {
|
|
47
|
+
return items[index2];
|
|
48
|
+
},
|
|
49
|
+
backIndex({
|
|
50
|
+
path
|
|
51
|
+
}) {
|
|
52
|
+
for (let i = index - 1; i >= 0; i--) if (items[i].path === path) return i;
|
|
53
|
+
return -1;
|
|
54
|
+
},
|
|
55
|
+
push({
|
|
56
|
+
path,
|
|
57
|
+
state
|
|
58
|
+
}) {
|
|
59
|
+
interrupt();
|
|
60
|
+
const id = (0, import_non_secure.nanoid)();
|
|
61
|
+
items = items.slice(0, index + 1), items.push({
|
|
62
|
+
path,
|
|
63
|
+
state,
|
|
64
|
+
id
|
|
65
|
+
}), index = items.length - 1, window.history.pushState({
|
|
66
|
+
id
|
|
67
|
+
}, "", path);
|
|
68
|
+
},
|
|
69
|
+
replace({
|
|
70
|
+
path,
|
|
71
|
+
state
|
|
72
|
+
}) {
|
|
73
|
+
interrupt();
|
|
74
|
+
const id = window.history.state?.id ?? (0, import_non_secure.nanoid)();
|
|
75
|
+
let pathWithHash = path;
|
|
76
|
+
!items.length || items.findIndex(item => item.id === id) < 0 ? (pathWithHash = pathWithHash + location.hash, items = [{
|
|
77
|
+
path: pathWithHash,
|
|
78
|
+
state,
|
|
79
|
+
id
|
|
80
|
+
}], index = 0) : (items[index].path === path && (pathWithHash = pathWithHash + location.hash), items[index] = {
|
|
81
|
+
path,
|
|
82
|
+
state,
|
|
83
|
+
id
|
|
84
|
+
}), window.history.replaceState({
|
|
85
|
+
id
|
|
86
|
+
}, "", pathWithHash);
|
|
87
|
+
},
|
|
88
|
+
// `history.go(n)` is asynchronous, there are couple of things to keep in mind:
|
|
89
|
+
// - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.
|
|
90
|
+
// - each `history.go(n)` call will trigger a separate `popstate` event with correct location.
|
|
91
|
+
// - the `popstate` event fires before the next frame after calling `history.go(n)`.
|
|
92
|
+
// This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.
|
|
93
|
+
go(n) {
|
|
94
|
+
interrupt();
|
|
95
|
+
const nextIndex = index + n,
|
|
96
|
+
lastItemIndex = items.length - 1;
|
|
97
|
+
if (n < 0 && !items[nextIndex] ? (n = -index, index = 0) : n > 0 && nextIndex > lastItemIndex ? (n = lastItemIndex - index, index = lastItemIndex) : index = nextIndex, n !== 0) return new Promise((resolve, reject) => {
|
|
98
|
+
const done = interrupted => {
|
|
99
|
+
if (clearTimeout(timer), interrupted) {
|
|
100
|
+
reject(new Error("History was changed during navigation."));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const {
|
|
104
|
+
title
|
|
105
|
+
} = window.document;
|
|
106
|
+
window.document.title = "", window.document.title = title, resolve();
|
|
107
|
+
};
|
|
108
|
+
pending.push({
|
|
109
|
+
ref: done,
|
|
110
|
+
cb: done
|
|
111
|
+
});
|
|
112
|
+
const timer = setTimeout(() => {
|
|
113
|
+
const index2 = pending.findIndex(it => it.ref === done);
|
|
114
|
+
index2 > -1 && (pending[index2].cb(), pending.splice(index2, 1));
|
|
115
|
+
}, 100),
|
|
116
|
+
onPopState = () => {
|
|
117
|
+
const id = window.history.state?.id,
|
|
118
|
+
currentIndex = items.findIndex(item => item.id === id);
|
|
119
|
+
index = Math.max(currentIndex, 0);
|
|
120
|
+
const last = pending.pop();
|
|
121
|
+
window.removeEventListener("popstate", onPopState), last?.cb();
|
|
122
|
+
};
|
|
123
|
+
window.addEventListener("popstate", onPopState), window.history.go(n);
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
// The `popstate` event is triggered when history changes, except `pushState` and `replaceState`
|
|
127
|
+
// If we call `history.go(n)` ourselves, we don't want it to trigger the listener
|
|
128
|
+
// Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener
|
|
129
|
+
listen(listener) {
|
|
130
|
+
const onPopState = () => {
|
|
131
|
+
pending.length || listener();
|
|
132
|
+
};
|
|
133
|
+
return window.addEventListener("popstate", onPopState), () => window.removeEventListener("popstate", onPopState);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -2,24 +2,33 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf,
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
15
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
18
23
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
24
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
23
32
|
var extractPathFromURL_exports = {};
|
|
24
33
|
__export(extractPathFromURL_exports, {
|
|
25
34
|
adjustPathname: () => adjustPathname,
|
|
@@ -29,11 +38,13 @@ module.exports = __toCommonJS(extractPathFromURL_exports);
|
|
|
29
38
|
var import_url_parse = __toESM(require("url-parse"), 1);
|
|
30
39
|
function extractExactPathFromURL(url) {
|
|
31
40
|
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
// If a universal link / app link / web URL is used, we should use the path
|
|
42
|
+
// from the URL, while stripping the origin.
|
|
43
|
+
url.match(/^https?:\/\//)) {
|
|
44
|
+
const {
|
|
45
|
+
origin,
|
|
46
|
+
href
|
|
47
|
+
} = new import_url_parse.default(url);
|
|
37
48
|
return href.replace(origin, "");
|
|
38
49
|
}
|
|
39
50
|
return fromDeepLink(url);
|
|
@@ -44,8 +55,7 @@ function isExpoDevelopmentClient(url) {
|
|
|
44
55
|
function fromDeepLink(url) {
|
|
45
56
|
const res = new import_url_parse.default(url, !0);
|
|
46
57
|
if (isExpoDevelopmentClient(res)) {
|
|
47
|
-
if (!res.query || !res.query.url)
|
|
48
|
-
return "";
|
|
58
|
+
if (!res.query || !res.query.url) return "";
|
|
49
59
|
const incomingUrl = res.query.url;
|
|
50
60
|
return extractExactPathFromURL(decodeURI(incomingUrl));
|
|
51
61
|
}
|
|
@@ -58,5 +68,4 @@ function extractExpoPathFromURL(url = "") {
|
|
|
58
68
|
}
|
|
59
69
|
function adjustPathname(url) {
|
|
60
70
|
return url.hostname === "exp.host" || url.hostname === "u.expo.dev" ? url.pathname.split("/").slice(2).join("/") : url.pathname;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=extractPathFromURL.js.map
|
|
71
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var findFocusedRoute_exports = {};
|
|
22
|
+
__export(findFocusedRoute_exports, {
|
|
23
|
+
findFocusedRoute: () => findFocusedRoute
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(findFocusedRoute_exports);
|
|
26
|
+
function findFocusedRoute(state) {
|
|
27
|
+
let current = state;
|
|
28
|
+
for (; current?.routes[current.index ?? 0].state != null;) current = current.routes[current.index ?? 0].state;
|
|
29
|
+
return current?.routes[current?.index ?? 0];
|
|
30
|
+
}
|
|
@@ -3,15 +3,21 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
15
21
|
var getPathFromState_exports = {};
|
|
16
22
|
__export(getPathFromState_exports, {
|
|
17
23
|
appendBaseUrl: () => appendBaseUrl,
|
|
@@ -20,11 +26,13 @@ __export(getPathFromState_exports, {
|
|
|
20
26
|
getPathDataFromState: () => getPathDataFromState
|
|
21
27
|
});
|
|
22
28
|
module.exports = __toCommonJS(getPathFromState_exports);
|
|
23
|
-
var import_core = require("@react-navigation/core"),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
var import_core = require("@react-navigation/core"),
|
|
30
|
+
import_matchers = require("../matchers.cjs");
|
|
31
|
+
const DEFAULT_SCREENS = {},
|
|
32
|
+
getActiveRoute = state => {
|
|
33
|
+
const route = typeof state.index == "number" ? state.routes[state.index] : state.routes[state.routes.length - 1];
|
|
34
|
+
return route.state ? getActiveRoute(route.state) : route && isInvalidParams(route.params) ? getActiveRoute(createFakeState(route.params)) : route;
|
|
35
|
+
};
|
|
28
36
|
function createFakeState(params) {
|
|
29
37
|
return {
|
|
30
38
|
stale: !1,
|
|
@@ -32,14 +40,12 @@ function createFakeState(params) {
|
|
|
32
40
|
key: "UNKNOWN",
|
|
33
41
|
index: 0,
|
|
34
42
|
routeNames: [],
|
|
35
|
-
routes: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
+
routes: [{
|
|
44
|
+
key: "UNKNOWN",
|
|
45
|
+
name: params.screen,
|
|
46
|
+
params: params.params,
|
|
47
|
+
path: params.path
|
|
48
|
+
}]
|
|
43
49
|
};
|
|
44
50
|
}
|
|
45
51
|
function segmentMatchesConvention(segment) {
|
|
@@ -51,50 +57,43 @@ function encodeURIComponentPreservingBrackets(str) {
|
|
|
51
57
|
function getPathFromState(state, _options) {
|
|
52
58
|
return getPathDataFromState(state, _options).path;
|
|
53
59
|
}
|
|
54
|
-
function getPathDataFromState(state, _options = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
function getPathDataFromState(state, _options = {
|
|
61
|
+
screens: DEFAULT_SCREENS
|
|
62
|
+
}) {
|
|
63
|
+
if (state == null) throw Error("Got 'undefined' for the navigation state. You must pass a valid state object.");
|
|
64
|
+
const {
|
|
65
|
+
preserveGroups,
|
|
66
|
+
preserveDynamicRoutes,
|
|
67
|
+
...options
|
|
68
|
+
} = _options;
|
|
69
|
+
if ((0, import_core.validatePathConfig)(options), Object.is(options.screens, DEFAULT_SCREENS)) throw Error("You must pass a 'screens' object to 'getPathFromState' to generate a path.");
|
|
70
|
+
return getPathFromResolvedState(state,
|
|
71
|
+
// Create a normalized configs object which will be easier to use
|
|
72
|
+
createNormalizedConfigs(options.screens), {
|
|
73
|
+
preserveGroups,
|
|
74
|
+
preserveDynamicRoutes
|
|
75
|
+
});
|
|
66
76
|
}
|
|
67
77
|
function processParamsWithUserSettings(configItem, params) {
|
|
68
78
|
const stringify = configItem?.stringify;
|
|
69
|
-
return Object.fromEntries(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// Preserve rest params
|
|
75
|
-
Array.isArray(value) ? value : String(value)
|
|
76
|
-
)
|
|
77
|
-
])
|
|
78
|
-
);
|
|
79
|
+
return Object.fromEntries(Object.entries(params).map(([key, value]) => [key,
|
|
80
|
+
// TODO: Strip nullish values here.
|
|
81
|
+
stringify?.[key] ? stringify[key](value) :
|
|
82
|
+
// Preserve rest params
|
|
83
|
+
Array.isArray(value) ? value : String(value)]));
|
|
79
84
|
}
|
|
80
85
|
function deepEqual(a, b) {
|
|
81
|
-
if (a === b)
|
|
82
|
-
return !0;
|
|
86
|
+
if (a === b) return !0;
|
|
83
87
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
84
|
-
if (a.length !== b.length)
|
|
85
|
-
|
|
86
|
-
for (let i = 0; i < a.length; i++)
|
|
87
|
-
if (!deepEqual(a[i], b[i]))
|
|
88
|
-
return !1;
|
|
88
|
+
if (a.length !== b.length) return !1;
|
|
89
|
+
for (let i = 0; i < a.length; i++) if (!deepEqual(a[i], b[i])) return !1;
|
|
89
90
|
return !0;
|
|
90
91
|
}
|
|
91
92
|
if (typeof a == "object" && typeof b == "object") {
|
|
92
|
-
const keysA = Object.keys(a),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
for (const key of keysA)
|
|
96
|
-
if (!deepEqual(a[key], b[key]))
|
|
97
|
-
return !1;
|
|
93
|
+
const keysA = Object.keys(a),
|
|
94
|
+
keysB = Object.keys(b);
|
|
95
|
+
if (keysA.length !== keysB.length) return !1;
|
|
96
|
+
for (const key of keysA) if (!deepEqual(a[key], b[key])) return !1;
|
|
98
97
|
return !0;
|
|
99
98
|
}
|
|
100
99
|
return !1;
|
|
@@ -103,12 +102,14 @@ function walkConfigItems(route, focusedRoute, configs, {
|
|
|
103
102
|
preserveDynamicRoutes
|
|
104
103
|
}) {
|
|
105
104
|
!route.state && isInvalidParams(route.params) && (route.state = createFakeState(route.params));
|
|
106
|
-
let pattern = null,
|
|
105
|
+
let pattern = null,
|
|
106
|
+
focusedParams,
|
|
107
|
+
hash;
|
|
107
108
|
const collectedParams = {};
|
|
108
|
-
for (; route.name in configs;
|
|
109
|
-
const configItem = configs[route.name],
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
for (; route.name in configs;) {
|
|
110
|
+
const configItem = configs[route.name],
|
|
111
|
+
inputPattern = configItem.pattern;
|
|
112
|
+
if (inputPattern == null) throw new Error("Unexpected: No pattern found for route " + route.name);
|
|
112
113
|
if (pattern = inputPattern, route.params) {
|
|
113
114
|
route.params["#"] && (hash = route.params["#"], delete route.params["#"]);
|
|
114
115
|
const params = processParamsWithUserSettings(configItem, route.params);
|
|
@@ -126,16 +127,12 @@ function walkConfigItems(route, focusedRoute, configs, {
|
|
|
126
127
|
}))));
|
|
127
128
|
break;
|
|
128
129
|
}
|
|
129
|
-
const index = route.state.index ?? route.state.routes.length - 1,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
else
|
|
133
|
-
break;
|
|
130
|
+
const index = route.state.index ?? route.state.routes.length - 1,
|
|
131
|
+
nextRoute = route.state.routes[index],
|
|
132
|
+
nestedScreens = configItem.screens;
|
|
133
|
+
if (nestedScreens && nextRoute.name in nestedScreens) route = nextRoute, configs = nestedScreens;else break;
|
|
134
134
|
}
|
|
135
|
-
if (pattern == null)
|
|
136
|
-
throw new Error(
|
|
137
|
-
`No pattern found for route "${route.name}". Options are: ${Object.keys(configs).join(", ")}.`
|
|
138
|
-
);
|
|
135
|
+
if (pattern == null) throw new Error(`No pattern found for route "${route.name}". Options are: ${Object.keys(configs).join(", ")}.`);
|
|
139
136
|
return pattern && !focusedParams && focusedRoute.params && (preserveDynamicRoutes ? focusedParams = focusedRoute.params : focusedParams = getParamsWithConventionsCollapsed({
|
|
140
137
|
params: focusedRoute.params,
|
|
141
138
|
pattern,
|
|
@@ -152,9 +149,11 @@ function getPathFromResolvedState(state, configs, {
|
|
|
152
149
|
preserveGroups,
|
|
153
150
|
preserveDynamicRoutes
|
|
154
151
|
}) {
|
|
155
|
-
let path = "",
|
|
152
|
+
let path = "",
|
|
153
|
+
current = state,
|
|
154
|
+
hash;
|
|
156
155
|
const allParams = {};
|
|
157
|
-
for (; current;
|
|
156
|
+
for (; current;) {
|
|
158
157
|
path += "/";
|
|
159
158
|
const route = current.routes[current.index ?? 0];
|
|
160
159
|
!route.state && isInvalidParams(route.params) && (route.state = createFakeState(route.params));
|
|
@@ -164,7 +163,11 @@ function getPathFromResolvedState(state, configs, {
|
|
|
164
163
|
nextRoute,
|
|
165
164
|
focusedParams,
|
|
166
165
|
hash: $hash
|
|
167
|
-
} = walkConfigItems(route, getActiveRoute(current), {
|
|
166
|
+
} = walkConfigItems(route, getActiveRoute(current), {
|
|
167
|
+
...configs
|
|
168
|
+
}, {
|
|
169
|
+
preserveDynamicRoutes
|
|
170
|
+
});
|
|
168
171
|
if ($hash && (hash = $hash), Object.assign(allParams, params2), path += getPathWithConventionsCollapsed({
|
|
169
172
|
pattern,
|
|
170
173
|
routePath: nextRoute.path,
|
|
@@ -172,18 +175,17 @@ function getPathFromResolvedState(state, configs, {
|
|
|
172
175
|
initialRouteName: configs[nextRoute.name]?.initialRouteName,
|
|
173
176
|
preserveGroups,
|
|
174
177
|
preserveDynamicRoutes
|
|
175
|
-
}), nextRoute.state &&
|
|
178
|
+
}), nextRoute.state &&
|
|
179
|
+
// NOTE: The upstream implementation allows for sending in synthetic states (states that weren't generated by `getStateFromPath`)
|
|
176
180
|
// and any invalid routes will simply be ignored.
|
|
177
181
|
// Because of this, we need to check if the next route is valid before continuing, otherwise our more strict
|
|
178
182
|
// implementation will throw an error.
|
|
179
|
-
configs[nextRoute.state.routes?.[nextRoute.state?.index ?? 0]?.name])
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (focusedParams && // note: using [...route] is returning an array which shouldn't go on search, this is just
|
|
183
|
+
configs[nextRoute.state.routes?.[nextRoute.state?.index ?? 0]?.name]) current = nextRoute.state;else {
|
|
184
|
+
if (focusedParams &&
|
|
185
|
+
// note: using [...route] is returning an array which shouldn't go on search, this is just
|
|
183
186
|
// an initial hacky test to work around this as we dont want to pass that to search
|
|
184
187
|
!Array.isArray(focusedParams)) {
|
|
185
|
-
for (const param in focusedParams)
|
|
186
|
-
focusedParams[param] === "undefined" && delete focusedParams[param];
|
|
188
|
+
for (const param in focusedParams) focusedParams[param] === "undefined" && delete focusedParams[param];
|
|
187
189
|
const query = new URLSearchParams(focusedParams).toString();
|
|
188
190
|
query && (path += `?${query}`);
|
|
189
191
|
}
|
|
@@ -192,16 +194,18 @@ function getPathFromResolvedState(state, configs, {
|
|
|
192
194
|
}
|
|
193
195
|
hash && (allParams["#"] = hash, path += `#${hash}`);
|
|
194
196
|
const params = decodeParams(allParams);
|
|
195
|
-
return {
|
|
197
|
+
return {
|
|
198
|
+
path: appendBaseUrl(basicSanitizePath(path)),
|
|
199
|
+
params
|
|
200
|
+
};
|
|
196
201
|
}
|
|
197
202
|
function decodeParams(params) {
|
|
198
203
|
const parsed = {};
|
|
199
|
-
for (const [key, value] of Object.entries(params))
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
204
|
+
for (const [key, value] of Object.entries(params)) try {
|
|
205
|
+
Array.isArray(value) ? parsed[key] = value.map(v => decodeURIComponent(v)) : parsed[key] = decodeURIComponent(value);
|
|
206
|
+
} catch {
|
|
207
|
+
parsed[key] = value;
|
|
208
|
+
}
|
|
205
209
|
return parsed;
|
|
206
210
|
}
|
|
207
211
|
function getPathWithConventionsCollapsed({
|
|
@@ -216,18 +220,21 @@ function getPathWithConventionsCollapsed({
|
|
|
216
220
|
return segments.map((p, i) => {
|
|
217
221
|
const name = getParamName(p);
|
|
218
222
|
return p.startsWith("*") ? preserveDynamicRoutes ? name === "not-found" ? "+not-found" : `[...${name}]` : params[name] ? Array.isArray(params[name]) ? params[name].join("/") : params[name] : i === 0 ? routePath : routePath?.split("/").slice(i + 1).join("/") : p.startsWith(":") ? preserveDynamicRoutes ? `[${name}]` : params[name] : !preserveGroups && (0, import_matchers.matchGroupName)(p) != null ? segments.length - 1 === i && initialRouteName ? segmentMatchesConvention(initialRouteName) ? "" : encodeURIComponentPreservingBrackets(initialRouteName) : "" : encodeURIComponentPreservingBrackets(p);
|
|
219
|
-
}).map(
|
|
223
|
+
}).map(v => v ?? "").join("/");
|
|
220
224
|
}
|
|
221
225
|
function getParamsWithConventionsCollapsed({
|
|
222
226
|
pattern,
|
|
223
227
|
routeName,
|
|
224
228
|
params
|
|
225
229
|
}) {
|
|
226
|
-
const processedParams = {
|
|
227
|
-
|
|
230
|
+
const processedParams = {
|
|
231
|
+
...params
|
|
232
|
+
},
|
|
233
|
+
segments = pattern.split("/");
|
|
234
|
+
if (segments.filter(segment => segment.startsWith(":")).forEach(segment => {
|
|
228
235
|
const name = getParamName(segment);
|
|
229
236
|
delete processedParams[name];
|
|
230
|
-
}), segments.some(
|
|
237
|
+
}), segments.some(segment => segment.startsWith("*"))) {
|
|
231
238
|
const name = (0, import_matchers.testNotFound)(routeName) ? "not-found" : (0, import_matchers.matchDeepDynamicRouteName)(routeName) ?? routeName;
|
|
232
239
|
delete processedParams[name];
|
|
233
240
|
}
|
|
@@ -238,28 +245,28 @@ function basicSanitizePath(path) {
|
|
|
238
245
|
return simplifiedPath.length <= 1 ? simplifiedPath : simplifiedPath.replace(/\/$/, "");
|
|
239
246
|
}
|
|
240
247
|
function isInvalidParams(params) {
|
|
241
|
-
return params ? "params" in params && typeof params.params == "object" && params.params ? !0 : "initial" in params && typeof params.initial == "boolean" &&
|
|
248
|
+
return params ? "params" in params && typeof params.params == "object" && params.params ? !0 : "initial" in params && typeof params.initial == "boolean" &&
|
|
249
|
+
// "path" in params &&
|
|
242
250
|
"screen" in params : !1;
|
|
243
251
|
}
|
|
244
|
-
const getParamName =
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
);
|
|
252
|
+
const getParamName = pattern => pattern.replace(/^[:*]/, "").replace(/\?$/, ""),
|
|
253
|
+
joinPaths = (...paths) => [].concat(...paths.map(p => p.split("/"))).filter(Boolean).join("/"),
|
|
254
|
+
createConfigItem = (config, parentPattern) => {
|
|
255
|
+
if (typeof config == "string") return {
|
|
256
|
+
pattern: parentPattern ? joinPaths(parentPattern, config) : config
|
|
257
|
+
};
|
|
258
|
+
if (config.exact && config.path === void 0) 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: ''`.");
|
|
259
|
+
const pattern = config.exact !== !0 ? joinPaths(parentPattern || "", config.path || "") : config.path || "",
|
|
260
|
+
screens = config.screens ? createNormalizedConfigs(config.screens, pattern) : void 0;
|
|
261
|
+
return {
|
|
262
|
+
// Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.
|
|
263
|
+
pattern: pattern?.split("/").filter(Boolean).join("/"),
|
|
264
|
+
stringify: config.stringify,
|
|
265
|
+
screens,
|
|
266
|
+
initialRouteName: config.initialRouteName
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
createNormalizedConfigs = (options, pattern) => Object.fromEntries(Object.entries(options).map(([name, c]) => [name, createConfigItem(c, pattern)]));
|
|
262
270
|
function appendBaseUrl(path, baseUrl = process.env.EXPO_BASE_URL) {
|
|
263
271
|
return process.env.NODE_ENV !== "development" && baseUrl ? `/${baseUrl.replace(/^\/+/, "").replace(/\/$/, "")}${path}` : path;
|
|
264
|
-
}
|
|
265
|
-
//# sourceMappingURL=getPathFromState.js.map
|
|
272
|
+
}
|