router-kit 2.0.0 → 2.1.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/README.md +4 -4
- package/dist/context/RouterProvider.js +434 -142
- package/dist/core/createRouter.js +21 -14
- package/dist/hooks/useLocation.js +34 -11
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -0
- package/dist/ssr/StaticRouter.js +69 -15
- package/dist/ssr/serverUtils.js +60 -14
- package/dist/types/index.d.ts +36 -3
- package/dist/utils/middleware.d.ts +81 -0
- package/dist/utils/middleware.js +141 -0
- package/package.json +3 -7
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Router-Kit
|
|
2
2
|
|
|
3
|
-
A professional React routing library with guards, loaders, and navigation blocking.
|
|
3
|
+
A professional React routing library with guards, loaders, loading components, middlewares, and navigation blocking.
|
|
4
4
|
|
|
5
|
-
**Version:** 2.
|
|
5
|
+
**Version:** 2.1.0 | **License:** MIT
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -80,7 +80,7 @@ function App() {
|
|
|
80
80
|
```tsx
|
|
81
81
|
const authGuard = async () => {
|
|
82
82
|
const isAuth = await checkAuth();
|
|
83
|
-
return isAuth ||
|
|
83
|
+
return isAuth || "/login";
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
const routes = createRouter([
|
|
@@ -134,6 +134,7 @@ const ctx = useOutletContext(); // Outlet context
|
|
|
134
134
|
## 🎭 Outlet (Nested Layouts)
|
|
135
135
|
|
|
136
136
|
```tsx
|
|
137
|
+
import { useState } from "react";
|
|
137
138
|
import { Outlet, useOutletContext } from "router-kit";
|
|
138
139
|
|
|
139
140
|
// Parent layout with Outlet
|
|
@@ -193,7 +194,6 @@ const routes = createRouter([
|
|
|
193
194
|
| ---------------------------------------- | ----------------- |
|
|
194
195
|
| [Documentation](./docs/DOCUMENTATION.md) | Complete guide |
|
|
195
196
|
| [API Reference](./docs/API_REFERENCE.md) | Full API docs |
|
|
196
|
-
| [Examples](./docs/EXAMPLES.md) | Code examples |
|
|
197
197
|
| [Architecture](./docs/ARCHITECTURE.md) | Technical details |
|
|
198
198
|
| [Changelog](./docs/CHANGELOG.md) | Version history |
|
|
199
199
|
|