@generouted/react-router
Advanced tools
Comparing version 1.18.4 to 1.18.5
import { | ||
hooks | ||
} from "../chunk-2NVPD6SG.js"; | ||
} from "../chunk-ZCVK7GNN.js"; | ||
import "../chunk-DZAGGWNQ.js"; | ||
@@ -5,0 +5,0 @@ export { |
import * as react_jsx_runtime from 'react/jsx-runtime'; | ||
import { LinkProps, NavigateOptions } from 'react-router-dom'; | ||
import { LinkProps as LinkProps$1, NavigateProps as NavigateProps$1, NavigateOptions as NavigateOptions$1 } from 'react-router-dom'; | ||
type To<Pathname = string> = { | ||
pathname: Pathname; | ||
search?: string; | ||
hash?: string; | ||
}; | ||
type ComponentProps<Path extends string | To, Params extends Record<string, any>> = Path extends keyof Params ? { | ||
to: Path; | ||
params: Params[Path]; | ||
} : Path extends { | ||
pathname: infer Pathname; | ||
} ? Pathname extends keyof Params ? { | ||
to: To<Pathname>; | ||
params: Params[Pathname]; | ||
} : { | ||
to: To<Pathname>; | ||
params?: never; | ||
} : { | ||
to: Path; | ||
params?: never; | ||
}; | ||
type LinkProps<Path extends string | To, Params extends Record<string, any>> = Omit<LinkProps$1, 'to'> & ComponentProps<Path, Params>; | ||
type NavigateProps<Path extends string | To, Params extends Record<string, any>> = Omit<NavigateProps$1, 'to'> & ComponentProps<Path, Params>; | ||
type NavigateOptions<Path extends string | To | number, Params extends Record<string, any>> = Path extends number ? [] : Path extends keyof Params ? [NavigateOptions$1 & { | ||
params: Params[Path]; | ||
}] : Path extends { | ||
pathname: infer Pathname; | ||
} ? Pathname extends keyof Params ? [NavigateOptions$1 & { | ||
params: Params[Pathname]; | ||
}] : [NavigateOptions$1 & { | ||
params?: never; | ||
}] | [] : [NavigateOptions$1 & { | ||
params?: never; | ||
}] | []; | ||
declare const components: <Path extends string, Params extends Record<string, any>>() => { | ||
Link: <P extends Path | { | ||
pathname: Path; | ||
search?: string | undefined; | ||
hash?: string | undefined; | ||
}>({ to, params, ...props }: LinkProps & (P extends keyof Params ? { | ||
to: P; | ||
params: Params[P]; | ||
} : P extends { | ||
pathname: Path; | ||
search?: string | undefined; | ||
hash?: string | undefined; | ||
} ? P["pathname"] extends keyof Params ? { | ||
to: P; | ||
params: Params[P["pathname"]]; | ||
} : { | ||
to: P; | ||
params?: undefined; | ||
} : { | ||
to: P; | ||
params?: undefined; | ||
})) => react_jsx_runtime.JSX.Element; | ||
Navigate: <P_1 extends Path | { | ||
pathname: Path; | ||
search?: string | undefined; | ||
hash?: string | undefined; | ||
}>({ to, params, ...props }: LinkProps & (P_1 extends keyof Params ? { | ||
to: P_1; | ||
params: Params[P_1]; | ||
} : P_1 extends { | ||
pathname: Path; | ||
search?: string | undefined; | ||
hash?: string | undefined; | ||
} ? P_1["pathname"] extends keyof Params ? { | ||
to: P_1; | ||
params: Params[P_1["pathname"]]; | ||
} : { | ||
to: P_1; | ||
params?: undefined; | ||
} : { | ||
to: P_1; | ||
params?: undefined; | ||
})) => react_jsx_runtime.JSX.Element; | ||
Link: <P extends Path | To<Path>>({ to, params, ...props }: LinkProps<P, Params>) => react_jsx_runtime.JSX.Element; | ||
Navigate: <P_1 extends Path | To<Path>>({ to, params, ...props }: LinkProps<P_1, Params>) => react_jsx_runtime.JSX.Element; | ||
}; | ||
@@ -51,22 +45,6 @@ | ||
useParams: <P extends keyof Params>(path: P) => Params[P]; | ||
useNavigate: () => <P_1 extends number | Path | { | ||
pathname: Path; | ||
search?: string | undefined; | ||
hash?: string | undefined; | ||
}>(to: P_1, ...[options]: P_1 extends number ? [] : P_1 extends keyof Params ? [NavigateOptions & { | ||
params: Params[P_1]; | ||
}] : P_1 extends { | ||
pathname: Path; | ||
search?: string | undefined; | ||
hash?: string | undefined; | ||
} ? P_1["pathname"] extends keyof Params ? [NavigateOptions & { | ||
params: Params[P_1["pathname"]]; | ||
}] : [NavigateOptions & { | ||
params?: undefined; | ||
}] : [] | [NavigateOptions & { | ||
params?: undefined; | ||
}]) => void; | ||
useNavigate: () => <P_1 extends number | Path | To<Path>>(to: P_1, ...[options]: NavigateOptions<P_1, Params>) => void; | ||
useModals: () => { | ||
current: any; | ||
open: <P_2 extends Path>(path: ModalPath, options?: (NavigateOptions & (P_2 extends keyof Params ? { | ||
open: <P_2 extends Path>(path: ModalPath, options?: (NavigateOptions$1 & (P_2 extends keyof Params ? { | ||
at?: P_2 | undefined; | ||
@@ -78,3 +56,3 @@ params: Params[P_2]; | ||
})) | undefined) => void; | ||
close: <P_3 extends Path>(options?: (NavigateOptions & (P_3 extends keyof Params ? { | ||
close: <P_3 extends Path>(options?: (NavigateOptions$1 & (P_3 extends keyof Params ? { | ||
at?: P_3 | undefined; | ||
@@ -97,2 +75,2 @@ params: Params[P_3]; | ||
export { components, hooks, utils }; | ||
export { type LinkProps, type NavigateOptions, type NavigateProps, type To, components, hooks, utils }; |
@@ -6,3 +6,4 @@ import { | ||
hooks | ||
} from "../chunk-2NVPD6SG.js"; | ||
} from "../chunk-ZCVK7GNN.js"; | ||
import "../chunk-QQC2DGH5.js"; | ||
import { | ||
@@ -9,0 +10,0 @@ utils |
@@ -14,6 +14,6 @@ declare const patterns: { | ||
} & Record<string, any>; | ||
declare const generatePreservedRoutes: <T>(files: Record<string, any>) => Partial<Record<PreservedKey, T>>; | ||
declare const generatePreservedRoutes: <T>(files: Record<string, T | any>) => Partial<Record<PreservedKey, T>>; | ||
declare const generateRegularRoutes: <T extends BaseRoute, M>(files: Record<string, any>, buildRoute: (module: M, key: string) => T) => T[]; | ||
declare const generateModalRoutes: <T>(files: Record<string, any>) => Record<string, T>; | ||
declare const generateModalRoutes: <T>(files: Record<string, T | any>) => Record<string, T>; | ||
export { generateModalRoutes, generatePreservedRoutes, generateRegularRoutes, patterns }; |
import { | ||
generate | ||
} from "./chunk-CKM5JQLK.js"; | ||
} from "./chunk-NYP6JGQ6.js"; | ||
import "./chunk-LF7YX5LS.js"; | ||
@@ -5,0 +5,0 @@ export { |
import { | ||
generate | ||
} from "./chunk-CKM5JQLK.js"; | ||
} from "./chunk-NYP6JGQ6.js"; | ||
import { | ||
@@ -5,0 +5,0 @@ defaultOptions |
{ | ||
"name": "@generouted/react-router", | ||
"version": "1.18.4", | ||
"version": "1.18.5", | ||
"description": "Generated file-based routes for React Router and Vite", | ||
@@ -85,11 +85,11 @@ "author": "Omar Elhawary <oedotme@gmail.com> (https://omarelhawary.me)", | ||
"fast-glob": "^3.3.2", | ||
"generouted": "^1.18.4" | ||
"generouted": "^1.18.5" | ||
}, | ||
"devDependencies": { | ||
"@generouted/core": "workspace:*", | ||
"@types/react": "^18.2.60", | ||
"react-router-dom": "^6.22.1", | ||
"@types/react": "^18.2.64", | ||
"react-router-dom": "^6.22.3", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.3.3", | ||
"vite": "^5.1.4" | ||
"typescript": "^5.4.2", | ||
"vite": "^5.1.5" | ||
}, | ||
@@ -96,0 +96,0 @@ "peerDependencies": { |
@@ -179,3 +179,3 @@ # Generouted + React Router + Type-safety | ||
- [Plugin](/examples/react-router/plugin) | ||
- [Plugin](/examples/react-router/readme.md) | ||
@@ -182,0 +182,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
33
40551
837
Updatedgenerouted@^1.18.5