reroute-js 0.6.0 → 0.7.1

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 (114) hide show
  1. package/README.md +1 -0
  2. package/_/basic/package.json +4 -4
  3. package/_/basic/src/client/index.html +1 -1
  4. package/_/basic/src/index.ts +1 -3
  5. package/_/blog/package.json +4 -4
  6. package/_/blog/src/client/App.tsx +1 -0
  7. package/_/blog/src/client/index.html +1 -1
  8. package/_/blog/src/client/routes/blog/content/1-hello-world.tsx +1 -1
  9. package/_/blog/src/client/routes/blog/content/3-markdown-with-syntax-highlighting.mdx +213 -0
  10. package/_/blog/src/client/routes/blog/content/4-content-in-markdown.md +143 -0
  11. package/_/blog/src/client/routes/blog/content/5-mdx-with-components.mdx +267 -0
  12. package/_/blog/src/client/routes/blog/index.tsx +59 -0
  13. package/_/blog/src/client/routes/client.tsx +564 -0
  14. package/_/blog/src/client/routes/docs.tsx +670 -0
  15. package/_/blog/src/client/routes/index.tsx +37 -0
  16. package/_/blog/src/client/routes/markdown-demo.md +169 -0
  17. package/_/blog/src/client/routes/markdown.tsx +160 -0
  18. package/_/blog/src/index.ts +5 -2
  19. package/_/store/package.json +4 -4
  20. package/_/store/src/client/index.html +1 -1
  21. package/_/store/src/index.ts +1 -1
  22. package/cli/bin.d.ts +1 -1
  23. package/cli/bin.js +806 -14
  24. package/cli/bin.js.map +11 -7
  25. package/cli/index.d.ts +1 -1
  26. package/cli/index.js +52 -3
  27. package/cli/index.js.map +4 -3
  28. package/cli/src/cli.d.ts +1 -1
  29. package/cli/src/commands/boot.d.ts +1 -1
  30. package/cli/src/commands/build.d.ts +19 -0
  31. package/cli/src/commands/build.d.ts.map +1 -0
  32. package/cli/src/commands/dev.d.ts +18 -0
  33. package/cli/src/commands/dev.d.ts.map +1 -0
  34. package/cli/src/commands/gen.d.ts +1 -1
  35. package/cli/src/commands/init.d.ts +1 -1
  36. package/cli/src/commands/start.d.ts +19 -0
  37. package/cli/src/commands/start.d.ts.map +1 -0
  38. package/cli/src/libs/index.d.ts +2 -1
  39. package/cli/src/libs/index.d.ts.map +1 -1
  40. package/cli/src/libs/log.d.ts +46 -0
  41. package/cli/src/libs/log.d.ts.map +1 -0
  42. package/cli/src/libs/markdown-processor.d.ts +1 -1
  43. package/cli/src/libs/markdown.d.ts +1 -1
  44. package/cli/src/libs/tailwind.d.ts +1 -1
  45. package/cli/src/libs/version.d.ts +1 -1
  46. package/core/index.d.ts +1 -1
  47. package/core/index.js +5 -5
  48. package/core/index.js.map +3 -3
  49. package/core/src/bundler/hash.d.ts +1 -1
  50. package/core/src/bundler/index.d.ts +1 -1
  51. package/core/src/bundler/transpile.d.ts +1 -1
  52. package/core/src/content/discovery.d.ts +1 -1
  53. package/core/src/content/index.d.ts +1 -1
  54. package/core/src/content/metadata.d.ts +1 -1
  55. package/core/src/content/registry.d.ts +1 -1
  56. package/core/src/index.d.ts +1 -1
  57. package/core/src/ssr/data.d.ts +1 -1
  58. package/core/src/ssr/index.d.ts +1 -1
  59. package/core/src/ssr/modules.d.ts +1 -1
  60. package/core/src/ssr/render.d.ts +1 -1
  61. package/core/src/ssr/seed.d.ts +1 -1
  62. package/core/src/template/html.d.ts +1 -1
  63. package/core/src/template/index.d.ts +1 -1
  64. package/core/src/types.d.ts +1 -1
  65. package/core/src/utils/cache.d.ts +1 -1
  66. package/core/src/utils/compression.d.ts +1 -1
  67. package/core/src/utils/index.d.ts +1 -1
  68. package/core/src/utils/mime.d.ts +1 -1
  69. package/core/src/utils/path.d.ts +1 -1
  70. package/elysia/index.d.ts +1 -1
  71. package/elysia/index.js +5 -5
  72. package/elysia/index.js.map +3 -3
  73. package/elysia/src/index.d.ts +1 -1
  74. package/elysia/src/libs/http.d.ts +1 -1
  75. package/elysia/src/libs/image.d.ts +1 -1
  76. package/elysia/src/plugin.d.ts +1 -1
  77. package/elysia/src/routes/artifacts.d.ts +1 -1
  78. package/elysia/src/routes/content.d.ts +1 -1
  79. package/elysia/src/routes/dev.d.ts +1 -1
  80. package/elysia/src/routes/image.d.ts +1 -1
  81. package/elysia/src/routes/ssr.d.ts +1 -1
  82. package/elysia/src/routes/static.d.ts +1 -1
  83. package/elysia/src/types.d.ts +1 -1
  84. package/package.json +6 -1
  85. package/react/index.d.ts +1 -1
  86. package/react/index.js +70 -23
  87. package/react/index.js.map +3 -3
  88. package/react/src/components/ClientOnly.d.ts +1 -1
  89. package/react/src/components/ContentRoute.d.ts +1 -1
  90. package/react/src/components/Image.d.ts +1 -1
  91. package/react/src/components/Link.d.ts +1 -1
  92. package/react/src/components/Markdown.d.ts +1 -1
  93. package/react/src/components/Outlet.d.ts +1 -1
  94. package/react/src/components/index.d.ts +1 -1
  95. package/react/src/hooks/index.d.ts +1 -1
  96. package/react/src/hooks/useContent.d.ts +1 -1
  97. package/react/src/hooks/useData.d.ts +1 -1
  98. package/react/src/hooks/useNavigate.d.ts +1 -1
  99. package/react/src/hooks/useParams.d.ts +1 -1
  100. package/react/src/hooks/useRouter.d.ts +1 -1
  101. package/react/src/hooks/useSearchParams.d.ts +1 -1
  102. package/react/src/index.d.ts +1 -1
  103. package/react/src/providers/ContentProvider.d.ts +1 -1
  104. package/react/src/providers/RerouteProvider.d.ts +1 -1
  105. package/react/src/providers/RouterProvider.d.ts +1 -1
  106. package/react/src/providers/RouterProvider.d.ts.map +1 -1
  107. package/react/src/providers/index.d.ts +1 -1
  108. package/react/src/types/any.d.ts +1 -1
  109. package/react/src/types/index.d.ts +1 -1
  110. package/react/src/types/router.d.ts +1 -1
  111. package/react/src/utils/content.d.ts +1 -1
  112. package/react/src/utils/head.d.ts +1 -1
  113. package/react/src/utils/index.d.ts +1 -1
  114. package/_/blog/src/client/components/Counter.tsx +0 -14
