@tanstack/react-router
Advanced tools
Comparing version 1.51.2 to 1.51.4
import { defaultSerializeError } from './router.js'; | ||
export type DeferredPromiseState<T> = { | ||
@@ -4,0 +3,0 @@ uid: string; |
@@ -6,3 +6,2 @@ import { Constrain } from './utils.js'; | ||
import { RouteById, RouteIds } from './routeInfo.js'; | ||
export interface FileRoutesByPath { | ||
@@ -55,5 +54,5 @@ } | ||
}) => TSelected; | ||
useNavigate: () => import('./useNavigate').UseNavigateResult<string>; | ||
useNavigate: () => import('./useNavigate.js').UseNavigateResult<string>; | ||
} | ||
export declare function createLazyRoute<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>>(id: TId): (opts: LazyRouteOptions) => LazyRoute<TRoute>; | ||
export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>; |
@@ -71,4 +71,8 @@ import warning from "tiny-warning"; | ||
} | ||
const routeGroupPatternRegex = /\(.+\)/g; | ||
function removeGroups(s) { | ||
return s.replaceAll(routeGroupPatternRegex, "").replaceAll("//", "/"); | ||
} | ||
function createLazyFileRoute(id) { | ||
return (opts) => new LazyRoute({ id, ...opts }); | ||
return (opts) => new LazyRoute({ id: removeGroups(id), ...opts }); | ||
} | ||
@@ -75,0 +79,0 @@ export { |
@@ -58,3 +58,3 @@ export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history'; | ||
useLayoutEffect, // SSR | ||
pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils'; | ||
pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils.js'; | ||
export { notFound, isNotFound, CatchNotFound, DefaultGlobalNotFound, } from './not-found.js'; | ||
@@ -61,0 +61,0 @@ export type { NotFoundError } from './not-found.js'; |
import { AsyncRouteComponent } from './route.js'; | ||
export declare function lazyRouteComponent<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey): T[TKey] extends (props: infer TProps) => any ? AsyncRouteComponent<TProps> : never; |
import { HistoryState } from '@tanstack/history'; | ||
import { AnySearchSchema } from './route.js'; | ||
export interface ParsedLocation<TSearchObj extends AnySearchSchema = {}> { | ||
@@ -5,0 +4,0 @@ href: string; |
import { MatchLocation } from './RouterProvider.js'; | ||
import { AnyPathParams } from './route.js'; | ||
export interface Segment { | ||
@@ -5,0 +4,0 @@ type: 'pathname' | 'param' | 'wildcard'; |
@@ -5,3 +5,2 @@ import { NavigateOptions } from './link.js'; | ||
import { PickAsRequired } from './utils.js'; | ||
export type AnyRedirect = Redirect<any, any, any, any, any>; | ||
@@ -8,0 +7,0 @@ export type Redirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom, TMaskTo extends string = ''> = { |
import { AnyRouter } from './router.js'; | ||
import { AnyRoute } from './route.js'; | ||
export declare function renderRouteNotFound(router: AnyRouter, route: AnyRoute, data: any): import("react/jsx-runtime").JSX.Element; |
import { AnyRoute } from './route.js'; | ||
import { AnyRouter, TrailingSlashOption } from './router.js'; | ||
import { MergeUnion } from './utils.js'; | ||
export type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends { | ||
@@ -6,0 +5,0 @@ types: { |
@@ -15,3 +15,2 @@ import { Store, NoInfer } from '@tanstack/react-store'; | ||
import { RouterTransformer } from './transformer.js'; | ||
import type * as React from 'react'; | ||
@@ -18,0 +17,0 @@ declare global { |
import { ParsedLocation } from './location.js'; | ||
export type ScrollRestorationOptions = { | ||
@@ -4,0 +3,0 @@ getKey?: (location: ParsedLocation) => string; |
import { AnySearchSchema } from './route.js'; | ||
export declare const defaultParseSearch: (searchStr: string) => AnySearchSchema; | ||
@@ -4,0 +3,0 @@ export declare const defaultStringifySearch: (search: Record<string, any>) => string; |
import { BlockerFn } from '@tanstack/history'; | ||
import { ReactNode } from './route.js'; | ||
type BlockerResolver = { | ||
@@ -5,0 +4,0 @@ status: 'idle' | 'blocked'; |
@@ -6,3 +6,2 @@ import { RegisteredRouter } from './router.js'; | ||
import { StrictOrFrom } from './utils.js'; | ||
export type UseLoaderDataOptions<TRouteTree extends AnyRoute, TFrom, TStrict extends boolean, TRouteMatch extends MakeRouteMatch<TRouteTree, TFrom, TStrict>, TSelected> = StrictOrFrom<TFrom, TStrict> & { | ||
@@ -9,0 +8,0 @@ select?: (match: Required<TRouteMatch>['loaderData']) => TSelected; |
@@ -6,5 +6,4 @@ import { RegisteredRouter } from './router.js'; | ||
import { StrictOrFrom } from './utils.js'; | ||
export declare function useLoaderDeps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>, TRouteMatch extends MakeRouteMatch<TRouteTree, TFrom> = MakeRouteMatch<TRouteTree, TFrom>, TSelected = Required<TRouteMatch>['loaderDeps']>(opts: StrictOrFrom<TFrom> & { | ||
select?: (match: TRouteMatch) => TSelected; | ||
}): TSelected; |
import { AnyRouter, RegisteredRouter, RouterState } from './router.js'; | ||
export declare function useLocation<TRouter extends AnyRouter = RegisteredRouter, TLocationState = RouterState<TRouter['routeTree']>['location'], TSelected = TLocationState>(opts?: { | ||
select?: (state: TLocationState) => TSelected; | ||
}): TSelected; |
@@ -6,3 +6,2 @@ import { RegisteredRouter } from './router.js'; | ||
import { StrictOrFrom } from './utils.js'; | ||
export type UseMatchOptions<TFrom, TStrict extends boolean, TRouteMatch, TSelected, TThrow extends boolean> = StrictOrFrom<TFrom, TStrict> & { | ||
@@ -9,0 +8,0 @@ select?: (match: TRouteMatch) => TSelected; |
import { FromPathOption, NavigateOptions } from './link.js'; | ||
import { RoutePaths } from './routeInfo.js'; | ||
import { AnyRouter, RegisteredRouter } from './router.js'; | ||
export type UseNavigateResult<TDefaultFrom extends string> = <TTo extends string, TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = TDefaultFrom, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>({ from, ...rest }: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>; | ||
@@ -6,0 +5,0 @@ export declare function useNavigate<TRouter extends AnyRouter = RegisteredRouter, TDefaultFrom extends string = string>(_defaultOpts?: { |
@@ -5,3 +5,2 @@ import { AnyRoute } from './route.js'; | ||
import { StrictOrFrom } from './utils.js'; | ||
export type UseParamsOptions<TFrom, TStrict extends boolean, TParams, TSelected> = StrictOrFrom<TFrom, TStrict> & { | ||
@@ -8,0 +7,0 @@ select?: (params: TParams) => TSelected; |
@@ -5,3 +5,2 @@ import { AnyRoute } from './route.js'; | ||
import { Expand, StrictOrFrom } from './utils.js'; | ||
export type UseRouteContextOptions<TFrom, TStrict extends boolean, TRouteContext, TSelected> = StrictOrFrom<TFrom, TStrict> & { | ||
@@ -8,0 +7,0 @@ select?: (search: TRouteContext) => TSelected; |
import { AnyRouter, RegisteredRouter } from './router.js'; | ||
export declare function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: { | ||
warn?: boolean; | ||
}): TRouter; |
import { AnyRouter, RegisteredRouter, RouterState } from './router.js'; | ||
export declare function useRouterState<TRouter extends AnyRouter = RegisteredRouter, TSelected = RouterState<TRouter['routeTree']>>(opts?: { | ||
@@ -4,0 +3,0 @@ router?: TRouter; |
@@ -5,3 +5,2 @@ import { AnyRoute } from './route.js'; | ||
import { Expand, StrictOrFrom } from './utils.js'; | ||
export type UseSearchOptions<TFrom, TStrict extends boolean, TSearch, TSelected> = StrictOrFrom<TFrom, TStrict> & { | ||
@@ -8,0 +7,0 @@ select?: (search: TSearch) => TSelected; |
{ | ||
"name": "@tanstack/react-router", | ||
"version": "1.51.2", | ||
"version": "1.51.4", | ||
"description": "Modern and scalable routing for React applications", | ||
@@ -62,3 +62,2 @@ "author": "Tanner Linsley", | ||
"combinate": "^1.1.11", | ||
"jsdom": "^24.1.1", | ||
"react": "^18.2.0", | ||
@@ -65,0 +64,0 @@ "react-dom": "^18.2.0", |
@@ -244,2 +244,8 @@ import warning from 'tiny-warning' | ||
const routeGroupPatternRegex = /\(.+\)/g | ||
function removeGroups(s: string) { | ||
return s.replaceAll(routeGroupPatternRegex, '').replaceAll('//', '/') | ||
} | ||
export function createLazyFileRoute< | ||
@@ -249,3 +255,4 @@ TFilePath extends keyof FileRoutesByPath, | ||
>(id: TFilePath) { | ||
return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts }) | ||
return (opts: LazyRouteOptions) => | ||
new LazyRoute<TRoute>({ id: removeGroups(id), ...opts }) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1479576
7
18464