router-kit 1.3.4 → 2.0.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.
Files changed (49) hide show
  1. package/README.md +117 -421
  2. package/dist/components/Link.d.ts +23 -6
  3. package/dist/components/Link.js +51 -6
  4. package/dist/components/NavLink.d.ts +44 -7
  5. package/dist/components/NavLink.js +111 -10
  6. package/dist/components/Outlet.d.ts +66 -0
  7. package/dist/components/Outlet.js +69 -0
  8. package/dist/components/Router.d.ts +57 -11
  9. package/dist/components/Router.js +60 -12
  10. package/dist/components/route.d.ts +57 -7
  11. package/dist/components/route.js +35 -5
  12. package/dist/context/OutletContext.d.ts +41 -0
  13. package/dist/context/OutletContext.js +31 -0
  14. package/dist/context/RouterContext.d.ts +9 -0
  15. package/dist/context/RouterContext.js +21 -1
  16. package/dist/context/RouterProvider.d.ts +15 -4
  17. package/dist/context/RouterProvider.js +321 -84
  18. package/dist/core/createRouter.d.ts +65 -0
  19. package/dist/core/createRouter.js +126 -7
  20. package/dist/hooks/useBlocker.d.ts +65 -0
  21. package/dist/hooks/useBlocker.js +152 -0
  22. package/dist/hooks/useDynamicComponents.d.ts +61 -2
  23. package/dist/hooks/useDynamicComponents.js +89 -17
  24. package/dist/hooks/useLoaderData.d.ts +98 -0
  25. package/dist/hooks/useLoaderData.js +107 -0
  26. package/dist/hooks/useLocation.d.ts +37 -0
  27. package/dist/hooks/useLocation.js +106 -1
  28. package/dist/hooks/useMatches.d.ts +99 -0
  29. package/dist/hooks/useMatches.js +114 -0
  30. package/dist/hooks/useNavigate.d.ts +59 -0
  31. package/dist/hooks/useNavigate.js +70 -0
  32. package/dist/hooks/useParams.d.ts +57 -2
  33. package/dist/hooks/useParams.js +60 -14
  34. package/dist/hooks/useQuery.d.ts +53 -3
  35. package/dist/hooks/useQuery.js +107 -8
  36. package/dist/hooks/useRouter.d.ts +34 -0
  37. package/dist/hooks/useRouter.js +35 -1
  38. package/dist/index.d.ts +16 -6
  39. package/dist/index.js +21 -5
  40. package/dist/ssr/StaticRouter.d.ts +65 -0
  41. package/dist/ssr/StaticRouter.js +292 -0
  42. package/dist/ssr/hydrateRouter.d.ts +44 -0
  43. package/dist/ssr/hydrateRouter.js +60 -0
  44. package/dist/ssr/index.d.ts +92 -0
  45. package/dist/ssr/index.js +92 -0
  46. package/dist/ssr/serverUtils.d.ts +107 -0
  47. package/dist/ssr/serverUtils.js +263 -0
  48. package/dist/types/index.d.ts +201 -2
  49. package/package.json +14 -2
package/README.md CHANGED
@@ -1,513 +1,209 @@
1
- # Documentation Index
1
+ # Router-Kit
2
2
 
3
- Complete documentation for Router-Kit v1.3.1
3
+ A professional React routing library with guards, loaders, and navigation blocking.
4
4
 
