@depup/tanstack__react-router 1.167.5-depup.0 → 1.168.2-depup.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 (113) hide show
  1. package/README.md +3 -4
  2. package/changes.json +2 -6
  3. package/dist/cjs/Match.cjs +147 -58
  4. package/dist/cjs/Match.cjs.map +1 -1
  5. package/dist/cjs/Matches.cjs +22 -24
  6. package/dist/cjs/Matches.cjs.map +1 -1
  7. package/dist/cjs/Scripts.cjs +36 -32
  8. package/dist/cjs/Scripts.cjs.map +1 -1
  9. package/dist/cjs/Transitioner.cjs +10 -16
  10. package/dist/cjs/Transitioner.cjs.map +1 -1
  11. package/dist/cjs/fileRoute.cjs +4 -6
  12. package/dist/cjs/fileRoute.cjs.map +1 -1
  13. package/dist/cjs/headContentUtils.cjs +147 -59
  14. package/dist/cjs/headContentUtils.cjs.map +1 -1
  15. package/dist/cjs/index.cjs +1 -1
  16. package/dist/cjs/index.dev.cjs +1 -1
  17. package/dist/cjs/link.cjs +34 -29
  18. package/dist/cjs/link.cjs.map +1 -1
  19. package/dist/cjs/not-found.cjs +20 -2
  20. package/dist/cjs/not-found.cjs.map +1 -1
  21. package/dist/cjs/renderRouteNotFound.cjs +3 -3
  22. package/dist/cjs/renderRouteNotFound.cjs.map +1 -1
  23. package/dist/cjs/route.cjs +0 -2
  24. package/dist/cjs/route.cjs.map +1 -1
  25. package/dist/cjs/router.cjs +2 -1
  26. package/dist/cjs/router.cjs.map +1 -1
  27. package/dist/cjs/routerStores.cjs +21 -0
  28. package/dist/cjs/routerStores.cjs.map +1 -0
  29. package/dist/cjs/routerStores.d.cts +7 -0
  30. package/dist/cjs/ssr/RouterClient.cjs +1 -1
  31. package/dist/cjs/ssr/RouterClient.cjs.map +1 -1
  32. package/dist/cjs/ssr/renderRouterToStream.cjs +2 -2
  33. package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -1
  34. package/dist/cjs/ssr/renderRouterToString.cjs +1 -1
  35. package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -1
  36. package/dist/cjs/useCanGoBack.cjs +7 -2
  37. package/dist/cjs/useCanGoBack.cjs.map +1 -1
  38. package/dist/cjs/useLocation.cjs +21 -2
  39. package/dist/cjs/useLocation.cjs.map +1 -1
  40. package/dist/cjs/useMatch.cjs +35 -11
  41. package/dist/cjs/useMatch.cjs.map +1 -1
  42. package/dist/cjs/useRouter.cjs +3 -3
  43. package/dist/cjs/useRouter.cjs.map +1 -1
  44. package/dist/cjs/useRouterState.cjs +2 -2
  45. package/dist/cjs/useRouterState.cjs.map +1 -1
  46. package/dist/esm/Match.js +148 -57
  47. package/dist/esm/Match.js.map +1 -1
  48. package/dist/esm/Matches.js +23 -24
  49. package/dist/esm/Matches.js.map +1 -1
  50. package/dist/esm/Scripts.js +36 -32
  51. package/dist/esm/Scripts.js.map +1 -1
  52. package/dist/esm/Transitioner.js +10 -16
  53. package/dist/esm/Transitioner.js.map +1 -1
  54. package/dist/esm/fileRoute.js +4 -4
  55. package/dist/esm/fileRoute.js.map +1 -1
  56. package/dist/esm/headContentUtils.js +148 -60
  57. package/dist/esm/headContentUtils.js.map +1 -1
  58. package/dist/esm/index.dev.js +1 -1
  59. package/dist/esm/index.js +1 -1
  60. package/dist/esm/link.js +34 -29
  61. package/dist/esm/link.js.map +1 -1
  62. package/dist/esm/not-found.js +20 -2
  63. package/dist/esm/not-found.js.map +1 -1
  64. package/dist/esm/renderRouteNotFound.js +3 -2
  65. package/dist/esm/renderRouteNotFound.js.map +1 -1
  66. package/dist/esm/route.js +0 -2
  67. package/dist/esm/route.js.map +1 -1
  68. package/dist/esm/router.js +2 -1
  69. package/dist/esm/router.js.map +1 -1
  70. package/dist/esm/routerStores.d.ts +7 -0
  71. package/dist/esm/routerStores.js +20 -0
  72. package/dist/esm/routerStores.js.map +1 -0
  73. package/dist/esm/ssr/RouterClient.js +1 -1
  74. package/dist/esm/ssr/RouterClient.js.map +1 -1
  75. package/dist/esm/ssr/renderRouterToStream.js +2 -2
  76. package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
  77. package/dist/esm/ssr/renderRouterToString.js +1 -1
  78. package/dist/esm/ssr/renderRouterToString.js.map +1 -1
  79. package/dist/esm/useCanGoBack.js +6 -2
  80. package/dist/esm/useCanGoBack.js.map +1 -1
  81. package/dist/esm/useLocation.js +20 -2
  82. package/dist/esm/useLocation.js.map +1 -1
  83. package/dist/esm/useMatch.js +35 -10
  84. package/dist/esm/useMatch.js.map +1 -1
  85. package/dist/esm/useRouter.js +3 -2
  86. package/dist/esm/useRouter.js.map +1 -1
  87. package/dist/esm/useRouterState.js +2 -2
  88. package/dist/esm/useRouterState.js.map +1 -1
  89. package/dist/llms/rules/api.d.ts +1 -1
  90. package/dist/llms/rules/api.js +13 -19
  91. package/dist/llms/rules/guide.d.ts +1 -1
  92. package/dist/llms/rules/guide.js +27 -6
  93. package/package.json +5 -11
  94. package/src/Match.tsx +274 -81
  95. package/src/Matches.tsx +48 -30
  96. package/src/Scripts.tsx +72 -44
  97. package/src/Transitioner.tsx +24 -16
  98. package/src/fileRoute.ts +7 -9
  99. package/src/headContentUtils.tsx +210 -27
  100. package/src/link.tsx +66 -71
  101. package/src/not-found.tsx +41 -4
  102. package/src/renderRouteNotFound.tsx +6 -6
  103. package/src/route.tsx +0 -2
  104. package/src/router.ts +2 -1
  105. package/src/routerStores.ts +26 -0
  106. package/src/ssr/RouterClient.tsx +1 -1
  107. package/src/ssr/renderRouterToStream.tsx +2 -2
  108. package/src/ssr/renderRouterToString.tsx +1 -1
  109. package/src/useCanGoBack.ts +14 -2
  110. package/src/useLocation.tsx +32 -5
  111. package/src/useMatch.tsx +68 -19
  112. package/src/useRouter.tsx +7 -5
  113. package/src/useRouterState.tsx +4 -2
