@tanstack/react-router 1.2.6 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/fileRoute.js.map +1 -1
- package/build/cjs/link.js.map +1 -1
- package/build/cjs/route.js +98 -0
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +98 -0
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +353 -353
- package/build/types/link.d.ts +1 -11
- package/build/types/utils.d.ts +1 -21
- package/build/umd/index.development.js +98 -0
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/fileRoute.ts +0 -1
- package/src/link.tsx +0 -47
- package/src/route.ts +98 -0
- package/src/router.ts +0 -1
- package/src/utils.ts +1 -48
package/build/esm/index.js
CHANGED
|
@@ -878,6 +878,104 @@ const rootRouteId = '__root__';
|
|
|
878
878
|
|
|
879
879
|
// The parse type here allows a zod schema to be passed directly to the validator
|
|
880
880
|
|
|
881
|
+
// TODO: This is part of a future APi to move away from classes and
|
|
882
|
+
// towards a more functional API. It's not ready yet.
|
|
883
|
+
|
|
884
|
+
// type RouteApiInstance<
|
|
885
|
+
// TId extends RouteIds<RegisteredRouter['routeTree']>,
|
|
886
|
+
// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,
|
|
887
|
+
// TFullSearchSchema extends Record<
|
|
888
|
+
// string,
|
|
889
|
+
// any
|
|
890
|
+
// > = TRoute['types']['fullSearchSchema'],
|
|
891
|
+
// TAllParams extends AnyPathParams = TRoute['types']['allParams'],
|
|
892
|
+
// TAllContext extends Record<string, any> = TRoute['types']['allContext'],
|
|
893
|
+
// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],
|
|
894
|
+
// TLoaderData extends any = TRoute['types']['loaderData'],
|
|
895
|
+
// > = {
|
|
896
|
+
// id: TId
|
|
897
|
+
// useMatch: <TSelected = TAllContext>(opts?: {
|
|
898
|
+
// select?: (s: TAllContext) => TSelected
|
|
899
|
+
// }) => TSelected
|
|
900
|
+
|
|
901
|
+
// useRouteContext: <TSelected = TAllContext>(opts?: {
|
|
902
|
+
// select?: (s: TAllContext) => TSelected
|
|
903
|
+
// }) => TSelected
|
|
904
|
+
|
|
905
|
+
// useSearch: <TSelected = TFullSearchSchema>(opts?: {
|
|
906
|
+
// select?: (s: TFullSearchSchema) => TSelected
|
|
907
|
+
// }) => TSelected
|
|
908
|
+
|
|
909
|
+
// useParams: <TSelected = TAllParams>(opts?: {
|
|
910
|
+
// select?: (s: TAllParams) => TSelected
|
|
911
|
+
// }) => TSelected
|
|
912
|
+
|
|
913
|
+
// useLoaderDeps: <TSelected = TLoaderDeps>(opts?: {
|
|
914
|
+
// select?: (s: TLoaderDeps) => TSelected
|
|
915
|
+
// }) => TSelected
|
|
916
|
+
|
|
917
|
+
// useLoaderData: <TSelected = TLoaderData>(opts?: {
|
|
918
|
+
// select?: (s: TLoaderData) => TSelected
|
|
919
|
+
// }) => TSelected
|
|
920
|
+
// }
|
|
921
|
+
|
|
922
|
+
// export function RouteApi_v2<
|
|
923
|
+
// TId extends RouteIds<RegisteredRouter['routeTree']>,
|
|
924
|
+
// TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,
|
|
925
|
+
// TFullSearchSchema extends Record<
|
|
926
|
+
// string,
|
|
927
|
+
// any
|
|
928
|
+
// > = TRoute['types']['fullSearchSchema'],
|
|
929
|
+
// TAllParams extends AnyPathParams = TRoute['types']['allParams'],
|
|
930
|
+
// TAllContext extends Record<string, any> = TRoute['types']['allContext'],
|
|
931
|
+
// TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'],
|
|
932
|
+
// TLoaderData extends any = TRoute['types']['loaderData'],
|
|
933
|
+
// >({
|
|
934
|
+
// id,
|
|
935
|
+
// }: {
|
|
936
|
+
// id: TId
|
|
937
|
+
// }): RouteApiInstance<
|
|
938
|
+
// TId,
|
|
939
|
+
// TRoute,
|
|
940
|
+
// TFullSearchSchema,
|
|
941
|
+
// TAllParams,
|
|
942
|
+
// TAllContext,
|
|
943
|
+
// TLoaderDeps,
|
|
944
|
+
// TLoaderData
|
|
945
|
+
// > {
|
|
946
|
+
// return {
|
|
947
|
+
// id,
|
|
948
|
+
|
|
949
|
+
// useMatch: (opts) => {
|
|
950
|
+
// return useMatch({ ...opts, from: id })
|
|
951
|
+
// },
|
|
952
|
+
|
|
953
|
+
// useRouteContext: (opts) => {
|
|
954
|
+
// return useMatch({
|
|
955
|
+
// ...opts,
|
|
956
|
+
// from: id,
|
|
957
|
+
// select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),
|
|
958
|
+
// } as any)
|
|
959
|
+
// },
|
|
960
|
+
|
|
961
|
+
// useSearch: (opts) => {
|
|
962
|
+
// return useSearch({ ...opts, from: id } as any)
|
|
963
|
+
// },
|
|
964
|
+
|
|
965
|
+
// useParams: (opts) => {
|
|
966
|
+
// return useParams({ ...opts, from: id } as any)
|
|
967
|
+
// },
|
|
968
|
+
|
|
969
|
+
// useLoaderDeps: (opts) => {
|
|
970
|
+
// return useLoaderDeps({ ...opts, from: id } as any) as any
|
|
971
|
+
// },
|
|
972
|
+
|
|
973
|
+
// useLoaderData: (opts) => {
|
|
974
|
+
// return useLoaderData({ ...opts, from: id } as any) as any
|
|
975
|
+
// },
|
|
976
|
+
// }
|
|
977
|
+
// }
|
|
978
|
+
|
|
881
979
|
class RouteApi {
|
|
882
980
|
constructor({
|
|
883
981
|
id
|