5
- 🌐 **Website:** [https://routerkit.com/](https://routerkit.com/)
5
+ **Version:** 2.0.0 | **License:** MIT
6
6
 
7
7
  ---
8
8
 
9
- ## 📚 Documentation Structure
9
+ ## Features
10
10
 
11
- This directory contains comprehensive documentation for Router-Kit. Choose the documentation that best fits your needs:
12
-
13
- ### For Users
14
-
15
- - **[Quick Start Guide](#quick-start-guide)** - Get up and running in 5 minutes
16
- - **[Complete Documentation](./DOCUMENTATION.md)** - Full feature guide with examples
17
- - **[API Reference](./API_REFERENCE.md)** - Detailed API documentation
18
- - **[Examples](./EXAMPLES.md)** - Real-world usage examples
19
-
20
- ### For Developers
21
-
22
- - **[Architecture](./ARCHITECTURE.md)** - Internal implementation details
23
- - **[Contributing Guide](#contributing)** - How to contribute to Router-Kit
11
+ - 🛡️ **Route Guards** - Authentication & authorization
12
+ - 📦 **Data Loaders** - Pre-fetch route data
13
+ - 🚫 **Navigation Blocking** - Protect unsaved changes
14
+ - 📜 **Scroll Restoration** - Auto scroll management
15
+ - **Lazy Loading** - Code splitting support
16
+ - 🎯 **TypeScript** - Full type safety
17
+ - 🎭 **Outlet** - Professional nested layouts
18
+ - 🪝 **10 Hooks** - Complete routing control
24
19
 
25
20
  ---
26
21
 
27
- ## Quick Start Guide
28
-
29
- ### Installation
22
+ ## 📦 Installation
30
23
 
31
24
  ```bash
32
25
  npm install router-kit
33
26
  ```
34
27
 
35
- ### Basic Setup
28
+ ---
29
+
30
+ ## 🚀 Quick Start
36
31
 
37
- **Programmatic Approach (Traditional):**
32
+ ### Programmatic Approach
38
33
 
39
34
  ```tsx
40
- import React from "react";
41
- import { createRouter, RouterProvider, Link } from "router-kit";
35
+ import {
36
+ createRouter,
37
+ RouterProvider,
38
+ Link,
39
+ useNavigate,
40
+ useParams,
41
+ } from "router-kit";
42
42
 
43
- // 1. Define your components
44
- const Home = () => <h1>Home Page</h1>;
45
- const About = () => <h1>About Page</h1>;
43
+ const Home = () => <h1>Home</h1>;
44
+ const User = () => {
45
+ const { id } = useParams();
46
+ return <h1>User {id}</h1>;
47
+ };
46
48
 
47
- // 2. Create routes
48
49
  const routes = createRouter([
49
- { path: "/", component: <Home /> },
50
- { path: "about", component: <About /> },
50
+ { path: "/", component: <Home />, meta: { title: "Home" } },
51
+ { path: "users/:id", component: <User /> },
52
+ { path: "/404", component: <h1>Not Found</h1> },
51
53
  ]);
52
54
 
53
- // 3. Wrap your app with RouterProvider
54
55
  function App() {
55
56
  return <RouterProvider routes={routes} />;
56
57
  }
57
-
58
- export default App;
59
58
  ```
60
59
 
61
- **Declarative Approach (New in v1.3.1):**
60
+ ### Declarative Approach
62
61
 
63
62
  ```tsx
64
- import React from "react";
65
63
  import { Router, Route, Link } from "router-kit";
66
64
 
67
- // 1. Define your components
68
- const Home = () => <h1>Home Page</h1>;
69
- const About = () => <h1>About Page</h1>;
70
-
71
- // 2. Use declarative JSX routing
72
65
  function App() {
73
66
  return (
74
67
  <Router>
75
- <Route path="/" element={<Home />} />
76
- <Route path="/about" element={<About />} />
68
+ <Route path="/" component={<Home />} />
69
+ <Route path="/users/:id" component={<User />} />
70
+ <Route path="/404" component={<NotFound />} />
77
71
  </Router>
78
72
  );
79
73
  }
80
-
81
- export default App;
82
74
  ```
83
75
 
84
- > 🆕 **New in v1.3.1**: Declarative routing with `<Router>` and `<Route>` components! Choose the approach that fits your style.
85
-
86
- ### Navigation
87
-
88
- ```tsx
89
- import { Link, NavLink } from "router-kit";
90
-
91
- function Navigation() {
92
- return (
93
- <nav>
94
- <Link to="/">Home</Link>
95
- <NavLink to="/about" activeClassName="active">
96
- About
97
- </NavLink>
98
- </nav>
99
- );
100
- }
101
- ```
76
+ ---
102
77
 
103
- ### Dynamic Routes
78
+ ## 🛡️ Route Guards
104
79
 
105
80
  ```tsx
106
- import { useParams } from "router-kit";
81
+ const authGuard = async () => {
82
+ const isAuth = await checkAuth();
83
+ return isAuth || { redirect: "/login" };
84
+ };
107
85
 
108
- // Route: /users/:id
109
86
  const routes = createRouter([
110
- { path: "users/:id", component: <UserProfile /> },
87
+ {
88
+ path: "dashboard",
89
+ component: <Dashboard />,
90
+ guard: authGuard,
91
+ },
111
92
  ]);
112
-
113
- function UserProfile() {
114
- const { id } = useParams();
115
- return <h1>User {id}</h1>;
116
- }
117
- ```
118
-
119
- ### Programmatic Navigation
120
-
121
- ```tsx
122
- import { useRouter } from "router-kit";
123
-
124
- function LoginForm() {
125
- const { navigate } = useRouter();
126
-
127
- const handleLogin = () => {
128
- // After successful login
129
- navigate("/dashboard");
130
- };
131
-
132
- return <button onClick={handleLogin}>Login</button>;
133
- }
134
93
  ```
135
94
 
136
95
  ---
137
96
 
138
- ## Documentation Files
139
-
140
- ### [DOCUMENTATION.md](./DOCUMENTATION.md)
141
-
142
- **Complete user guide covering:**
143
-
144
- - Introduction and key features
145
- - Installation instructions
146
- - Core concepts explained
147
- - API reference with examples
148
- - Advanced usage patterns
149
- - Error handling strategies
150
- - TypeScript support
151
- - Best practices
152
- - Migration guide from other routers
153
- - Real-world examples
154
-
155
- **Best for:** Learning Router-Kit from scratch, understanding concepts, and finding usage examples.
156
-
157
- ### [API_REFERENCE.md](./API_REFERENCE.md)
158
-
159
- **Comprehensive API documentation including:**
160
-
161
- - `createRouter()` function
162
- - `RouterProvider` component
163
- - `Link` and `NavLink` components
164
- - `useRouter()` hook
165
- - `useParams()` hook
166
- - `useQuery()` hook
167
- - `useLocation()` hook
168
- - `useDynamicComponents()` hook
169
- - Type definitions
170
- - Error system reference
171
-
172
- **Best for:** Looking up specific APIs, understanding function signatures, and exploring available options.
173
-
174
- ### [EXAMPLES.md](./EXAMPLES.md)
175
-
176
- **Practical examples featuring:**
177
-
178
- - Basic routing examples
179
- - E-commerce application
180
- - Blog platform
181
- - Dashboard application
182
- - Multi-language website
183
- - Authentication flow
184
- - Advanced patterns (lazy loading, modals, breadcrumbs, animations)
185
-
186
- **Best for:** Finding real-world implementation patterns and copy-paste solutions.
187
-
188
- ### [ARCHITECTURE.md](./ARCHITECTURE.md)
189
-
190
- **Technical implementation details including:**
191
-
192
- - System architecture overview
193
- - Core component implementations
194
- - Route matching algorithm
195
- - History management
196
- - Context system
197
- - Error handling system
198
- - Type system
199
- - Performance considerations
200
- - Build and distribution
201
-
202
- **Best for:** Understanding internals, contributing to the project, or debugging complex issues.
203
-
204
- ---
205
-
206
- ## Common Use Cases
207
-
208
- ### Simple Website
97
+ ## 📦 Data Loaders
209
98
 
210
99
  ```tsx
211
100
  const routes = createRouter([
212
- { path: "/", component: <Home /> },
213
- { path: "about", component: <About /> },
214
- { path: "contact", component: <Contact /> },
215
- { path: "/404", component: <NotFound /> },
101
+ {
102
+ path: "users/:id",
103
+ component: <UserProfile />,
104
+ loader: async ({ params }) => {
105
+ return fetch(`/api/users/${params.id}`).then((r) => r.json());
106
+ },
107
+ },
216
108
  ]);
109
+
110
+ function UserProfile() {
111
+ const user = useLoaderData();
112
+ return <h1>{user.name}</h1>;
113
+ }
217
114
  ```
218
115
 
219
- 📖 **See:** [Basic Examples in EXAMPLES.md](./EXAMPLES.md#basic-examples)
116
+ ---
220
117
 
221
- ### Blog or CMS
118
+ ## 🪝 Hooks
222
119
 
223
120
  ```tsx
224
- const routes = createRouter([
225
- { path: "/", component: <BlogHome /> },
226
- { path: "posts/:category/:slug", component: <BlogPost /> },
227
- { path: "author/:username", component: <AuthorProfile /> },
228
- ]);
121
+ const navigate = useNavigate(); // Navigation
122
+ const { id } = useParams(); // Route params
123
+ const { page } = useQuery(); // Query params
124
+ const location = useLocation(); // Location object
125
+ const matches = useMatches(); // Route matches
126
+ const data = useLoaderData(); // Loader data
127
+ const blocker = useBlocker(isDirty); // Block navigation
128
+ const outlet = useOutlet(); // Child route element
129
+ const ctx = useOutletContext(); // Outlet context
229
130
  ```
230
131
 
231
- 📖 **See:** [Blog Platform in EXAMPLES.md](./EXAMPLES.md#blog-platform)
132
+ ---
232
133
 
233
- ### Dashboard Application
134
+ ## 🎭 Outlet (Nested Layouts)
234
135
 
235
136
  ```tsx
236
- const routes = createRouter([
237
- { path: "dashboard/:view", component: <Dashboard /> },
238
- ]);
137
+ import { Outlet, useOutletContext } from "router-kit";
239
138
 
240
- function Dashboard() {
241
- const views = {
242
- overview: <OverviewView />,
243
- analytics: <AnalyticsView />,
244
- settings: <SettingsView />,
245
- };
139
+ // Parent layout with Outlet
140
+ function DashboardLayout() {
141
+ const [user] = useState({ name: "John" });
246
142
 
247
- return useDynamicComponents(views, "view");
143
+ return (
144
+ <div className="dashboard">
145
+ <Sidebar />
146
+ <main>
147
+ <Outlet context={{ user, theme: "dark" }} />
148
+ </main>
149
+ </div>
150
+ );
248
151
  }
249
- ```
250
-
251
- 📖 **See:** [Dashboard Application in EXAMPLES.md](./EXAMPLES.md#dashboard-application)
252
152
 
253
- ### E-commerce Site
254
-
255
- ```tsx
256
- const routes = createRouter([
257
- { path: "/", component: <HomePage /> },
258
- { path: "products", component: <ProductList /> },
259
- { path: "products/:id", component: <ProductDetail /> },
260
- { path: "cart", component: <Cart /> },
261
- { path: "checkout", component: <Checkout /> },
262
- ]);
153
+ // Child route accesses context
154
+ function Settings() {
155
+ const { user, theme } = useOutletContext<{ user: User; theme: string }>();
156
+ return <div className={theme}>Settings for {user.name}</div>;
157
+ }
263
158
  ```
264
159
 
265
- 📖 **See:** [E-commerce Application in EXAMPLES.md](./EXAMPLES.md#e-commerce-application)
266
-
267
- ### Protected Routes
160
+ ### Programmatic Config
268
161
 
269
162
  ```tsx
270
163
  const routes = createRouter([
271
- { path: "/", component: <PublicHome /> },
272
164
  {
273
165
  path: "dashboard",
274
- component: (
275
- <ProtectedRoute>
276
- <Dashboard />
277
- </ProtectedRoute>
278
- ),
166
+ component: <DashboardLayout />,
167
+ children: [
168
+ { index: true, component: <Overview /> },
169
+ { path: "settings", component: <Settings /> },
170
+ { path: "profile", component: <Profile /> },
171
+ ],
279
172
  },
280
173
  ]);
281
174
  ```
282
175
 
283
- 📖 **See:** [Authentication Flow in EXAMPLES.md](./EXAMPLES.md#authentication-flow)
284
-
285
- ---
286
-
287
- ## Feature Matrix
288
-
289
- | Feature | Status | Documentation |
290
- | ----------------------- | ---------- | ------------------------------------------------ |
291
- | Static Routes | ✅ | [Docs](./DOCUMENTATION.md#routes) |
292
- | Dynamic Routes | ✅ | [Docs](./DOCUMENTATION.md#useparams) |
293
- | Nested Routes | ✅ | [Docs](./DOCUMENTATION.md#nested-routes) |
294
- | Multiple Path Aliases | ✅ | [Docs](./DOCUMENTATION.md#multiple-path-aliases) |
295
- | Query Parameters | ✅ | [Docs](./DOCUMENTATION.md#usequery) |
296
- | Navigation State | ✅ | [Docs](./DOCUMENTATION.md#navigation-state) |
297
- | Custom 404 Pages | ✅ | [Docs](./DOCUMENTATION.md#custom-404-pages) |
298
- | TypeScript Support | ✅ | [Docs](./DOCUMENTATION.md#typescript-support) |
299
- | Error Handling | ✅ | [Docs](./DOCUMENTATION.md#error-handling) |
300
- | Dynamic Components | ✅ | [Docs](./API_REFERENCE.md#usedynamiccomponents) |
301
- | **Declarative Routing** | ✅ **NEW** | [Docs](./DECLARATIVE_ROUTING.md) |
302
- | Hash Routing | ⏳ | Planned |
303
- | Regex Routes | ⏳ | Planned |
304
-
305
- ---
306
-
307
- ## Quick Reference
308
-
309
- ### Imports
310
-
311
- ```tsx
312
- // Core
313
- import { createRouter, RouterProvider, Router, Route } from "router-kit";
314
-
315
- // Components
316
- import { Link, NavLink } from "router-kit";
317
-
318
- // Hooks
319
- import {
320
- useRouter,
321
- useParams,
322
- useQuery,
323
- useLocation,
324
- useDynamicComponents,
325
- } from "router-kit";
326
-
327
- // Types
328
- import type {
329
- Route,
330
- RouterContextType,
331
- NavigateOptions,
332
- Location,
333
- RouterKitError,
334
- } from "router-kit";
335
-
336
- // Error System
337
- import { RouterErrorCode, RouterErrors, createRouterError } from "router-kit";
338
- ```
339
-
340
- ### Route Patterns
341
-
342
- **Programmatic Approach:**
343
-
344
- ```tsx
345
- // Static route
346
- { path: "about", component: <About /> }
347
-
348
- // Dynamic parameter
349
- { path: "users/:id", component: <UserProfile /> }
350
-
351
- // Multiple parameters
352
- { path: "posts/:category/:slug", component: <BlogPost /> }
353
-
354
- // Multiple paths
355
- { path: ["about", "about-us"], component: <About /> }
356
-
357
- // Nested routes
358
- {
359
- path: "dashboard",
360
- component: <Dashboard />,
361
- children: [
362
- { path: "settings", component: <Settings /> }
363
- ]
364
- }
365
-
366
- // 404 page
367
- { path: "/404", component: <NotFound /> }
368
- ```
369
-
370
- **Declarative Approach:**
371
-
372
- ```tsx
373
- // Static route
374
- <Route path="/about" element={<About />} />
375
-
376
- // Dynamic parameter
377
- <Route path="/users/:id" element={<UserProfile />} />
378
-
379
- // Multiple parameters
380
- <Route path="/posts/:category/:slug" element={<BlogPost />} />
381
-
382
- // Multiple paths
383
- <Route path={["/about", "/about-us"]} element={<About />} />
384
-
385
- // Nested routes
386
- <Route path="/dashboard" element={<Dashboard />}>
387
- <Route path="settings" element={<Settings />} />
388
- </Route>
389
-
390
- // 404 page
391
- <Route path="/404" element={<NotFound />} />
392
- ```
393
-
394
- ### Hook Usage
176
+ ### Declarative Config
395
177
 
396
178
  ```tsx
397
- // Get router context
398
- const { path, navigate } = useRouter();
399
-
400
- // Get route parameters
401
- const { id, slug } = useParams();
402
-
403
- // Get query parameters
404
- const { search, page } = useQuery();
405
-
406
- // Get location details
407
- const { pathname, search, hash, state } = useLocation();
408
-
409
- // Dynamic components
410
- const component = useDynamicComponents(viewsObject, "paramName");
179
+ <Router>
180
+ <Route path="dashboard" component={<DashboardLayout />}>
181
+ <Route index component={<Overview />} />
182
+ <Route path="settings" component={<Settings />} />
183
+ <Route path="profile" component={<Profile />} />
184
+ </Route>
185
+ </Router>
411
186
  ```
412
187
 
413
188
  ---
414
189
 
415
- ## Version Information
416
-
417
- - **Current Version:** 1.3.1
418
- - **React Version:** >=16 <20
419
- - **TypeScript:** >=5.2.0
420
- - **License:** MIT
421
-
422
- ---
423
-
424
- ## Support & Community
425
-
426
- - **Website:** [routerkit.com](https://routerkit.com/)
427
- - **GitHub Repository:** [github.com/Mohammed-Ben-Cheikh/router-kit](https://github.com/Mohammed-Ben-Cheikh/router-kit)
428
- - **Issues:** [Report bugs or request features](https://github.com/Mohammed-Ben-Cheikh/router-kit/issues)
429
- - **Author:** Mohammed Ben Cheikh
430
- - **Email:** mohammed.bencheikh.dev@gmail.com
431
- - **Website:** [mohammedbencheikh.com](https://mohammedbencheikh.com/)
432
-
433
- ---
434
-
435
- ## Contributing
436
-
437
- We welcome contributions! Here's how to get started:
438
-
439
- 1. **Fork the repository**
440
- 2. **Create a feature branch:** `git checkout -b feature/amazing-feature`
441
- 3. **Make your changes**
442
- 4. **Run tests and type checks:** `npm run typecheck`
443
- 5. **Commit your changes:** `git commit -m 'Add amazing feature'`
444
- 6. **Push to your fork:** `git push origin feature/amazing-feature`
445
- 7. **Open a Pull Request**
446
-
447
- **See:** [ARCHITECTURE.md](./ARCHITECTURE.md) for implementation details.
448
-
449
- ---
450
-
451
- ## Changelog
452
-
453
- ### v1.3.1 (Current)
454
-
455
- - Full TypeScript support with comprehensive types
456
- - Enhanced error handling system with detailed context
457
- - New `useDynamicComponents` hook
458
- - New `useLocation` hook with state support
459
- - Improved type exports
460
- - Better error messages
461
-
462
- ### Previous Versions
463
-
464
- See [GitHub Releases](https://github.com/Mohammed-Ben-Cheikh/router-kit/releases) for full changelog.
465
-
466
- ---
467
-
468
- ## FAQ
469
-
470
- ### How does Router-Kit compare to React Router?
471
-
472
- Router-Kit is simpler and lighter. It's perfect for small to medium projects that don't need the full complexity of React Router.
473
-
474
- 📖 **See:** [Migration Guide in DOCUMENTATION.md](./DOCUMENTATION.md#migration-guide)
475
-
476
- ### Can I use Router-Kit with TypeScript?
477
-
478
- Yes! Router-Kit is written in TypeScript and provides full type definitions.
190
+ ## 📚 Documentation
479
191
 
480
- 📖 **See:** [TypeScript Support in DOCUMENTATION.md](./DOCUMENTATION.md#typescript-support)
481
-
482
- ### How do I handle authentication?
483
-
484
- Use the ProtectedRoute pattern with useRouter and useLocation hooks.
485
-
486
- 📖 **See:** [Authentication Flow in EXAMPLES.md](./EXAMPLES.md#authentication-flow)
487
-
488
- ### How do I create nested routes?
489
-
490
- Use the `children` property in route configuration.
491
-
492
- 📖 **See:** [Nested Routes in DOCUMENTATION.md](./DOCUMENTATION.md#nested-routes)
493
-
494
- ### What about 404 pages?
495
-
496
- Add a route with `path: "/404"` and Router-Kit will use it automatically.
497
-
498
- 📖 **See:** [Custom 404 Pages in DOCUMENTATION.md](./DOCUMENTATION.md#custom-404-pages)
192
+ | Document | Description |
193
+ | ---------------------------------------- | ----------------- |
194
+ | [Documentation](./docs/DOCUMENTATION.md) | Complete guide |
195
+ | [API Reference](./docs/API_REFERENCE.md) | Full API docs |
196
+ | [Examples](./docs/EXAMPLES.md) | Code examples |
197
+ | [Architecture](./docs/ARCHITECTURE.md) | Technical details |
198
+ | [Changelog](./docs/CHANGELOG.md) | Version history |
499
199
 
500
200
  ---
501
201
 
502
- ## Learn More
503
-
504
- Ready to dive deeper? Start with the [Complete Documentation](./DOCUMENTATION.md) or explore specific topics:
202
+ ## 🔗 Links
505
203
 
506
- - New to Router-Kit? → [DOCUMENTATION.md](./DOCUMENTATION.md)
507
- - Need API details? → [API_REFERENCE.md](./API_REFERENCE.md)
508
- - Want examples? → [EXAMPLES.md](./EXAMPLES.md)
509
- - Curious about internals? → [ARCHITECTURE.md](./ARCHITECTURE.md)
204
+ - **GitHub:** [github.com/Mohammed-Ben-Cheikh/router-kit](https://github.com/Mohammed-Ben-Cheikh/router-kit)
205
+ - **Author:** [Mohammed Ben Cheikh](https://mohammedbencheikh.com/)
510
206
 
511
207
  ---
512
208
 
513
- **Happy Routing! 🚀**
209
+ Made with ❤️ by Mohammed Ben Cheikh
@@ -1,7 +1,24 @@
1
- import type { ReactNode } from "react";
2
- declare function Link({ to, children, className, }: {
3
- to: string;
4
- children: ReactNode;
5
- className?: string;
6
- }): import("react/jsx-runtime").JSX.Element;
1
+ import type { LinkProps } from "../types";
2
+ /**
3
+ * Link component for client-side navigation
4
+ *
5
+ * Provides seamless navigation without full page reloads.
6
+ * Supports all standard anchor attributes and navigation options.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * // Basic usage
11
+ * <Link to="/about">About Us</Link>
12
+ *
13
+ * // With state
14
+ * <Link to="/profile" state={{ from: 'dashboard' }}>Profile</Link>
15
+ *
16
+ * // Replace history entry
17
+ * <Link to="/login" replace>Login</Link>
18
+ *
19
+ * // External link (opens normally)
20
+ * <Link to="https://example.com" target="_blank">External</Link>
21
+ * ```
22
+ */
23
+ declare const Link: import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
7
24
  export default Link;