@@ -1841,7 +1841,6 @@ type RouterState = {
1841
1841
  isLoading: boolean
1842
1842
  isTransitioning: boolean
1843
1843
  matches: Array<RouteMatch>
1844
- pendingMatches: Array<RouteMatch>
1845
1844
  location: ParsedLocation
1846
1845
  resolvedLocation: ParsedLocation
1847
1846
  }
@@ -1871,11 +1870,6 @@ The \`RouterState\` type contains all of the properties that are available on th
1871
1870
  - Type: [\`Array<RouteMatch>\`](./RouteMatchType.md)
1872
1871
  - An array of all of the route matches that have been resolved and are currently active.
1873
1872
 
1874
- ### \`pendingMatches\` property
1875
-
1876
- - Type: [\`Array<RouteMatch>\`](./RouteMatchType.md)
1877
- - An array of all of the route matches that are currently pending.
1878
-
1879
1873
  ### \`location\` property
1880
1874
 
1881
1875
  - Type: [\`ParsedLocation\`](./ParsedLocationType.md)
@@ -3350,14 +3344,14 @@ If \`true\` is passed in, all search params will be retained.
3350
3344
  \`\`\`tsx
3351
3345
  import { z } from 'zod'
3352
3346
  import { createRootRoute, retainSearchParams } from '@tanstack/react-router'
3353
- import { zodValidator } from '@tanstack/zod-adapter'
3354
3347
 
3355
3348
  const searchSchema = z.object({
3356
3349
  rootValue: z.string().optional(),
3357
3350
  })
3358
3351
 
3359
3352
  export const Route = createRootRoute({
3360
- validateSearch: zodValidator(searchSchema),
3353
+ // Use the schema directly for Zod v4
3354
+ validateSearch: searchSchema,
3361
3355
  search: {
3362
3356
  middlewares: [retainSearchParams(['rootValue'])],
3363
3357
  },
@@ -3367,7 +3361,6 @@ export const Route = createRootRoute({
3367
3361
  \`\`\`tsx
3368
3362
  import { z } from 'zod'
3369
3363
  import { createFileRoute, retainSearchParams } from '@tanstack/react-router'
3370
- import { zodValidator } from '@tanstack/zod-adapter'
3371
3364
 
3372
3365
  const searchSchema = z.object({
3373
3366
  one: z.string().optional(),
@@ -3375,7 +3368,8 @@ const searchSchema = z.object({
3375
3368
  })
3376
3369
 
3377
3370
  export const Route = createFileRoute('/')({
3378
- validateSearch: zodValidator(searchSchema),
3371
+ // Use the schema directly for Zod v4
3372
+ validateSearch: searchSchema,
3379
3373
  search: {
3380
3374
  middlewares: [retainSearchParams(true)],
3381
3375
  },
@@ -3451,7 +3445,6 @@ const router = createRouter({
3451
3445
  \`\`\`tsx
3452
3446
  import { z } from 'zod'
3453
3447
  import { createFileRoute, stripSearchParams } from '@tanstack/react-router'
3454
- import { zodValidator } from '@tanstack/zod-adapter'
3455
3448
 
3456
3449
  const defaultValues = {
3457
3450
  one: 'abc',
@@ -3464,7 +3457,8 @@ const searchSchema = z.object({
3464
3457
  })
3465
3458
 
3466
3459
  export const Route = createFileRoute('/')({
3467
- validateSearch: zodValidator(searchSchema),
3460
+ // for Zod v4, use the schema directly
3461
+ validateSearch: searchSchema,
3468
3462
  search: {
3469
3463
  // strip default values
3470
3464
  middlewares: [stripSearchParams(defaultValues)],
@@ -3475,7 +3469,6 @@ export const Route = createFileRoute('/')({
3475
3469
  \`\`\`tsx
3476
3470
  import { z } from 'zod'
3477
3471
  import { createRootRoute, stripSearchParams } from '@tanstack/react-router'
3478
- import { zodValidator } from '@tanstack/zod-adapter'
3479
3472
 
3480
3473
  const searchSchema = z.object({
3481
3474
  hello: z.string().default('world'),
@@ -3483,7 +3476,8 @@ const searchSchema = z.object({
3483
3476
  })
3484
3477
 
3485
3478
  export const Route = createRootRoute({
3486
- validateSearch: zodValidator(searchSchema),
3479
+ // for Zod v4, use the schema directly
3480
+ validateSearch: searchSchema,
3487
3481
  search: {
3488
3482
  // always remove \`hello\`
3489
3483
  middlewares: [stripSearchParams(['hello'])],
@@ -3494,7 +3488,6 @@ export const Route = createRootRoute({
3494
3488
  \`\`\`tsx
3495
3489
  import { z } from 'zod'
3496
3490
  import { createFileRoute, stripSearchParams } from '@tanstack/react-router'
3497
- import { zodValidator } from '@tanstack/zod-adapter'
3498
3491
 
3499
3492
  const searchSchema = z.object({
3500
3493
  one: z.string().default('abc'),
@@ -3502,7 +3495,8 @@ const searchSchema = z.object({
3502
3495
  })
3503
3496
 
3504
3497
  export const Route = createFileRoute('/')({
3505
- validateSearch: zodValidator(searchSchema),
3498
+ // for Zod v4, use the schema directly
3499
+ validateSearch: searchSchema,
3506
3500
  search: {
3507
3501
  // remove all search params
3508
3502
  middlewares: [stripSearchParams(true)],
@@ -3797,7 +3791,7 @@ function Component() {
3797
3791
  The \`useChildMatches\` hook returns all of the child [\`RouteMatch\`](./RouteMatchType.md) objects from the closest match down to the leaf-most match. **It does not include the current match, which can be obtained using the \`useMatch\` hook.**
3798
3792
 
3799
3793
  > [!IMPORTANT]
3800
- > If the router has pending matches and they are showing their pending component fallbacks, \`router.state.pendingMatches\` will used instead of \`router.state.matches\`.
3794
+ > If the router has pending matches and they are showing their pending component fallbacks, pending matches are used instead of active matches.
3801
3795
 
3802
3796
  ## useChildMatches options
3803
3797
 
@@ -4406,7 +4400,7 @@ function Component() {
4406
4400
  The \`useParentMatches\` hook returns all of the parent [\`RouteMatch\`](./RouteMatchType.md) objects from the root down to the immediate parent of the current match in context. **It does not include the current match, which can be obtained using the \`useMatch\` hook.**
4407
4401
 
4408
4402
  > [!IMPORTANT]
4409
- > If the router has pending matches and they are showing their pending component fallbacks, \`router.state.pendingMatches\` will used instead of \`router.state.matches\`.
4403
+ > If the router has pending matches and they are showing their pending component fallbacks, pending matches are used instead of active matches.
4410
4404
 
4411
4405
  ## useParentMatches options
4412
4406
 
@@ -4514,7 +4508,7 @@ function Component() {
4514
4508
  The \`useRouterState\` method is a hook that returns the current internal state of the router. This hook is useful for accessing the current state of the router in a component.
4515
4509
 
4516
4510
  > [!TIP]
4517
- > If you want to access the current location or the current matches, you should try out the [\`useLocation\`](./useLocationHook.md) and [\`useMatches\`](./useMatchesHook.md) hooks first. These hooks are designed to be more ergonomic and easier to use than accessing the router state directly.
4511
+ > If you want to access the current location or the current matches, you should try out the [\`useLocation\`](./useLocationHook.md) and [\`useMatches\`](./useMatchesHook.md) hooks first. These hooks are designed to be more performant, more ergonomic and easier to use than accessing the router state directly.
4518
4512
 
4519
4513
  ## useRouterState options
4520
4514