@@ -0,0 +1,670 @@
1
+ import { Link } from 'reroute-js/react';
2
+
3
+ const meta = {
4
+ title: 'Documentation - Fragment Navigation Demo',
5
+ description: 'Testing the new fragment prop for automatic scrolling',
6
+ };
7
+
8
+ export default function DocsPage() {
9
+ return (
10
+ <div style={{ minHeight: '100vh', background: '#f9f9f9' }}>
11
+ {/* Header */}
12
+ <header
13
+ style={{
14
+ background: '#fff',
15
+ borderBottom: '1px solid #e0e0e0',
16
+ padding: '1rem 2rem',
17
+ position: 'sticky',
18
+ top: 0,
19
+ zIndex: 100,
20
+ boxShadow: '0 2px 4px rgba(0,0,0,0.05)',
21
+ }}
22
+ >
23
+ <div style={{ maxWidth: '1200px', margin: '0 auto' }}>
24
+ <Link
25
+ to='/'
26
+ style={{
27
+ fontSize: '1.5rem',
28
+ fontWeight: 'bold',
29
+ color: '#333',
30
+ textDecoration: 'none',
31
+ }}
32
+ >
33
+ ← Back to Home
34
+ </Link>
35
+ </div>
36
+ </header>
37
+
38
+ {/* Main Content */}
39
+ <main style={{ maxWidth: '1200px', margin: '0 auto', padding: '2rem' }}>
40
+ <h1 style={{ fontSize: '2.5rem', marginBottom: '1rem' }}>
41
+ 📚 Documentation
42
+ </h1>
43
+ <p style={{ fontSize: '1.1rem', color: '#666', marginBottom: '3rem' }}>
44
+ This page demonstrates the new <code>fragment</code> prop for the Link
45
+ component. Click any section in the table of contents below to
46
+ automatically scroll to that section with smooth scrolling behavior.
47
+ </p>
48
+
49
+ {/* Table of Contents with Fragment Navigation */}
50
+ <div
51
+ style={{
52
+ background: '#fff',
53
+ border: '1px solid #e0e0e0',
54
+ borderRadius: '8px',
55
+ padding: '2rem',
56
+ marginBottom: '3rem',
57
+ }}
58
+ >
59
+ <h2 style={{ marginTop: 0, marginBottom: '1rem' }}>
60
+ 📑 Table of Contents
61
+ </h2>
62
+ <nav>
63
+ <ul style={{ listStyle: 'none', padding: 0 }}>
64
+ <li style={{ marginBottom: '0.75rem' }}>
65
+ <Link
66
+ to='/docs'
67
+ fragment='getting-started'
68
+ style={{
69
+ color: '#0066cc',
70
+ textDecoration: 'none',
71
+ fontSize: '1.1rem',
72
+ }}
73
+ >
74
+ → Getting Started
75
+ </Link>
76
+ </li>
77
+ <li style={{ marginBottom: '0.75rem' }}>
78
+ <Link
79
+ to='/docs'
80
+ fragment='installation'
81
+ style={{
82
+ color: '#0066cc',
83
+ textDecoration: 'none',
84
+ fontSize: '1.1rem',
85
+ }}
86
+ >
87
+ → Installation
88
+ </Link>
89
+ </li>
90
+ <li style={{ marginBottom: '0.75rem' }}>
91
+ <Link
92
+ to='/docs'
93
+ fragment='usage'
94
+ style={{
95
+ color: '#0066cc',
96
+ textDecoration: 'none',
97
+ fontSize: '1.1rem',
98
+ }}
99
+ >
100
+ → Usage
101
+ </Link>
102
+ </li>
103
+ <li style={{ marginBottom: '0.75rem' }}>
104
+ <Link
105
+ to='/docs'
106
+ fragment='api-reference'
107
+ style={{
108
+ color: '#0066cc',
109
+ textDecoration: 'none',
110
+ fontSize: '1.1rem',
111
+ }}
112
+ >
113
+ → API Reference
114
+ </Link>
115
+ </li>
116
+ <li style={{ marginBottom: '0.75rem' }}>
117
+ <Link
118
+ to='/docs'
119
+ fragment='examples'
120
+ style={{
121
+ color: '#0066cc',
122
+ textDecoration: 'none',
123
+ fontSize: '1.1rem',
124
+ }}
125
+ >
126
+ → Examples
127
+ </Link>
128
+ </li>
129
+ <li style={{ marginBottom: '0.75rem' }}>
130
+ <Link
131
+ to='/docs'
132
+ fragment='faq'
133
+ style={{
134
+ color: '#0066cc',
135
+ textDecoration: 'none',
136
+ fontSize: '1.1rem',
137
+ }}
138
+ >
139
+ → FAQ
140
+ </Link>
141
+ </li>
142
+ </ul>
143
+ </nav>
144
+ <div
145
+ style={{
146
+ marginTop: '1.5rem',
147
+ padding: '1rem',
148
+ background: '#fff3cd',
149
+ border: '1px solid #ffc107',
150
+ borderRadius: '4px',
151
+ }}
152
+ >
153
+ <strong>💡 Test Cross-Page Navigation:</strong> Go to the{' '}
154
+ <Link to='/blog' style={{ color: '#0066cc' }}>
155
+ Blog page
156
+ </Link>{' '}
157
+ and click the fragment navigation buttons there to test navigating
158
+ from a different route!
159
+ </div>
160
+ </div>
161
+
162
+ {/* Sections */}
163
+ <Section
164
+ id='getting-started'
165
+ title='🚀 Getting Started'
166
+ content={
167
+ <>
168
+ <p>
169
+ Welcome to the documentation! This section will help you get
170
+ started with using fragment navigation in your Reroute
171
+ application.
172
+ </p>
173
+ <p>
174
+ Fragment navigation allows you to link directly to specific
175
+ sections of a page using the <code>fragment</code> prop on the
176
+ Link component. When the user clicks the link, the page will
177
+ automatically scroll to the target section with smooth scrolling
178
+ behavior.
179
+ </p>
180
+ <p>
181
+ <strong>Key Features:</strong>
182
+ </p>
183
+ <ul>
184
+ <li>✨ Smooth scrolling animation</li>
185
+ <li>🔄 Works with same-page and cross-page navigation</li>
186
+ <li>🎯 Automatic retry for slow-rendering components</li>
187
+ <li>📱 Respects scroll margin for sticky headers</li>
188
+ <li>♿ Accessible (hash in URL)</li>
189
+ </ul>
190
+ <code
191
+ style={{
192
+ display: 'block',
193
+ background: '#f5f5f5',
194
+ padding: '1rem',
195
+ borderRadius: '4px',
196
+ marginTop: '1rem',
197
+ }}
198
+ >
199
+ {`<Link to="/docs" fragment="getting-started">
200
+ Jump to Getting Started
201
+ </Link>`}
202
+ </code>
203
+ </>
204
+ }
205
+ />
206
+
207
+ <Section
208
+ id='installation'
209
+ title='📦 Installation'
210
+ content={
211
+ <>
212
+ <p>
213
+ To use fragment navigation, simply upgrade to the latest version
214
+ of reroute-js that includes the fragment prop feature.
215
+ </p>
216
+ <code
217
+ style={{
218
+ display: 'block',
219
+ background: '#f5f5f5',
220
+ padding: '1rem',
221
+ borderRadius: '4px',
222
+ marginTop: '1rem',
223
+ }}
224
+ >
225
+ bun add reroute-js@latest
226
+ </code>
227
+ <p style={{ marginTop: '1rem' }}>
228
+ No additional setup is required. The fragment functionality is
229
+ built into the Link component and works out of the box.
230
+ </p>
231
+ <p>
232
+ <strong>Requirements:</strong>
233
+ </p>
234
+ <ul>
235
+ <li>React 18+</li>
236
+ <li>Bun or Node.js</li>
237
+ <li>Modern browser with smooth scrolling support</li>
238
+ </ul>
239
+ </>
240
+ }
241
+ />
242
+
243
+ <Section
244
+ id='usage'
245
+ title='💡 Usage'
246
+ content={
247
+ <>
248
+ <p>
249
+ Using fragment navigation is simple. Just add the{' '}
250
+ <code>fragment</code> prop to any Link component:
251
+ </p>
252
+ <code
253
+ style={{
254
+ display: 'block',
255
+ background: '#f5f5f5',
256
+ padding: '1rem',
257
+ borderRadius: '4px',
258
+ marginTop: '1rem',
259
+ whiteSpace: 'pre',
260
+ overflow: 'auto',
261
+ }}
262
+ >
263
+ {`// Navigate to a section on the same page
264
+ <Link to="/docs" fragment="usage">
265
+ View Usage
266
+ </Link>
267
+
268
+ // Navigate to a different page and scroll to a section
269
+ <Link to="/about" fragment="team">
270
+ Meet Our Team
271
+ </Link>
272
+
273
+ // Combine with other Link props
274
+ <Link
275
+ to="/docs"
276
+ fragment="api-reference"
277
+ prefetch={false}
278
+ replace
279
+ >
280
+ API Reference
281
+ </Link>`}
282
+ </code>
283
+ <p style={{ marginTop: '1rem' }}>
284
+ <strong>Important:</strong> Make sure your target sections have
285
+ an <code>id</code> attribute that matches the fragment value:
286
+ </p>
287
+ <code
288
+ style={{
289
+ display: 'block',
290
+ background: '#f5f5f5',
291
+ padding: '1rem',
292
+ borderRadius: '4px',
293
+ marginTop: '0.5rem',
294
+ }}
295
+ >
296
+ {`<section id="usage">
297
+ {/* Your content here */}
298
+ </section>`}
299
+ </code>
300
+ </>
301
+ }
302
+ />
303
+
304
+ <Section
305
+ id='api-reference'
306
+ title='📖 API Reference'
307
+ content={
308
+ <>
309
+ <h3>Link Component Props</h3>
310
+ <table
311
+ style={{
312
+ width: '100%',
313
+ borderCollapse: 'collapse',
314
+ marginTop: '1rem',
315
+ }}
316
+ >
317
+ <thead>
318
+ <tr style={{ borderBottom: '2px solid #e0e0e0' }}>
319
+ <th style={{ padding: '0.75rem', textAlign: 'left' }}>
320
+ Prop
321
+ </th>
322
+ <th style={{ padding: '0.75rem', textAlign: 'left' }}>
323
+ Type
324
+ </th>
325
+ <th style={{ padding: '0.75rem', textAlign: 'left' }}>
326
+ Default
327
+ </th>
328
+ <th style={{ padding: '0.75rem', textAlign: 'left' }}>
329
+ Description
330
+ </th>
331
+ </tr>
332
+ </thead>
333
+ <tbody>
334
+ <tr style={{ borderBottom: '1px solid #e0e0e0' }}>
335
+ <td style={{ padding: '0.75rem' }}>
336
+ <code>to</code>
337
+ </td>
338
+ <td style={{ padding: '0.75rem' }}>string</td>
339
+ <td style={{ padding: '0.75rem' }}>-</td>
340
+ <td style={{ padding: '0.75rem' }}>
341
+ Destination URL (required)
342
+ </td>
343
+ </tr>
344
+ <tr
345
+ style={{
346
+ borderBottom: '1px solid #e0e0e0',
347
+ background: '#f0f8ff',
348
+ }}
349
+ >
350
+ <td style={{ padding: '0.75rem' }}>
351
+ <code>fragment</code>
352
+ </td>
353
+ <td style={{ padding: '0.75rem' }}>string</td>
354
+ <td style={{ padding: '0.75rem' }}>undefined</td>
355
+ <td style={{ padding: '0.75rem' }}>
356
+ <strong>
357
+ Fragment identifier to scroll to after navigation
358
+ </strong>
359
+ </td>
360
+ </tr>
361
+ <tr style={{ borderBottom: '1px solid #e0e0e0' }}>
362
+ <td style={{ padding: '0.75rem' }}>
363
+ <code>replace</code>
364
+ </td>
365
+ <td style={{ padding: '0.75rem' }}>boolean</td>
366
+ <td style={{ padding: '0.75rem' }}>false</td>
367
+ <td style={{ padding: '0.75rem' }}>
368
+ Replace history entry instead of push
369
+ </td>
370
+ </tr>
371
+ <tr style={{ borderBottom: '1px solid #e0e0e0' }}>
372
+ <td style={{ padding: '0.75rem' }}>
373
+ <code>prefetch</code>
374
+ </td>
375
+ <td style={{ padding: '0.75rem' }}>boolean</td>
376
+ <td style={{ padding: '0.75rem' }}>true</td>
377
+ <td style={{ padding: '0.75rem' }}>
378
+ Enable prefetching on hover/focus
379
+ </td>
380
+ </tr>
381
+ <tr>
382
+ <td style={{ padding: '0.75rem' }}>
383
+ <code>state</code>
384
+ </td>
385
+ <td style={{ padding: '0.75rem' }}>any</td>
386
+ <td style={{ padding: '0.75rem' }}>undefined</td>
387
+ <td style={{ padding: '0.75rem' }}>
388
+ State to pass to the route
389
+ </td>
390
+ </tr>
391
+ </tbody>
392
+ </table>
393
+ <p style={{ marginTop: '1.5rem' }}>
394
+ All standard HTML anchor element attributes are also supported
395
+ (className, style, aria-*, etc.).
396
+ </p>
397
+ </>
398
+ }
399
+ />
400
+
401
+ <Section
402
+ id='examples'
403
+ title='🎯 Examples'
404
+ content={
405
+ <>
406
+ <h3>Example 1: Table of Contents</h3>
407
+ <p>
408
+ Create a table of contents that allows users to jump to
409
+ different sections of a page:
410
+ </p>
411
+ <code
412
+ style={{
413
+ display: 'block',
414
+ background: '#f5f5f5',
415
+ padding: '1rem',
416
+ borderRadius: '4px',
417
+ marginTop: '1rem',
418
+ whiteSpace: 'pre',
419
+ overflow: 'auto',
420
+ }}
421
+ >
422
+ {`<nav>
423
+ <Link to="/docs" fragment="intro">Introduction</Link>
424
+ <Link to="/docs" fragment="setup">Setup</Link>
425
+ <Link to="/docs" fragment="advanced">Advanced</Link>
426
+ </nav>
427
+
428
+ <section id="intro">...</section>
429
+ <section id="setup">...</section>
430
+ <section id="advanced">...</section>`}
431
+ </code>
432
+
433
+ <h3 style={{ marginTop: '2rem' }}>
434
+ Example 2: Cross-Page Navigation
435
+ </h3>
436
+ <p>Navigate to a specific section on a different page:</p>
437
+ <code
438
+ style={{
439
+ display: 'block',
440
+ background: '#f5f5f5',
441
+ padding: '1rem',
442
+ borderRadius: '4px',
443
+ marginTop: '1rem',
444
+ whiteSpace: 'pre',
445
+ overflow: 'auto',
446
+ }}
447
+ >
448
+ {`// From home page to a specific section in docs
449
+ <Link to="/docs" fragment="installation">
450
+ View Installation Guide
451
+ </Link>`}
452
+ </code>
453
+
454
+ <h3 style={{ marginTop: '2rem' }}>Example 3: Blog Post Links</h3>
455
+ <p>Link to specific sections within blog posts:</p>
456
+ <code
457
+ style={{
458
+ display: 'block',
459
+ background: '#f5f5f5',
460
+ padding: '1rem',
461
+ borderRadius: '4px',
462
+ marginTop: '1rem',
463
+ whiteSpace: 'pre',
464
+ overflow: 'auto',
465
+ }}
466
+ >
467
+ {`<Link to="/blog/my-post" fragment="conclusion">
468
+ Skip to Conclusion
469
+ </Link>`}
470
+ </code>
471
+
472
+ <h3 style={{ marginTop: '2rem' }}>
473
+ Example 4: Sticky Header Compatibility
474
+ </h3>
475
+ <p>
476
+ Use <code>scroll-margin-top</code> CSS to account for sticky
477
+ headers:
478
+ </p>
479
+ <code
480
+ style={{
481
+ display: 'block',
482
+ background: '#f5f5f5',
483
+ padding: '1rem',
484
+ borderRadius: '4px',
485
+ marginTop: '1rem',
486
+ whiteSpace: 'pre',
487
+ overflow: 'auto',
488
+ }}
489
+ >
490
+ {`section {
491
+ scroll-margin-top: 80px; /* Height of sticky header */
492
+ }`}
493
+ </code>
494
+ </>
495
+ }
496
+ />
497
+
498
+ <Section
499
+ id='faq'
500
+ title='❓ FAQ'
501
+ content={
502
+ <>
503
+ <h3>How does fragment scrolling work?</h3>
504
+ <p>
505
+ When you click a Link with a <code>fragment</code> prop, the
506
+ component:
507
+ </p>
508
+ <ol>
509
+ <li>
510
+ Navigates to the target URL with the fragment in the hash
511
+ </li>
512
+ <li>Waits for the route component to render</li>
513
+ <li>
514
+ Searches for an element with an ID matching the fragment
515
+ </li>
516
+ <li>
517
+ Scrolls smoothly to that element using{' '}
518
+ <code>scrollIntoView</code>
519
+ </li>
520
+ <li>
521
+ Retries up to 10 times (500ms total) if the element isn't
522
+ found immediately
523
+ </li>
524
+ </ol>
525
+
526
+ <h3 style={{ marginTop: '1.5rem' }}>Does it work with SSR?</h3>
527
+ <p>
528
+ Yes! The fragment is added to the href attribute, so it works
529
+ even with JavaScript disabled. When JavaScript is enabled, you
530
+ get smooth scrolling behavior.
531
+ </p>
532
+
533
+ <h3 style={{ marginTop: '1.5rem' }}>
534
+ Can I combine it with other Link props?
535
+ </h3>
536
+ <p>
537
+ Absolutely! The <code>fragment</code> prop works seamlessly with
538
+ all other Link props like <code>replace</code>,{' '}
539
+ <code>state</code>, and <code>prefetch</code>.
540
+ </p>
541
+
542
+ <h3 style={{ marginTop: '1.5rem' }}>
543
+ What about browser back/forward?
544
+ </h3>
545
+ <p>
546
+ Fragment navigation fully supports browser history. When users
547
+ navigate back/forward, the page will scroll to the appropriate
548
+ fragment automatically.
549
+ </p>
550
+
551
+ <h3 style={{ marginTop: '1.5rem' }}>
552
+ Does it work with view transitions?
553
+ </h3>
554
+ <p>
555
+ Yes! The fragment scrolling is coordinated with React's view
556
+ transitions, so animations complete before scrolling occurs.
557
+ </p>
558
+ </>
559
+ }
560
+ />
561
+
562
+ {/* Bottom Navigation */}
563
+ <div
564
+ style={{
565
+ marginTop: '4rem',
566
+ padding: '2rem',
567
+ background: '#fff',
568
+ border: '1px solid #e0e0e0',
569
+ borderRadius: '8px',
570
+ textAlign: 'center',
571
+ }}
572
+ >
573
+ <h3>Try it out!</h3>
574
+ <p style={{ marginBottom: '1.5rem' }}>
575
+ Use the table of contents at the top to test the fragment
576
+ navigation, or click below to jump to specific sections:
577
+ </p>
578
+ <div
579
+ style={{
580
+ display: 'flex',
581
+ gap: '1rem',
582
+ justifyContent: 'center',
583
+ flexWrap: 'wrap',
584
+ }}
585
+ >
586
+ <Link
587
+ to='/docs'
588
+ fragment='getting-started'
589
+ style={{
590
+ padding: '0.75rem 1.5rem',
591
+ background: '#0066cc',
592
+ color: '#fff',
593
+ textDecoration: 'none',
594
+ borderRadius: '4px',
595
+ }}
596
+ >
597
+ ↑ Back to Top
598
+ </Link>
599
+ <Link
600
+ to='/'
601
+ style={{
602
+ padding: '0.75rem 1.5rem',
603
+ background: '#666',
604
+ color: '#fff',
605
+ textDecoration: 'none',
606
+ borderRadius: '4px',
607
+ }}
608
+ >
609
+ ← Back to Home
610
+ </Link>
611
+ <Link
612
+ to='/blog'
613
+ style={{
614
+ padding: '0.75rem 1.5rem',
615
+ background: '#28a745',
616
+ color: '#fff',
617
+ textDecoration: 'none',
618
+ borderRadius: '4px',
619
+ }}
620
+ >
621
+ View Blog →
622
+ </Link>
623
+ <Link
624
+ to='/client'
625
+ style={{
626
+ padding: '0.75rem 1.5rem',
627
+ background: '#6610f2',
628
+ color: '#fff',
629
+ textDecoration: 'none',
630
+ borderRadius: '4px',
631
+ }}
632
+ >
633
+ ClientOnly Demo →
634
+ </Link>
635
+ </div>
636
+ </div>
637
+ </main>
638
+ </div>
639
+ );
640
+ }
641
+
642
+ // Helper component for sections
643
+ function Section({
644
+ id,
645
+ title,
646
+ content,
647
+ }: {
648
+ id: string;
649
+ title: string;
650
+ content: React.ReactNode;
651
+ }) {
652
+ return (
653
+ <section
654
+ id={id}
655
+ style={{
656
+ background: '#fff',
657
+ border: '1px solid #e0e0e0',
658
+ borderRadius: '8px',
659
+ padding: '2rem',
660
+ marginBottom: '2rem',
661
+ scrollMarginTop: '80px', // Account for sticky header
662
+ }}
663
+ >
664
+ <h2 style={{ marginTop: 0, marginBottom: '1rem' }}>{title}</h2>
665
+ <div style={{ lineHeight: '1.6', color: '#333' }}>{content}</div>
666
+ </section>
667
+ );
668
+ }
669
+
670
+ export { meta };
@@ -38,6 +38,42 @@ export default function HomePage() {
38
38
  >
39
39
  Blog
40
40
  </Link>
41
+ <Link
42
+ to='/docs'
43
+ style={{
44
+ padding: '0.5rem 1rem',
45
+ background: '#0066cc',
46
+ color: '#fff',
47
+ textDecoration: 'none',
48
+ borderRadius: '4px',
49
+ }}
50
+ >
51
+ 📚 Docs (Fragment Demo)
52
+ </Link>
53
+ <Link
54
+ to='/client'
55
+ style={{
56
+ padding: '0.5rem 1rem',
57
+ background: '#28a745',
58
+ color: '#fff',
59
+ textDecoration: 'none',
60
+ borderRadius: '4px',
61
+ }}
62
+ >
63
+ 🎯 ClientOnly Demo
64
+ </Link>
65
+ <Link
66
+ to='/markdown-demo'
67
+ style={{
68
+ padding: '0.5rem 1rem',
69
+ background: '#8b5cf6',
70
+ color: '#fff',
71
+ textDecoration: 'none',
72
+ borderRadius: '4px',
73
+ }}
74
+ >
75
+ 📝 Markdown Routes Demo
76
+ </Link>
41
77
  </nav>
42
78
  </section>
43
79
 
@@ -56,6 +92,7 @@ export default function HomePage() {
56
92
  <li>Server-side rendering (SSR)</li>
57
93
  <li>Type-safe route params</li>
58
94
  <li>Automatic route generation</li>
95
+ <li>Native markdown routes with syntax highlighting</li>
59
96
  </ul>
60
97
  </section>
61
98
  </main>