@tanstack/solid-router 1.112.11 → 1.112.12

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 (184) hide show
  1. package/dist/cjs/Match.cjs.map +1 -1
  2. package/dist/cjs/Matches.cjs.map +1 -1
  3. package/dist/cjs/Matches.d.cts +1 -8
  4. package/dist/cjs/RouterProvider.cjs.map +1 -1
  5. package/dist/cjs/RouterProvider.d.cts +4 -4
  6. package/dist/cjs/Transitioner.cjs +1 -1
  7. package/dist/cjs/Transitioner.cjs.map +1 -1
  8. package/dist/cjs/fileRoute.cjs.map +1 -1
  9. package/dist/cjs/fileRoute.d.cts +4 -7
  10. package/dist/cjs/index.d.cts +3 -5
  11. package/dist/cjs/link.cjs.map +1 -1
  12. package/dist/cjs/link.d.cts +1 -2
  13. package/dist/cjs/not-found.cjs.map +1 -1
  14. package/dist/cjs/not-found.d.cts +1 -2
  15. package/dist/cjs/redirects.cjs.map +1 -1
  16. package/dist/cjs/redirects.d.cts +1 -2
  17. package/dist/cjs/renderRouteNotFound.cjs.map +1 -1
  18. package/dist/cjs/renderRouteNotFound.d.cts +1 -2
  19. package/dist/cjs/route.cjs +15 -23
  20. package/dist/cjs/route.cjs.map +1 -1
  21. package/dist/cjs/route.d.cts +19 -50
  22. package/dist/cjs/router.cjs +18 -20
  23. package/dist/cjs/router.cjs.map +1 -1
  24. package/dist/cjs/router.d.cts +84 -454
  25. package/dist/cjs/routerContext.cjs.map +1 -1
  26. package/dist/cjs/routerContext.d.cts +2 -2
  27. package/dist/cjs/scroll-restoration.cjs.map +1 -1
  28. package/dist/cjs/scroll-restoration.d.cts +1 -2
  29. package/dist/cjs/typePrimitives.d.cts +1 -2
  30. package/dist/cjs/useBlocker.cjs.map +1 -1
  31. package/dist/cjs/useBlocker.d.cts +2 -3
  32. package/dist/cjs/useLoaderData.cjs.map +1 -1
  33. package/dist/cjs/useLoaderData.d.cts +1 -3
  34. package/dist/cjs/useLoaderDeps.cjs.map +1 -1
  35. package/dist/cjs/useLoaderDeps.d.cts +1 -3
  36. package/dist/cjs/useLocation.cjs.map +1 -1
  37. package/dist/cjs/useLocation.d.cts +1 -1
  38. package/dist/cjs/useMatch.cjs.map +1 -1
  39. package/dist/cjs/useMatch.d.cts +1 -3
  40. package/dist/cjs/useNavigate.cjs.map +1 -1
  41. package/dist/cjs/useNavigate.d.cts +1 -2
  42. package/dist/cjs/useParams.cjs.map +1 -1
  43. package/dist/cjs/useParams.d.cts +1 -3
  44. package/dist/cjs/useRouteContext.cjs.map +1 -1
  45. package/dist/cjs/useRouteContext.d.cts +1 -2
  46. package/dist/cjs/useRouter.cjs.map +1 -1
  47. package/dist/cjs/useRouter.d.cts +1 -1
  48. package/dist/cjs/useRouterState.cjs.map +1 -1
  49. package/dist/cjs/useRouterState.d.cts +1 -1
  50. package/dist/cjs/useSearch.cjs.map +1 -1
  51. package/dist/cjs/useSearch.d.cts +1 -3
  52. package/dist/cjs/utils.cjs.map +1 -1
  53. package/dist/cjs/utils.d.cts +0 -9
  54. package/dist/esm/Match.js.map +1 -1
  55. package/dist/esm/Matches.d.ts +1 -8
  56. package/dist/esm/Matches.js.map +1 -1
  57. package/dist/esm/RouterProvider.d.ts +4 -4
  58. package/dist/esm/RouterProvider.js.map +1 -1
  59. package/dist/esm/Transitioner.js +1 -1
  60. package/dist/esm/Transitioner.js.map +1 -1
  61. package/dist/esm/fileRoute.d.ts +4 -7
  62. package/dist/esm/fileRoute.js.map +1 -1
  63. package/dist/esm/index.d.ts +3 -5
  64. package/dist/esm/link.d.ts +1 -2
  65. package/dist/esm/link.js.map +1 -1
  66. package/dist/esm/not-found.d.ts +1 -2
  67. package/dist/esm/not-found.js.map +1 -1
  68. package/dist/esm/redirects.d.ts +1 -2
  69. package/dist/esm/redirects.js.map +1 -1
  70. package/dist/esm/renderRouteNotFound.d.ts +1 -2
  71. package/dist/esm/renderRouteNotFound.js.map +1 -1
  72. package/dist/esm/route.d.ts +19 -50
  73. package/dist/esm/route.js +15 -23
  74. package/dist/esm/route.js.map +1 -1
  75. package/dist/esm/router.d.ts +84 -454
  76. package/dist/esm/router.js +18 -20
  77. package/dist/esm/router.js.map +1 -1
  78. package/dist/esm/routerContext.d.ts +2 -2
  79. package/dist/esm/routerContext.js.map +1 -1
  80. package/dist/esm/scroll-restoration.d.ts +1 -2
  81. package/dist/esm/scroll-restoration.js.map +1 -1
  82. package/dist/esm/typePrimitives.d.ts +1 -2
  83. package/dist/esm/useBlocker.d.ts +2 -3
  84. package/dist/esm/useBlocker.js.map +1 -1
  85. package/dist/esm/useLoaderData.d.ts +1 -3
  86. package/dist/esm/useLoaderData.js.map +1 -1
  87. package/dist/esm/useLoaderDeps.d.ts +1 -3
  88. package/dist/esm/useLoaderDeps.js.map +1 -1
  89. package/dist/esm/useLocation.d.ts +1 -1
  90. package/dist/esm/useLocation.js.map +1 -1
  91. package/dist/esm/useMatch.d.ts +1 -3
  92. package/dist/esm/useMatch.js.map +1 -1
  93. package/dist/esm/useNavigate.d.ts +1 -2
  94. package/dist/esm/useNavigate.js.map +1 -1
  95. package/dist/esm/useParams.d.ts +1 -3
  96. package/dist/esm/useParams.js.map +1 -1
  97. package/dist/esm/useRouteContext.d.ts +1 -2
  98. package/dist/esm/useRouteContext.js.map +1 -1
  99. package/dist/esm/useRouter.d.ts +1 -1
  100. package/dist/esm/useRouter.js.map +1 -1
  101. package/dist/esm/useRouterState.d.ts +1 -1
  102. package/dist/esm/useRouterState.js.map +1 -1
  103. package/dist/esm/useSearch.d.ts +1 -3
  104. package/dist/esm/useSearch.js.map +1 -1
  105. package/dist/esm/utils.d.ts +0 -9
  106. package/dist/esm/utils.js.map +1 -1
  107. package/dist/source/Matches.d.ts +1 -8
  108. package/dist/source/Matches.jsx.map +1 -1
  109. package/dist/source/RouterProvider.d.ts +4 -4
  110. package/dist/source/RouterProvider.jsx.map +1 -1
  111. package/dist/source/Transitioner.jsx +1 -1
  112. package/dist/source/Transitioner.jsx.map +1 -1
  113. package/dist/source/fileRoute.d.ts +4 -7
  114. package/dist/source/fileRoute.js.map +1 -1
  115. package/dist/source/index.d.ts +3 -5
  116. package/dist/source/index.jsx.map +1 -1
  117. package/dist/source/link.d.ts +1 -2
  118. package/dist/source/link.jsx.map +1 -1
  119. package/dist/source/not-found.d.ts +1 -2
  120. package/dist/source/not-found.jsx.map +1 -1
  121. package/dist/source/redirects.d.ts +1 -2
  122. package/dist/source/renderRouteNotFound.d.ts +1 -2
  123. package/dist/source/renderRouteNotFound.jsx.map +1 -1
  124. package/dist/source/route.d.ts +19 -50
  125. package/dist/source/route.js +15 -23
  126. package/dist/source/route.js.map +1 -1
  127. package/dist/source/router.d.ts +83 -454
  128. package/dist/source/router.js +23 -14
  129. package/dist/source/router.js.map +1 -1
  130. package/dist/source/routerContext.d.ts +2 -2
  131. package/dist/source/routerContext.jsx.map +1 -1
  132. package/dist/source/scroll-restoration.d.ts +1 -2
  133. package/dist/source/scroll-restoration.jsx.map +1 -1
  134. package/dist/source/typePrimitives.d.ts +1 -2
  135. package/dist/source/useBlocker.d.ts +2 -3
  136. package/dist/source/useBlocker.jsx.map +1 -1
  137. package/dist/source/useLoaderData.d.ts +1 -3
  138. package/dist/source/useLoaderData.jsx.map +1 -1
  139. package/dist/source/useLoaderDeps.d.ts +1 -3
  140. package/dist/source/useLoaderDeps.jsx.map +1 -1
  141. package/dist/source/useLocation.d.ts +1 -1
  142. package/dist/source/useLocation.jsx.map +1 -1
  143. package/dist/source/useMatch.d.ts +1 -3
  144. package/dist/source/useMatch.jsx.map +1 -1
  145. package/dist/source/useNavigate.d.ts +1 -2
  146. package/dist/source/useNavigate.jsx.map +1 -1
  147. package/dist/source/useParams.d.ts +1 -3
  148. package/dist/source/useParams.jsx.map +1 -1
  149. package/dist/source/useRouteContext.d.ts +1 -2
  150. package/dist/source/useRouter.d.ts +1 -1
  151. package/dist/source/useRouterState.d.ts +1 -1
  152. package/dist/source/useRouterState.jsx.map +1 -1
  153. package/dist/source/useSearch.d.ts +1 -3
  154. package/dist/source/useSearch.jsx.map +1 -1
  155. package/dist/source/utils.d.ts +1 -10
  156. package/dist/source/utils.js.map +1 -1
  157. package/package.json +3 -3
  158. package/src/Match.tsx +1 -1
  159. package/src/Matches.tsx +4 -8
  160. package/src/RouterProvider.tsx +4 -7
  161. package/src/Transitioner.tsx +1 -1
  162. package/src/fileRoute.ts +9 -25
  163. package/src/index.tsx +22 -28
  164. package/src/link.tsx +2 -1
  165. package/src/not-found.tsx +1 -2
  166. package/src/redirects.ts +1 -1
  167. package/src/renderRouteNotFound.tsx +1 -2
  168. package/src/route.ts +93 -222
  169. package/src/router.ts +146 -591
  170. package/src/routerContext.tsx +3 -3
  171. package/src/scroll-restoration.tsx +6 -2
  172. package/src/typePrimitives.ts +2 -1
  173. package/src/useBlocker.tsx +7 -3
  174. package/src/useLoaderData.tsx +3 -2
  175. package/src/useLoaderDeps.tsx +3 -2
  176. package/src/useLocation.tsx +5 -1
  177. package/src/useMatch.tsx +3 -2
  178. package/src/useNavigate.tsx +2 -1
  179. package/src/useParams.tsx +3 -2
  180. package/src/useRouteContext.ts +2 -2
  181. package/src/useRouter.tsx +1 -1
  182. package/src/useRouterState.tsx +5 -1
  183. package/src/useSearch.tsx +3 -2
  184. package/src/utils.ts +0 -16
@@ -1 +1 @@
1
- {"version":3,"file":"Matches.js","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { Match } from './Match'\nimport { SafeFragment } from './SafeFragment'\nimport type {\n DeepPartial,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n NoInfer,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\nimport type { AnyRouter, RegisteredRouter, RouterState } from './router'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\nexport function Matches() {\n const router = useRouter()\n\n const pendingElement = router.options.defaultPendingComponent ? (\n <router.options.defaultPendingComponent />\n ) : null\n\n // Do not render a root Suspense during SSR or hydrating from SSR\n const ResolvedSuspense =\n router.isServer || (typeof document !== 'undefined' && router.clientSsr)\n ? SafeFragment\n : Solid.Suspense\n\n const inner = (\n <ResolvedSuspense fallback={pendingElement}>\n <Transitioner />\n <MatchesInner />\n </ResolvedSuspense>\n )\n\n return router.options.InnerWrap ? (\n <router.options.InnerWrap>{inner}</router.options.InnerWrap>\n ) : (\n inner\n )\n}\n\nfunction MatchesInner() {\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n return (\n <matchContext.Provider value={matchId}>\n <CatchBoundary\n getResetKey={() => resetKey()}\n errorComponent={ErrorComponent}\n onCatch={(error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }}\n >\n {matchId() ? <Match matchId={matchId()!} /> : null}\n </CatchBoundary>\n </matchContext.Provider>\n )\n}\n\nexport interface MatchRouteOptions {\n pending?: boolean\n caseSensitive?: boolean\n includeSearch?: boolean\n fuzzy?: boolean\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ): Solid.Accessor<\n false | ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Solid.createMemo(() => {\n status()\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n })\n\n return matchRoute\n }\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => Solid.JSX.Element)\n | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return (\n <Solid.Show when={status()} keyed>\n {(_) => {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)() as boolean\n\n if (typeof props.children === 'function') {\n return (props.children as any)(params)\n }\n\n return params ? props.children : null\n }}\n </Solid.Show>\n )\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n } as any) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId()),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId()) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"names":["Matches","router","useRouter","pendingElement","options","defaultPendingComponent","_$createComponent","ResolvedSuspense","isServer","document","clientSsr","SafeFragment","Solid","Suspense","inner","fallback","children","Transitioner","MatchesInner","InnerWrap","matchId","useRouterState","select","s","matches","id","resetKey","loadedAt","matchContext","Provider","value","CatchBoundary","getResetKey","errorComponent","ErrorComponent","onCatch","error","warning","message","toString","_$memo","Match","useMatchRoute","status","opts","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","createMemo","MatchRoute","props","Show","when","keyed","_","params","useMatches","state","useParentMatches","contextMatchId","useContext","slice","findIndex","d","useChildMatches"],"mappings":";;;;;;;;;;AAgCO,SAASA,UAAU;AACxB,QAAMC,SAASC,UAAU;AAEnBC,QAAAA,iBAAiBF,OAAOG,QAAQC,0BAAuBC,gBAC1DL,OAAOG,QAAQC,+BACd;AAGEE,QAAAA,mBACJN,OAAOO,YAAa,OAAOC,aAAa,eAAeR,OAAOS,YAC1DC,eACAC,MAAMC;AAENC,QAAAA,QAAKR,gBACRC,kBAAgB;AAAA,IAACQ,UAAUZ;AAAAA,IAAc,IAAAa,WAAA;AAAA,aAAA,CAAAV,gBACvCW,cAAYX,CAAAA,CAAAA,GAAAA,gBACZY,cAAY,CAAA,CAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAEhB;AAED,SAAOjB,OAAOG,QAAQe,YAASb,gBAC5BL,OAAOG,QAAQe,WAAS;AAAA,IAAAH,UAAEF;AAAAA,EAAK,CAAA,IAEhCA;AAEJ;AAEA,SAASI,eAAe;AACtB,QAAME,UAAUC,eAAe;AAAA,IAC7BC,QAASC,CAAM,MAAA;;AACNA,cAAAA,OAAEC,QAAQ,CAAC,MAAXD,mBAAcE;AAAAA,IAAAA;AAAAA,EACvB,CACD;AAED,QAAMC,WAAWL,eAAe;AAAA,IAC9BC,QAASC,OAAMA,EAAEI;AAAAA,EAAAA,CAClB;AAEDrB,SAAAA,gBACGsB,aAAaC,UAAQ;AAAA,IAACC,OAAOV;AAAAA,IAAO,IAAAJ,WAAA;AAAA,aA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KAAY,EAAE;AAEpC,UAAA,OAAOA,MAAMrC,aAAa,YAAY;AAChCqC,eAAAA,MAAMrC,SAAiB0C,MAAM;AAAA,MAAA;AAGhCA,aAAAA,SAASL,MAAMrC,WAAW;AAAA,IAAA;AAAA,EACnC,CAAC;AAGP;AAWO,SAAS2C,WAIdf,MACsD;AACtD,SAAOvB,eAAe;AAAA,IACpBC,QAAQA,CAACsC,UAA6C;AACpD,YAAMpC,UAAUoC,MAAMpC;AACtB,cAAOoB,6BAAMtB,UACTsB,KAAKtB,OAAOE,OAA8C,IAC1DA;AAAAA,IAAAA;AAAAA,EACN,CACM;AACV;AAEO,SAASqC,iBAIdjB,MACsD;AAChDkB,QAAAA,iBAAiBlD,MAAMmD,WAAWnC,YAAY;AAEpD,SAAO+B,WAAW;AAAA,IAChBrC,QAAQA,CAACE,YAAiD;AAC9CA,gBAAAA,QAAQwC,MAChB,GACAxC,QAAQyC,UAAWC,OAAMA,EAAEzC,OAAOqC,eAAgB,CAAA,CACpD;AACA,cAAOlB,6BAAMtB,UAASsB,KAAKtB,OAAOE,OAAO,IAAIA;AAAAA,IAAAA;AAAAA,EAC/C,CACM;AACV;AAEO,SAAS2C,gBAIdvB,MACsD;AAChDkB,QAAAA,iBAAiBlD,MAAMmD,WAAWnC,YAAY;AAEpD,SAAO+B,WAAW;AAAA,IAChBrC,QAAQA,CAACE,YAAiD;AAC9CA,gBAAAA,QAAQwC,MAChBxC,QAAQyC,UAAWC,CAAAA,MAAMA,EAAEzC,OAAOqC,eAAgB,CAAA,IAAI,CACxD;AACA,cAAOlB,6BAAMtB,UAASsB,KAAKtB,OAAOE,OAAO,IAAIA;AAAAA,IAAAA;AAAAA,EAC/C,CACM;AACV;"}
1
+ {"version":3,"file":"Matches.js","sources":["../../src/Matches.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { Match } from './Match'\nimport { SafeFragment } from './SafeFragment'\nimport type {\n AnyRouter,\n DeepPartial,\n MakeOptionalPathParams,\n MakeOptionalSearchParams,\n MakeRouteMatchUnion,\n MaskOptions,\n MatchRouteOptions,\n NoInfer,\n RegisteredRouter,\n ResolveRelativePath,\n ResolveRoute,\n RouteByPath,\n RouterState,\n ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n export interface RouteMatchExtensions {\n meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n }\n}\n\nexport function Matches() {\n const router = useRouter()\n\n const pendingElement = router.options.defaultPendingComponent ? (\n <router.options.defaultPendingComponent />\n ) : null\n\n // Do not render a root Suspense during SSR or hydrating from SSR\n const ResolvedSuspense =\n router.isServer || (typeof document !== 'undefined' && router.clientSsr)\n ? SafeFragment\n : Solid.Suspense\n\n const inner = (\n <ResolvedSuspense fallback={pendingElement}>\n <Transitioner />\n <MatchesInner />\n </ResolvedSuspense>\n )\n\n return router.options.InnerWrap ? (\n <router.options.InnerWrap>{inner}</router.options.InnerWrap>\n ) : (\n inner\n )\n}\n\nfunction MatchesInner() {\n const matchId = useRouterState({\n select: (s) => {\n return s.matches[0]?.id\n },\n })\n\n const resetKey = useRouterState({\n select: (s) => s.loadedAt,\n })\n\n return (\n <matchContext.Provider value={matchId}>\n <CatchBoundary\n getResetKey={() => resetKey()}\n errorComponent={ErrorComponent}\n onCatch={(error) => {\n warning(\n false,\n `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n )\n warning(false, error.message || error.toString())\n }}\n >\n {matchId() ? <Match matchId={matchId()!} /> : null}\n </CatchBoundary>\n </matchContext.Provider>\n )\n}\n\nexport type UseMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n const router = useRouter()\n\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return <\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n >(\n opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n ): Solid.Accessor<\n false | ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']\n > => {\n const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n const matchRoute = Solid.createMemo(() => {\n status()\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n fuzzy,\n includeSearch,\n })\n })\n\n return matchRoute\n }\n}\n\nexport type MakeMatchRouteOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = undefined,\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ((\n params?: RouteByPath<\n TRouter['routeTree'],\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['types']['allParams'],\n ) => Solid.JSX.Element)\n | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n const status = useRouterState({\n select: (s) => s.status,\n })\n\n return (\n <Solid.Show when={status()} keyed>\n {(_) => {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props as any)() as boolean\n\n if (typeof props.children === 'function') {\n return (props.children as any)(params)\n }\n\n return params ? props.children : null\n }}\n </Solid.Show>\n )\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n TRouter extends AnyRouter,\n TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n return useRouterState({\n select: (state: RouterState<TRouter['routeTree']>) => {\n const matches = state.matches\n return opts?.select\n ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n : matches\n },\n } as any) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n 0,\n matches.findIndex((d) => d.id === contextMatchId()),\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n\nexport function useChildMatches<\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n>(\n opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n const contextMatchId = Solid.useContext(matchContext)\n\n return useMatches({\n select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n matches = matches.slice(\n matches.findIndex((d) => d.id === contextMatchId()) + 1,\n )\n return opts?.select ? opts.select(matches) : matches\n },\n } as any)\n}\n"],"names":["Matches","router","useRouter","pendingElement","options","defaultPendingComponent","_$createComponent","ResolvedSuspense","isServer","document","clientSsr","SafeFragment","Solid","Suspense","inner","fallback","children","Transitioner","MatchesInner","InnerWrap","matchId","useRouterState","select","s","matches","id","resetKey","loadedAt","matchContext","Provider","value","CatchBoundary","getResetKey","errorComponent","ErrorComponent","onCatch","error","warning","message","toString","_$memo","Match","useMatchRoute","status","opts","pending","caseSensitive","fuzzy","includeSearch","rest","matchRoute","createMemo","MatchRoute","props","Show","when","keyed","_","params","useMatches","state","useParentMatches","contextMatchId","useContext","slice","findIndex","d","useChildMatches"],"mappings":";;;;;;;;;;AAmCO,SAASA,UAAU;AACxB,QAAMC,SAASC,UAAU;AAEnBC,QAAAA,iBAAiBF,OAAOG,QAAQC,0BAAuBC,gBAC1DL,OAAOG,QAAQC,+BACd;AAGEE,QAAAA,mBACJN,OAAOO,YAAa,OAAOC,aAAa,eAAeR,OAAOS,YAC1DC,eACAC,MAAMC;AAENC,QAAAA,QAAKR,gBACRC,kBAAgB;AAAA,IAACQ,UAAUZ;AAAAA,IAAc,IAAAa,WAAA;AAAA,aAAA,CAAAV,gBACvCW,cAAYX,CAAAA,CAAAA,GAAAA,gBACZY,cAAY,CAAA,CAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAEhB;AAED,SAAOjB,OAAOG,QAAQe,YAASb,gBAC5BL,OAAOG,QAAQe,WAAS;AAAA,IAAAH,UAAEF;AAAAA,EAAK,CAAA,IAEhCA;AAEJ;AAEA,SAASI,eAAe;AACtB,QAAME,UAAUC,eAAe;AAAA,IAC7BC,QAASC,CAAM,MAAA;;AACNA,cAAAA,OAAEC,QAAQ,CAAC,MAAXD,mBAAcE;AAAAA,IAAAA;AAAAA,EAC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ACM;AACV;"}
@@ -1,10 +1,10 @@
1
- import { AnyRouter, RegisteredRouter, Router, RouterOptions } from './router.js';
1
+ import { AnyRouter, RegisteredRouter, RouterOptions } from '@tanstack/router-core';
2
2
  import type * as Solid from 'solid-js';
3
3
  export declare function RouterContextProvider<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>>({ router, children, ...rest }: RouterProps<TRouter, TDehydrated> & {
4
4
  children: () => Solid.JSX.Element;
5
5
  }): Solid.JSX.Element;
6
6
  export declare function RouterProvider<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>>({ router, ...rest }: RouterProps<TRouter, TDehydrated>): Solid.JSX.Element;
7
- export type RouterProps<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>> = Omit<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, TRouter['history'], TDehydrated>, 'context'> & {
8
- router: Router<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, TRouter['history']>;
9
- context?: Partial<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, TRouter['history'], TDehydrated>['context']>;
7
+ export type RouterProps<TRouter extends AnyRouter = RegisteredRouter, TDehydrated extends Record<string, any> = Record<string, any>> = Omit<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, false, TRouter['history'], TDehydrated>, 'context'> & {
8
+ router: TRouter;
9
+ context?: Partial<RouterOptions<TRouter['routeTree'], NonNullable<TRouter['options']['trailingSlash']>, false, TRouter['history'], TDehydrated>['context']>;
10
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RouterProvider.js","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import { Matches } from './Matches'\nimport { getRouterContext } from './routerContext'\nimport type * as Solid from 'solid-js'\nimport type {\n AnyRouter,\n RegisteredRouter,\n Router,\n RouterOptions,\n} from './router'\n\nexport function RouterContextProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n router,\n children,\n ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n children: () => Solid.JSX.Element\n}) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n } as any)\n\n const routerContext = getRouterContext()\n\n const provider = (\n <routerContext.Provider value={router as AnyRouter}>\n {children()}\n </routerContext.Provider>\n )\n\n if (router.options.Wrap) {\n return <router.options.Wrap>{provider}</router.options.Wrap>\n }\n\n return provider\n}\n\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n return (\n <RouterContextProvider router={router} {...rest}>\n {() => <Matches />}\n </RouterContextProvider>\n )\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: Router<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n TRouter['history']\n >\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"names":["RouterContextProvider","router","children","rest","update","options","context","routerContext","getRouterContext","provider","_$createComponent","Provider","value","Wrap","RouterProvider","_$mergeProps","Matches"],"mappings":";;;AAUO,SAASA,sBAGd;AAAA,EACAC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AAGL,GAAG;AAEDF,SAAOG,OAAO;AAAA,IACZ,GAAGH,OAAOI;AAAAA,IACV,GAAGF;AAAAA,IACHG,SAAS;AAAA,MACP,GAAGL,OAAOI,QAAQC;AAAAA,MAClB,GAAGH,KAAKG;AAAAA,IAAAA;AAAAA,EACV,CACM;AAER,QAAMC,gBAAgBC,iBAAiB;AAEjCC,QAAAA,WAAQC,gBACXH,cAAcI,UAAQ;AAAA,IAACC,OAAOX;AAAAA,IAAmB,IAAAC,WAAA;AAAA,aAC/CA,SAAS;AAAA,IAAA;AAAA,EAAC,CAEd;AAEGD,MAAAA,OAAOI,QAAQQ,MAAM;AACvBH,WAAAA,gBAAQT,OAAOI,QAAQQ,MAAI;AAAA,MAAAX,UAAEO;AAAAA,IAAAA,CAAQ;AAAA,EAAA;AAGhCA,SAAAA;AACT;AAEO,SAASK,eAGd;AAAA,EAAEb;AAAAA,EAAQ,GAAGE;AAAwC,GAAG;AACxDO,SAAAA,gBACGV,uBAAqBe,WAAA;AAAA,IAACd;AAAAA,KAAoBE,MAAI;AAAA,IAAAD,UAC5CA,MAAAQ,gBAAOM,SAAO,CAAA,CAAA;AAAA,EAAA,CAAG,CAAA;AAGxB;"}
1
+ {"version":3,"file":"RouterProvider.js","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import { Matches } from './Matches'\nimport { getRouterContext } from './routerContext'\nimport type * as Solid from 'solid-js'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterOptions,\n} from '@tanstack/router-core'\n\nexport function RouterContextProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n router,\n children,\n ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n children: () => Solid.JSX.Element\n}) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n } as any)\n\n const routerContext = getRouterContext()\n\n const provider = (\n <routerContext.Provider value={router as AnyRouter}>\n {children()}\n </routerContext.Provider>\n )\n\n if (router.options.Wrap) {\n return <router.options.Wrap>{provider}</router.options.Wrap>\n }\n\n return provider\n}\n\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n return (\n <RouterContextProvider router={router} {...rest}>\n {() => <Matches />}\n </RouterContextProvider>\n )\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: TRouter\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"names":["RouterContextProvider","router","children","rest","update","options","context","routerContext","getRouterContext","provider","_$createComponent","Provider","value","Wrap","RouterProvider","_$mergeProps","Matches"],"mappings":";;;AASO,SAASA,sBAGd;AAAA,EACAC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AAGL,GAAG;AAEDF,SAAOG,OAAO;AAAA,IACZ,GAAGH,OAAOI;AAAAA,IACV,GAAGF;AAAAA,IACHG,SAAS;AAAA,MACP,GAAGL,OAAOI,QAAQC;AAAAA,MAClB,GAAGH,KAAKG;AAAAA,IAAAA;AAAAA,EACV,CACM;AAER,QAAMC,gBAAgBC,iBAAiB;AAEjCC,QAAAA,WAAQC,gBACXH,cAAcI,UAAQ;AAAA,IAACC,OAAOX;AAAAA,IAAmB,IAAAC,WAAA;AAAA,aAC/CA,SAAS;AAAA,IAAA;AAAA,EAAC,CAEd;AAEGD,MAAAA,OAAOI,QAAQQ,MAAM;AACvBH,WAAAA,gBAAQT,OAAOI,QAAQQ,MAAI;AAAA,MAAAX,UAAEO;AAAAA,IAAAA,CAAQ;AAAA,EAAA;AAGhCA,SAAAA;AACT;AAEO,SAASK,eAGd;AAAA,EAAEb;AAAAA,EAAQ,GAAGE;AAAwC,GAAG;AACxDO,SAAAA,gBACGV,uBAAqBe,WAAA;AAAA,IAACd;AAAAA,KAAoBE,MAAI;AAAA,IAAAD,UAC5CA,MAAAQ,gBAAOM,SAAO,CAAA,CAAA;AAAA,EAAA,CAAG,CAAA;AAGxB;"}
@@ -24,7 +24,7 @@ function Transitioner() {
24
24
  const isPagePending = () => isLoading() || hasPendingMatches();
25
25
  const previousIsPagePending = usePrevious(isPagePending);
26
26
  if (!router.isServer) {
27
- router.startSolidTransition = (fn) => {
27
+ router.startTransition = (fn) => {
28
28
  setIsTransitioning(true);
29
29
  fn();
30
30
  setIsTransitioning(false);
@@ -1 +1 @@
1
- {"version":3,"file":"Transitioner.js","sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport { getLocationChangeInfo, trimPathRight } from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { usePrevious } from './utils'\n\nexport function Transitioner() {\n const router = useRouter()\n let mountLoadForRouter = { router, mounted: false }\n const isLoading = useRouterState({\n select: ({ isLoading }) => isLoading,\n })\n\n const [isTransitioning, setIsTransitioning] = Solid.createSignal(false)\n // Track pending state changes\n const hasPendingMatches = useRouterState({\n select: (s) => s.matches.some((d) => d.status === 'pending'),\n })\n\n const previousIsLoading = usePrevious(isLoading)\n\n const isAnyPending = () =>\n isLoading() || isTransitioning() || hasPendingMatches()\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = () => isLoading() || hasPendingMatches()\n const previousIsPagePending = usePrevious(isPagePending)\n\n if (!router.isServer) {\n router.startSolidTransition = (fn: () => void) => {\n setIsTransitioning(true)\n fn()\n setIsTransitioning(false)\n }\n }\n\n // Subscribe to location changes\n // and try to load the new location\n Solid.onMount(() => {\n const unsub = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n if (\n trimPathRight(router.latestLocation.href) !==\n trimPathRight(nextLocation.href)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n Solid.onCleanup(() => {\n unsub()\n })\n })\n\n // Try to load the initial location\n Solid.createRenderEffect(() => {\n Solid.untrack(() => {\n if (\n (typeof window !== 'undefined' && router.clientSsr) ||\n (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n ) {\n return\n }\n mountLoadForRouter = { router, mounted: true }\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n tryLoad()\n })\n })\n\n Solid.createRenderEffect(\n Solid.on(\n [previousIsLoading, isLoading],\n ([previousIsLoading, isLoading]) => {\n if (previousIsLoading.previous && !isLoading) {\n router.emit({\n type: 'onLoad',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n Solid.createRenderEffect(\n Solid.on(\n [isPagePending, previousIsPagePending],\n ([isPagePending, previousIsPagePending]) => {\n // emit onBeforeRouteMount\n if (previousIsPagePending.previous && !isPagePending) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n\n Solid.createRenderEffect(\n Solid.on(\n [isAnyPending, previousIsAnyPending],\n ([isAnyPending, previousIsAnyPending]) => {\n // The router was pending and now it's not\n if (previousIsAnyPending.previous && !isAnyPending) {\n router.emit({\n type: 'onResolved',\n ...getLocationChangeInfo(router.state),\n })\n\n router.__store.setState((s) => ({\n ...s,\n status: 'idle',\n resolvedLocation: s.location,\n }))\n\n if (\n typeof document !== 'undefined' &&\n (document as any).querySelector\n ) {\n const hashScrollIntoViewOptions =\n router.state.location.state.__hashScrollIntoViewOptions ?? true\n\n if (\n hashScrollIntoViewOptions &&\n router.state.location.hash !== ''\n ) {\n const el = document.getElementById(router.state.location.hash)\n if (el) {\n el.scrollIntoView(hashScrollIntoViewOptions)\n }\n }\n }\n }\n },\n ),\n )\n\n return null\n}\n"],"names":["Transitioner","router","useRouter","mountLoadForRouter","mounted","isLoading","useRouterState","select","isTransitioning","setIsTransitioning","Solid","createSignal","hasPendingMatches","s","matches","some","d","status","previousIsLoading","usePrevious","isAnyPending","previousIsAnyPending","isPagePending","previousIsPagePending","isServer","startSolidTransition","fn","onMount","unsub","history","subscribe","load","nextLocation","buildLocation","to","latestLocation","pathname","search","params","hash","state","_includeValidateSearch","trimPathRight","href","commitLocation","replace","onCleanup","createRenderEffect","untrack","window","clientSsr","tryLoad","err","console","error","on","previous","emit","type","getLocationChangeInfo","__store","setState","resolvedLocation","location","document","querySelector","hashScrollIntoViewOptions","__hashScrollIntoViewOptions","el","getElementById","scrollIntoView"],"mappings":";;;;;AAMO,SAASA,eAAe;AAC7B,QAAMC,SAASC,UAAU;AACzB,MAAIC,qBAAqB;AAAA,IAAEF;AAAAA,IAAQG,SAAS;AAAA,EAAM;AAClD,QAAMC,YAAYC,eAAe;AAAA,IAC/BC,QAAQA,CAAC;AAAA,MAAEF,WAAAA;AAAAA,IAAAA,MAAgBA;AAAAA,EAAAA,CAC5B;AAED,QAAM,CAACG,iBAAiBC,kBAAkB,IAAIC,MAAMC,aAAa,KAAK;AAEtE,QAAMC,oBAAoBN,eAAe;AAAA,IACvCC,QAASM,OAAMA,EAAEC,QAAQC,KAAMC,CAAMA,MAAAA,EAAEC,WAAW,SAAS;AAAA,EAAA,CAC5D;AAEKC,QAAAA,oBAAoBC,YAAYd,SAAS;AAE/C,QAAMe,eAAeA,MACnBf,UAAeG,KAAAA,gBAAAA,KAAqBI,kBAAkB;AAClDS,QAAAA,uBAAuBF,YAAYC,YAAY;AAErD,QAAME,gBAAgBA,MAAMjB,UAAU,KAAKO,kBAAkB;AACvDW,QAAAA,wBAAwBJ,YAAYG,aAAa;AAEnD,MAAA,CAACrB,OAAOuB,UAAU;AACbC,WAAAA,uBAAuB,CAACC,OAAmB;AAChDjB,yBAAmB,IAAI;AACpB,SAAA;AACHA,yBAAmB,KAAK;AAAA,IAC1B;AAAA,EAAA;AAKFC,QAAMiB,QAAQ,MAAM;AAClB,UAAMC,QAAQ3B,OAAO4B,QAAQC,UAAU7B,OAAO8B,IAAI;AAE5CC,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AAEtCA,QAAAA,uBAAsBiC,YAAY,CAAClC,gBAAe;AACpDrB,aAAOwD,KAAK;AAAA,QACVC,MAAM;AAAA,QACN,GAAGC,sBAAsB1D,OAAOuC,KAAK;AAAA,MAAA,CACtC;AAAA,IAAA;AAAA,EACH,CAEJ,CACF;AAEMO,QAAAA,mBACJrC,MAAM6C,GACJ,CAACnC,cAAcC,oBAAoB,GACnC,CAAC,CAACD,eAAcC,qBAAoB,MAAM;AAEpCA,QAAAA,sBAAqBmC,YAAY,CAACpC,eAAc;AAClDnB,aAAOwD,KAAK;AAAA,QACVC,MAAM;AAAA,QACN,GAAGC,sBAAsB1D,OAAOuC,KAAK;AAAA,MAAA,CACtC;AAEMoB,aAAAA,QAAQC,SAAUhD,CAAO,OAAA;AAAA,QAC9B,GAAGA;AAAAA,QACHI,QAAQ;AAAA,QACR6C,kBAAkBjD,EAAEkD;AAAAA,MAAAA,EACpB;AAEF,UACE,OAAOC,aAAa,eACnBA,SAAiBC,eAClB;AACA,cAAMC,4BACJjE,OAAOuC,MAAMuB,SAASvB,MAAM2B,+BAA+B;AAE7D,YACED,6BACAjE,OAAOuC,MAAMuB,SAASxB,SAAS,IAC/B;AACA,gBAAM6B,KAAKJ,SAASK,eAAepE,OAAOuC,MAAMuB,SAASxB,IAAI;AAC7D,cAAI6B,IAAI;AACNA,eAAGE,eAAeJ,yBAAyB;AAAA,UAAA;AAAA,QAC7C;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAEJ,CACF;AAEO,SAAA;AACT;"}
1
+ {"version":3,"file":"Transitioner.js","sources":["../../src/Transitioner.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport { getLocationChangeInfo, trimPathRight } from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport { usePrevious } from './utils'\n\nexport function Transitioner() {\n const router = useRouter()\n let mountLoadForRouter = { router, mounted: false }\n const isLoading = useRouterState({\n select: ({ isLoading }) => isLoading,\n })\n\n const [isTransitioning, setIsTransitioning] = Solid.createSignal(false)\n // Track pending state changes\n const hasPendingMatches = useRouterState({\n select: (s) => s.matches.some((d) => d.status === 'pending'),\n })\n\n const previousIsLoading = usePrevious(isLoading)\n\n const isAnyPending = () =>\n isLoading() || isTransitioning() || hasPendingMatches()\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = () => isLoading() || hasPendingMatches()\n const previousIsPagePending = usePrevious(isPagePending)\n\n if (!router.isServer) {\n router.startTransition = (fn: () => void) => {\n setIsTransitioning(true)\n fn()\n setIsTransitioning(false)\n }\n }\n\n // Subscribe to location changes\n // and try to load the new location\n Solid.onMount(() => {\n const unsub = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n if (\n trimPathRight(router.latestLocation.href) !==\n trimPathRight(nextLocation.href)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n Solid.onCleanup(() => {\n unsub()\n })\n })\n\n // Try to load the initial location\n Solid.createRenderEffect(() => {\n Solid.untrack(() => {\n if (\n (typeof window !== 'undefined' && router.clientSsr) ||\n (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n ) {\n return\n }\n mountLoadForRouter = { router, mounted: true }\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n tryLoad()\n })\n })\n\n Solid.createRenderEffect(\n Solid.on(\n [previousIsLoading, isLoading],\n ([previousIsLoading, isLoading]) => {\n if (previousIsLoading.previous && !isLoading) {\n router.emit({\n type: 'onLoad',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n Solid.createRenderEffect(\n Solid.on(\n [isPagePending, previousIsPagePending],\n ([isPagePending, previousIsPagePending]) => {\n // emit onBeforeRouteMount\n if (previousIsPagePending.previous && !isPagePending) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(router.state),\n })\n }\n },\n ),\n )\n\n Solid.createRenderEffect(\n Solid.on(\n [isAnyPending, previousIsAnyPending],\n ([isAnyPending, previousIsAnyPending]) => {\n // The router was pending and now it's not\n if (previousIsAnyPending.previous && !isAnyPending) {\n router.emit({\n type: 'onResolved',\n ...getLocationChangeInfo(router.state),\n })\n\n router.__store.setState((s) => ({\n ...s,\n status: 'idle',\n resolvedLocation: s.location,\n }))\n\n if (\n typeof document !== 'undefined' &&\n (document as any).querySelector\n ) {\n const hashScrollIntoViewOptions =\n router.state.location.state.__hashScrollIntoViewOptions ?? true\n\n if (\n hashScrollIntoViewOptions &&\n router.state.location.hash !== ''\n ) {\n const el = document.getElementById(router.state.location.hash)\n if (el) {\n el.scrollIntoView(hashScrollIntoViewOptions)\n }\n }\n }\n }\n },\n ),\n )\n\n return null\n}\n"],"names":["Transitioner","router","useRouter","mountLoadForRouter","mounted","isLoading","useRouterState","select","isTransitioning","setIsTransitioning","Solid","createSignal","hasPendingMatches","s","matches","some","d","status","previousIsLoading","usePrevious","isAnyPending","previousIsAnyPending","isPagePending","previousIsPagePending","isServer","startTransition","fn","onMount","unsub","history","subscribe","load","nextLocation","buildLocation","to","latestLocation","pathname","search","params","hash","state","_includeValidateSearch","trimPathRight","href","commitLocation","replace","onCleanup","createRenderEffect","untrack","window","clientSsr","tryLoad","err","console","error","on","previous","emit","type","getLocationChangeInfo","__store","setState","resolvedLocation","location","document","querySelector","hashScrollIntoViewOptions","__hashScrollIntoViewOptions","el","getElementById","scrollIntoView"],"mappings":";;;;;AAMO,SAASA,eAAe;AAC7B,QAAMC,SAASC,UAAU;AACzB,MAAIC,qBAAqB;AAAA,IAAEF;AAAAA,IAAQG,SAAS;AAAA,EAAM;AAClD,QAAMC,YAAYC,eAAe;AAAA,IAC/BC,QAAQA,CAAC;AAAA,MAAEF,WAAAA;AAAAA,IAAAA,MAAgBA;AAAAA,EAAAA,CAC5B;AAED,QAAM,CAACG,iBAAiBC,kBAAkB,IAAIC,MAAMC,aAAa,KAAK;AAEt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AMC,4BACJjE,OAAOuC,MAAMuB,SAASvB,MAAM2B,+BAA+B;AAE7D,YACED,6BACAjE,OAAOuC,MAAMuB,SAASxB,SAAS,IAC/B;AACA,gBAAM6B,KAAKJ,SAASK,eAAepE,OAAOuC,MAAMuB,SAASxB,IAAI;AAC7D,cAAI6B,IAAI;AACNA,eAAGE,eAAeJ,yBAAyB;AAAA,UAAA;AAAA,QAC7C;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAEJ,CACF;AAEO,SAAA;AACT;"}
@@ -1,9 +1,7 @@
1
1
  import { UseParamsRoute } from './useParams.js';
2
2
  import { UseMatchRoute } from './useMatch.js';
3
3
  import { UseSearchRoute } from './useSearch.js';
4
- import { AnyContext, AnyRoute as AnyCoreRoute, AnyPathParams, AnyRouter, AnyValidator, Constrain, ConstrainLiteral, FileBaseRouteOptions, FileRoutesByPath, ResolveParams, RouteById, RouteIds, RouteLoaderFn, UpdatableRouteOptions } from '@tanstack/router-core';
5
- import { AnyRoute, Route, RouteConstraints } from './route.js';
6
- import { RegisteredRouter } from './router.js';
4
+ import { AnyContext, AnyRoute, AnyRouter, Constrain, ConstrainLiteral, FileBaseRouteOptions, FileRoutesByPath, LazyRouteOptions, RegisteredRouter, ResolveParams, Route, RouteById, RouteConstraints, RouteIds, RouteLoaderFn, UpdatableRouteOptions } from '@tanstack/router-core';
7
5
  import { UseLoaderDepsRoute } from './useLoaderDeps.js';
8
6
  import { UseLoaderDataRoute } from './useLoaderData.js';
9
7
  import { UseRouteContextRoute } from './useRouteContext.js';
@@ -18,7 +16,7 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
18
16
  constructor(path: TFilePath, _opts?: {
19
17
  silent: boolean;
20
18
  });
21
- createRoute: <TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options?: FileBaseRouteOptions<TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn> & UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren>;
19
+ createRoute: <TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options?: FileBaseRouteOptions<TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn> & UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown>;
22
20
  }
23
21
  /**
24
22
  @deprecated It's recommended not to split loaders into separate files.
@@ -26,8 +24,7 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
26
24
  `createFileRoute('/path/to/file)(options)` options.
27
25
  */
28
26
  export declare function FileRouteLoader<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(_path: TFilePath): <TLoaderFn>(loaderFn: Constrain<TLoaderFn, RouteLoaderFn<TRoute['parentRoute'], TRoute['types']['id'], TRoute['types']['params'], TRoute['types']['loaderDeps'], TRoute['types']['routerContext'], TRoute['types']['routeContextFn'], TRoute['types']['beforeLoadFn']>>) => TLoaderFn;
29
- export type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, string, AnyPathParams, AnyValidator, {}, AnyContext, AnyContext, AnyContext, AnyContext>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
30
- export declare class LazyRoute<TRoute extends AnyCoreRoute> {
27
+ export declare class LazyRoute<TRoute extends AnyRoute> {
31
28
  options: {
32
29
  id: string;
33
30
  } & LazyRouteOptions;
@@ -42,5 +39,5 @@ export declare class LazyRoute<TRoute extends AnyCoreRoute> {
42
39
  useLoaderData: UseLoaderDataRoute<TRoute['id']>;
43
40
  useNavigate: () => import('@tanstack/router-core').UseNavigateResult<string>;
44
41
  }
45
- export declare function createLazyRoute<TRouter extends AnyRouter = RegisteredRouter, TId extends string = string, TRoute extends AnyCoreRoute = RouteById<TRouter['routeTree'], TId>>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
42
+ export declare function createLazyRoute<TRouter extends AnyRouter = RegisteredRouter, TId extends string = string, TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
46
43
  export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
@@ -1 +1 @@
1
- {"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute as AnyCoreRoute,\n AnyPathParams,\n AnyRouter,\n AnyValidator,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n ResolveParams,\n RouteById,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n} from '@tanstack/router-core'\n\nimport type { AnyRoute, Route, RouteConstraints } from './route'\nimport type { RegisteredRouter } from './router'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\nexport type LazyRouteOptions = Pick<\n UpdatableRouteOptions<\n AnyRoute,\n string,\n string,\n AnyPathParams,\n AnyValidator,\n {},\n AnyContext,\n AnyContext,\n AnyContext,\n AnyContext\n >,\n 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'\n>\n\nexport class LazyRoute<TRoute extends AnyCoreRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.options.id })\n }\n}\n\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyCoreRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath) {\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["opts"],"mappings":";;;;;;;;AAmCO,SAAS,gBAQd,MAC0E;AACnE,SAAA,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EACT,CAAA,EA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Q,IAAW;AAAA,IAChE;AAEA,SAAA,cAAc,MAAM;AAClB,aAAO,YAAY,EAAE,MAAM,KAAK,QAAQ,IAAI;AAAA,IAC9C;AAzCE,SAAK,UAAU;AAAA,EAAA;AA0CnB;AAEO,SAAS,gBAId,IAA2D;AAC3D,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB;AAAA,MAC3B;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;AACO,SAAS,oBAGd,IAAe;AACR,SAAA,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;"}
1
+ {"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.options.id })\n }\n}\n\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath) {\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["opts"],"mappings":";;;;;;;;AAkCO,SAAS,gBAQd,MAC0E;AACnE,SAAA,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EACT,CAAA,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CASZ,YAuCG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MACF;AACM,YAAA,QAAQ,YAAY,OAAc;AACtC,YAAc,SAAS;AAClB,aAAA;AAAA,IACT;AA3DE,SAAK,SAAS,+BAAO;AAAA,EAAA;AA4DzB;AAOO,SAAS,gBAId,OAca;AACb;AAAA,IACE;AAAA,IACA;AAAA,EACF;AACA,SAAO,CAAC,aAAa;AACvB;AAEO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAIF,SAAA,WAAwC,CAACA,UAAS;AAChD,aAAO,SAAS;AAAA,QACd,QAAQA,SAAA,gBAAAA,MAAM;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,kBAAsD,CAACA,UAAS;AAC9D,aAAO,SAAS;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,QAAQ,CAAC,OAAYA,SAAA,gBAAAA,MAAM,UAASA,MAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IACH;AAEA,SAAA,YAA0C,CAACA,UAAS;AAClD,aAAO,UAAU;AAAA,QACf,QAAQA,SAAA,gBAAAA,MAAM;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,YAA0C,CAACA,UAAS;AAClD,aAAO,UAAU;AAAA,QACf,QAAQA,SAAA,gBAAAA,MAAM;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,MAAA,CACb;AAAA,IACV;AAEA,SAAA,gBAAkD,CAACA,UAAS;AACnD,aAAA,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,gBAAkD,CAACA,UAAS;AACnD,aAAA,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAChE;AAEA,SAAA,cAAc,MAAM;AAClB,aAAO,YAAY,EAAE,MAAM,KAAK,QAAQ,IAAI;AAAA,IAC9C;AAzCE,SAAK,UAAU;AAAA,EAAA;AA0CnB;AAEO,SAAS,gBAId,IAA2D;AAC3D,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB;AAAA,MAC3B;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,EACH;AACF;AACO,SAAS,oBAGd,IAAe;AACR,SAAA,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;"}
@@ -2,20 +2,19 @@ export { default as invariant } from 'tiny-invariant';
2
2
  export { default as warning } from 'tiny-warning';
3
3
  export { defer, TSR_DEFERRED_PROMISE, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, parsePathname, interpolatePath, matchPathname, removeBasepath, matchByPath, encode, decode, rootRouteId, defaultSerializeError, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, escapeJSON, // SSR
4
4
  pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, shallow, createControlledPromise, retainSearchParams, stripSearchParams, } from '@tanstack/router-core';
5
- export type { StartSerializer, Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, DeferredPromiseState, DeferredPromise, ParsedLocation, ParsePathParams, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, Segment, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, ParseSplatParams, SplatParams, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, ExtractedEntry, ExtractedStream, ExtractedPromise, StreamState, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, NavigateFn, BuildLocationFn, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, Register, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, AnyRouterWithContext, ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, CommitLocationOptions, MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, FileRouteTypes, FileRoutesByPath, UseNavigateResult, AnyRedirect, Redirect, ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadFn, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, } from '@tanstack/router-core';
5
+ export type { StartSerializer, Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, DeferredPromiseState, DeferredPromise, ParsedLocation, ParsePathParams, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, Segment, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, ParseSplatParams, SplatParams, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, ExtractedEntry, ExtractedStream, ExtractedPromise, StreamState, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, NavigateFn, BuildLocationFn, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, Register, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, AnyRouterWithContext, ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, CommitLocationOptions, MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, FileRouteTypes, FileRoutesByPath, UseNavigateResult, AnyRedirect, Redirect, ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadFn, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, AnyRouteWithContext, LazyRouteOptions, AnyRoute, ResolveFullPath, RouteConstraints, RouterState, ListenerFn, BuildNextOptions, AnyRouter, RegisteredRouter, RouterEvents, RouterEvent, RouterListener, MatchRouteOptions, RouteMask, RouterContextOptions, RouterOptions, RouterConstructorOptions, ControllablePromise, InjectedHtmlEntry, RouterErrorSerializer, } from '@tanstack/router-core';
6
6
  export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
7
7
  export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
8
8
  export { useAwaited, Await } from './awaited.js';
9
9
  export type { AwaitOptions } from './awaited.js';
10
10
  export { CatchBoundary, ErrorComponent } from './CatchBoundary.js';
11
11
  export { FileRoute, createFileRoute, FileRouteLoader, LazyRoute, createLazyRoute, createLazyFileRoute, } from './fileRoute.js';
12
- export type { LazyRouteOptions } from './fileRoute.js';
13
12
  export * from './history.js';
14
13
  export { lazyRouteComponent } from './lazyRouteComponent.js';
15
14
  export { useLinkProps, createLink, Link, linkOptions } from './link.js';
16
15
  export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, } from './link.js';
17
16
  export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches.js';
18
- export type { MatchRouteOptions, UseMatchRouteOptions, MakeMatchRouteOptions, } from './Matches.js';
17
+ export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches.js';
19
18
  export { matchContext } from './matchContext.js';
20
19
  export { Match, Outlet } from './Match.js';
21
20
  export { useMatch } from './useMatch.js';
@@ -23,9 +22,8 @@ export { useLoaderDeps } from './useLoaderDeps.js';
23
22
  export { useLoaderData } from './useLoaderData.js';
24
23
  export { redirect, isRedirect } from './redirects.js';
25
24
  export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.js';
26
- export type { AnyRoute, RouteConstraints, AnyRootRoute, ResolveFullPath, RouteMask, SolidNode, SyncRouteComponent, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, AnyRouteWithContext, } from './route.js';
25
+ export type { AnyRootRoute, SolidNode, SyncRouteComponent, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route.js';
27
26
  export { componentTypes, createRouter, Router, lazyFn, SearchParamError, PathParamError, getInitialRouterState, } from './router.js';
28
- export type { AnyRouter, RegisteredRouter, RouterContextOptions, RouterOptions, RouterErrorSerializer, RouterState, ListenerFn, BuildNextOptions, RouterConstructorOptions, RouterEvents, RouterEvent, RouterListener, ControllablePromise, InjectedHtmlEntry, } from './router.js';
29
27
  export { RouterProvider, RouterContextProvider } from './RouterProvider.js';
30
28
  export type { RouterProps } from './RouterProvider.js';
31
29
  export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration.js';
@@ -1,5 +1,4 @@
1
- import { Constrain, LinkOptions, RoutePaths } from '@tanstack/router-core';
2
- import { AnyRouter, RegisteredRouter } from './router.js';
1
+ import { AnyRouter, Constrain, LinkOptions, RegisteredRouter, RoutePaths } from '@tanstack/router-core';
3
2
  import { ValidateLinkOptions, ValidateLinkOptionsArray } from './typePrimitives.js';
4
3
  import * as Solid from 'solid-js';
5
4
  export declare function useLinkProps<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = string, TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>(options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): Solid.ComponentProps<'a'>;
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","sources":["../../src/link.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\n\nimport { mergeRefs } from '@solid-primitives/refs'\n\nimport {\n deepEqual,\n exactPathTest,\n functionalUpdate,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { Dynamic } from 'solid-js/web'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\n\nimport { useIntersectionObserver } from './utils'\n\nimport { useMatch } from './useMatch'\nimport type {\n Constrain,\n LinkCurrentTargetElement,\n LinkOptions,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Solid.ComponentProps<'a'> {\n const router = useRouter()\n const [isTransitioning, setIsTransitioning] = Solid.createSignal(false)\n let hasRenderFetched = false\n\n const [local, rest] = Solid.splitProps(\n Solid.mergeProps(\n {\n activeProps: () => ({ class: 'active' }),\n inactiveProps: () => ({}),\n },\n options,\n ),\n [\n 'activeProps',\n 'inactiveProps',\n 'activeOptions',\n 'to',\n 'preload',\n 'preloadDelay',\n 'hashScrollIntoView',\n 'replace',\n 'startTransition',\n 'resetScroll',\n 'viewTransition',\n 'children',\n 'target',\n 'disabled',\n 'style',\n 'class',\n 'onClick',\n 'onFocus',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseOver',\n 'onMouseOut',\n 'onTouchStart',\n 'ignoreBlocker',\n ],\n )\n\n // const {\n // // custom props\n // activeProps = () => ({ class: 'active' }),\n // inactiveProps = () => ({}),\n // activeOptions,\n // to,\n // preload: userPreload,\n // preloadDelay: userPreloadDelay,\n // hashScrollIntoView,\n // replace,\n // startTransition,\n // resetScroll,\n // viewTransition,\n // // element props\n // children,\n // target,\n // disabled,\n // style,\n // class,\n // onClick,\n // onFocus,\n // onMouseEnter,\n // onMouseLeave,\n // onTouchStart,\n // ignoreBlocker,\n // ...rest\n // } = options\n\n const [_, propsSafeToSpread] = Solid.splitProps(rest, [\n 'params',\n 'search',\n 'hash',\n 'state',\n 'mask',\n 'reloadDocument',\n ])\n\n // If this link simply reloads the current route,\n // make sure it has a new key so it will trigger a data refresh\n\n // If this `to` is a valid external URL, return\n // null for LinkUtils\n\n const type: Solid.Accessor<'internal' | 'external'> = () => {\n try {\n new URL(`${local.to}`)\n return 'external'\n } catch {}\n return 'internal'\n }\n\n const currentSearch = useRouterState({\n select: (s) => s.location.searchStr,\n })\n\n // In the rare event that the user bypasses type-safety and doesn't supply a `from`\n // we'll use the current route as the `from` location so relative routing works as expected\n const parentRouteId = useMatch({ strict: false, select: (s) => s.pathname })\n\n // Use it as the default `from` location\n options = {\n from: parentRouteId(),\n ...options,\n }\n\n const next = Solid.createMemo(() => {\n currentSearch()\n return router.buildLocation(options as any)\n })\n\n const preload = Solid.createMemo(() => {\n if (options.reloadDocument) {\n return false\n }\n return local.preload ?? router.options.defaultPreload\n })\n const preloadDelay = () =>\n local.preloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n const isActive = useRouterState({\n select: (s) => {\n if (local.activeOptions?.exact) {\n const testExact = exactPathTest(\n s.location.pathname,\n next().pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(\n s.location.pathname,\n router.basepath,\n ).split('/')\n const nextPathSplit = removeTrailingSlash(\n next()?.pathname,\n router.basepath,\n )?.split('/')\n\n const pathIsFuzzyEqual = nextPathSplit?.every(\n (d, i) => d === currentPathSplit[i],\n )\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (local.activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(s.location.search, next().search, {\n partial: !local.activeOptions?.exact,\n ignoreUndefined: !local.activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (local.activeOptions?.includeHash) {\n return s.location.hash === next().hash\n }\n return true\n },\n })\n\n const doPreload = () =>\n router.preloadRoute(options as any).catch((err: any) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n\n const preloadViewportIoCallback = (\n entry: IntersectionObserverEntry | undefined,\n ) => {\n if (entry?.isIntersecting) {\n doPreload()\n }\n }\n\n const [ref, setRef] = Solid.createSignal<Element | null>(null)\n\n useIntersectionObserver(\n ref,\n preloadViewportIoCallback,\n { rootMargin: '100px' },\n { disabled: !!local.disabled || !(preload() === 'viewport') },\n )\n\n Solid.createEffect(() => {\n if (hasRenderFetched) {\n return\n }\n if (!local.disabled && preload() === 'render') {\n doPreload()\n hasRenderFetched = true\n }\n })\n\n if (type() === 'external') {\n return Solid.mergeProps(\n propsSafeToSpread,\n {\n ref,\n get type() {\n return type()\n },\n get href() {\n return local.to\n },\n },\n Solid.splitProps(local, [\n 'children',\n 'target',\n 'disabled',\n 'style',\n 'class',\n 'onClick',\n 'onFocus',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseOut',\n 'onMouseOver',\n 'onTouchStart',\n ])[0],\n ) as any\n }\n\n // The click handler\n const handleClick = (e: MouseEvent) => {\n if (\n !local.disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!local.target || local.target === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n setIsTransitioning(true)\n\n const unsub = router.subscribe('onResolved', () => {\n unsub()\n setIsTransitioning(false)\n })\n\n // All is well? Navigate!\n // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n return router.navigate({\n ...options,\n replace: local.replace,\n resetScroll: local.resetScroll,\n hashScrollIntoView: local.hashScrollIntoView,\n startTransition: local.startTransition,\n viewTransition: local.viewTransition,\n ignoreBlocker: local.ignoreBlocker,\n } as any)\n }\n }\n\n // The click handler\n const handleFocus = (_: MouseEvent) => {\n if (local.disabled) return\n if (preload()) {\n doPreload()\n }\n }\n\n const handleTouchStart = handleFocus\n\n const handleEnter = (e: MouseEvent) => {\n if (local.disabled) return\n const eventTarget = (e.target || {}) as LinkCurrentTargetElement\n\n if (preload()) {\n if (eventTarget.preloadTimeout) {\n return\n }\n\n eventTarget.preloadTimeout = setTimeout(() => {\n eventTarget.preloadTimeout = null\n doPreload()\n }, preloadDelay())\n }\n }\n\n const handleLeave = (e: MouseEvent) => {\n if (local.disabled) return\n const eventTarget = (e.target || {}) as LinkCurrentTargetElement\n\n if (eventTarget.preloadTimeout) {\n clearTimeout(eventTarget.preloadTimeout)\n eventTarget.preloadTimeout = null\n }\n }\n\n /** Call a JSX.EventHandlerUnion with the event. */\n function callHandler<T, TEvent extends Event>(\n event: TEvent & { currentTarget: T; target: Element },\n handler: Solid.JSX.EventHandlerUnion<T, TEvent> | undefined,\n ) {\n if (handler) {\n if (typeof handler === 'function') {\n handler(event)\n } else {\n handler[0](handler[1], event)\n }\n }\n\n return event.defaultPrevented\n }\n\n function composeEventHandlers<T>(\n handlers: Array<Solid.JSX.EventHandlerUnion<T, any> | undefined>,\n ) {\n return (event: any) => {\n for (const handler of handlers) {\n callHandler(event, handler)\n }\n }\n }\n\n // Get the active props\n const resolvedActiveProps: () => Omit<Solid.ComponentProps<'a'>, 'style'> & {\n style?: Solid.JSX.CSSProperties\n } = () =>\n isActive() ? (functionalUpdate(local.activeProps as any, {}) ?? {}) : {}\n\n // Get the inactive props\n const resolvedInactiveProps: () => Omit<\n Solid.ComponentProps<'a'>,\n 'style'\n > & { style?: Solid.JSX.CSSProperties } = () =>\n isActive() ? {} : functionalUpdate(local.inactiveProps, {})\n\n const resolvedClassName = () =>\n [local.class, resolvedActiveProps().class, resolvedInactiveProps().class]\n .filter(Boolean)\n .join(' ')\n\n const resolvedStyle = () => ({\n ...local.style,\n ...resolvedActiveProps().style,\n ...resolvedInactiveProps().style,\n })\n\n const href = Solid.createMemo(() => {\n const nextLocation = next()\n const maskedLocation = nextLocation?.maskedLocation\n\n return options.disabled\n ? undefined\n : maskedLocation\n ? router.history.createHref(maskedLocation.href)\n : router.history.createHref(nextLocation?.href)\n })\n\n return Solid.mergeProps(\n propsSafeToSpread,\n resolvedActiveProps,\n resolvedInactiveProps,\n () => {\n return {\n href: href(),\n ref: mergeRefs(setRef, options.ref),\n onClick: composeEventHandlers([local.onClick, handleClick]),\n onFocus: composeEventHandlers([local.onFocus, handleFocus]),\n onMouseEnter: composeEventHandlers([local.onMouseEnter, handleEnter]),\n onMouseOver: composeEventHandlers([local.onMouseOver, handleEnter]),\n onMouseLeave: composeEventHandlers([local.onMouseLeave, handleLeave]),\n onMouseOut: composeEventHandlers([local.onMouseOut, handleLeave]),\n onTouchStart: composeEventHandlers([\n local.onTouchStart,\n handleTouchStart,\n ]),\n disabled: !!local.disabled,\n target: local.target,\n ...(Object.keys(resolvedStyle).length && { style: resolvedStyle }),\n ...(resolvedClassName() && { class: resolvedClassName() }),\n ...(local.disabled && {\n role: 'link',\n 'aria-disabled': true,\n }),\n ...(isActive() && { 'data-status': 'active', 'aria-current': 'page' }),\n ...(isTransitioning() && { 'data-transitioning': 'transitioning' }),\n }\n },\n ) as any\n}\n\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n Omit<Solid.ComponentProps<'a'>, 'style'> & { style?: Solid.JSX.CSSProperties }\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n LinkComponentSolidProps<TComp> & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | Solid.JSX.Element\n | ((state: {\n isActive: boolean\n isTransitioning: boolean\n }) => Solid.JSX.Element)\n}\n\ntype LinkComponentSolidProps<TComp> = TComp extends Solid.ValidComponent\n ? Omit<Solid.ComponentProps<TComp>, keyof CreateLinkProps>\n : never\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentSolidProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<TComp> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Solid.JSX.Element\n\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => Solid.JSX.Element>,\n): LinkComponent<TComp> {\n return (props) => <Link {...(props as any)} _asChild={Comp} />\n}\n\nexport const Link: LinkComponent<'a'> = (props: any) => {\n const [local, rest] = Solid.splitProps(props, ['_asChild'])\n\n const [_, linkProps] = Solid.splitProps(\n useLinkProps(rest as unknown as any),\n ['type', 'children'],\n )\n\n const children = () =>\n typeof rest.children === 'function'\n ? rest.children({\n get isActive() {\n return (linkProps as any)['data-status'] === 'active'\n },\n })\n : rest.children\n\n return (\n <Dynamic component={local._asChild ? local._asChild : 'a'} {...linkProps}>\n {children}\n </Dynamic>\n )\n}\n\nfunction isCtrlEvent(e: MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n"],"names":["useLinkProps","options","router","useRouter","isTransitioning","setIsTransitioning","Solid","createSignal","hasRenderFetched","local","rest","splitProps","mergeProps","activeProps","class","inactiveProps","_","propsSafeToSpread","type","URL","to","currentSearch","useRouterState","select","s","location","searchStr","parentRouteId","useMatch","strict","pathname","from","next","createMemo","buildLocation","preload","reloadDocument","defaultPreload","preloadDelay","defaultPreloadDelay","isActive","activeOptions","exact","testExact","exactPathTest","basepath","currentPathSplit","removeTrailingSlash","split","nextPathSplit","pathIsFuzzyEqual","every","d","i","includeSearch","searchTest","deepEqual","search","partial","ignoreUndefined","explicitUndefined","includeHash","hash","doPreload","preloadRoute","catch","err","console","warn","preloadWarning","preloadViewportIoCallback","entry","isIntersecting","ref","setRef","useIntersectionObserver","rootMargin","disabled","createEffect","href","handleClick","e","isCtrlEvent","defaultPrevented","target","button","preventDefault","unsub","subscribe","navigate","replace","resetScroll","hashScrollIntoView","startTransition","viewTransition","ignoreBlocker","handleFocus","handleTouchStart","handleEnter","eventTarget","preloadTimeout","setTimeout","handleLeave","clearTimeout","callHandler","event","handler","composeEventHandlers","handlers","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","resolvedClassName","filter","Boolean","join","resolvedStyle","style","nextLocation","maskedLocation","undefined","history","createHref","mergeRefs","onClick","onFocus","onMouseEnter","onMouseOver","onMouseLeave","onMouseOut","onTouchStart","Object","keys","length","role","createLink","Comp","props","_$createComponent","Link","_$mergeProps","_asChild","linkProps","children","Dynamic","component","metaKey","altKey","ctrlKey","shiftKey","linkOptions"],"mappings":";;;;;;;;AA8BO,SAASA,aAOdC,SAC2B;AAC3B,QAAMC,SAASC,UAAU;AACzB,QAAM,CAACC,iBAAiBC,kBAAkB,IAAIC,MAAMC,aAAa,KAAK;AACtE,MAAIC,mBAAmB;AAEvB,QAAM,CAACC,OAAOC,IAAI,IAAIJ,MAAMK,WAC1BL,MAAMM,WACJ;AAAA,IACEC,aAAaA,OAAO;AAAA,MAAEC,OAAO;AAAA,IAAA;AAAA,IAC7BC,eAAeA,OAAO,CAAC;AAAA,EAEzBd,GAAAA,OACF,GACA,CACE,eACA,iBACA,iBACA,MACA,WACA,gBACA,sBACA,WACA,mBACA,eACA,kBACA,YACA,UACA,YACA,SACA,SACA,WACA,WACA,gBACA,gBACA,eACA,cACA,gBACA,eAAe,CAEnB;AA8BA,QAAM,CAACe,GAAGC,iBAAiB,IAAIX,MAAMK,WAAWD,MAAM,CACpD,UACA,UACA,QACA,SACA,QACA,gBAAgB,CACjB;AAQD,QAAMQ,OAAgDA,MAAM;AACtD,QAAA;AACF,UAAIC,IAAI,GAAGV,MAAMW,EAAE,EAAE;AACd,aAAA;AAAA,IAAA,QACD;AAAA,IAAA;AACD,WAAA;AAAA,EACT;AAEA,QAAMC,gBAAgBC,eAAe;AAAA,IACnCC,QAASC,CAAMA,MAAAA,EAAEC,SAASC;AAAAA,EAAAA,CAC3B;AAID,QAAMC,gBAAgBC,SAAS;AAAA,IAAEC,QAAQ;AAAA,IAAON,QAASC,OAAMA,EAAEM;AAAAA,EAAAA,CAAU;AAGjE,YAAA;AAAA,IACRC,MAAMJ,cAAc;AAAA,IACpB,GAAG1B;AAAAA,EACL;AAEM+B,QAAAA,OAAO1B,MAAM2B,WAAW,MAAM;AACpB,kBAAA;AACP/B,WAAAA,OAAOgC,cAAcjC,OAAc;A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AAKqI,aAAa,aACrBrI,KAAKqI,SAAS;AAAA,IACZ,IAAIvG,WAAW;AACLsG,aAAAA,UAAkB,aAAa,MAAM;AAAA,IAAA;AAAA,EAC/C,CACD,IACDpI,KAAKqI;AAEXL,SAAAA,gBACGM,SAAOJ,WAAA;AAAA,IAAA,IAACK,YAAS;AAAExI,aAAAA,MAAMoI,WAAWpI,MAAMoI,WAAW;AAAA,IAAA;AAAA,KAASC,WAAS;AAAA,IAAAC;AAAAA,EAAAA,CAC7D,CAAA;AAGf;AAEA,SAAS7D,YAAYD,GAAe;AAC3B,SAAA,CAAC,EAAEA,EAAEiE,WAAWjE,EAAEkE,UAAUlE,EAAEmE,WAAWnE,EAAEoE;AACpD;AAkBO,MAAMC,cAAmCrJ,CAAY,YAAA;AACnDA,SAAAA;AACT;"}
1
+ {"version":3,"file":"link.js","sources":["../../src/link.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\n\nimport { mergeRefs } from '@solid-primitives/refs'\n\nimport {\n deepEqual,\n exactPathTest,\n functionalUpdate,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { Dynamic } from 'solid-js/web'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\n\nimport { useIntersectionObserver } from './utils'\n\nimport { useMatch } from './useMatch'\nimport type {\n AnyRouter,\n Constrain,\n LinkCurrentTargetElement,\n LinkOptions,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Solid.ComponentProps<'a'> {\n const router = useRouter()\n const [isTransitioning, setIsTransitioning] = Solid.createSignal(false)\n let hasRenderFetched = false\n\n const [local, rest] = Solid.splitProps(\n Solid.mergeProps(\n {\n activeProps: () => ({ class: 'active' }),\n inactiveProps: () => ({}),\n },\n options,\n ),\n [\n 'activeProps',\n 'inactiveProps',\n 'activeOptions',\n 'to',\n 'preload',\n 'preloadDelay',\n 'hashScrollIntoView',\n 'replace',\n 'startTransition',\n 'resetScroll',\n 'viewTransition',\n 'children',\n 'target',\n 'disabled',\n 'style',\n 'class',\n 'onClick',\n 'onFocus',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseOver',\n 'onMouseOut',\n 'onTouchStart',\n 'ignoreBlocker',\n ],\n )\n\n // const {\n // // custom props\n // activeProps = () => ({ class: 'active' }),\n // inactiveProps = () => ({}),\n // activeOptions,\n // to,\n // preload: userPreload,\n // preloadDelay: userPreloadDelay,\n // hashScrollIntoView,\n // replace,\n // startTransition,\n // resetScroll,\n // viewTransition,\n // // element props\n // children,\n // target,\n // disabled,\n // style,\n // class,\n // onClick,\n // onFocus,\n // onMouseEnter,\n // onMouseLeave,\n // onTouchStart,\n // ignoreBlocker,\n // ...rest\n // } = options\n\n const [_, propsSafeToSpread] = Solid.splitProps(rest, [\n 'params',\n 'search',\n 'hash',\n 'state',\n 'mask',\n 'reloadDocument',\n ])\n\n // If this link simply reloads the current route,\n // make sure it has a new key so it will trigger a data refresh\n\n // If this `to` is a valid external URL, return\n // null for LinkUtils\n\n const type: Solid.Accessor<'internal' | 'external'> = () => {\n try {\n new URL(`${local.to}`)\n return 'external'\n } catch {}\n return 'internal'\n }\n\n const currentSearch = useRouterState({\n select: (s) => s.location.searchStr,\n })\n\n // In the rare event that the user bypasses type-safety and doesn't supply a `from`\n // we'll use the current route as the `from` location so relative routing works as expected\n const parentRouteId = useMatch({ strict: false, select: (s) => s.pathname })\n\n // Use it as the default `from` location\n options = {\n from: parentRouteId(),\n ...options,\n }\n\n const next = Solid.createMemo(() => {\n currentSearch()\n return router.buildLocation(options as any)\n })\n\n const preload = Solid.createMemo(() => {\n if (options.reloadDocument) {\n return false\n }\n return local.preload ?? router.options.defaultPreload\n })\n const preloadDelay = () =>\n local.preloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n const isActive = useRouterState({\n select: (s) => {\n if (local.activeOptions?.exact) {\n const testExact = exactPathTest(\n s.location.pathname,\n next().pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(\n s.location.pathname,\n router.basepath,\n ).split('/')\n const nextPathSplit = removeTrailingSlash(\n next()?.pathname,\n router.basepath,\n )?.split('/')\n\n const pathIsFuzzyEqual = nextPathSplit?.every(\n (d, i) => d === currentPathSplit[i],\n )\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (local.activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(s.location.search, next().search, {\n partial: !local.activeOptions?.exact,\n ignoreUndefined: !local.activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (local.activeOptions?.includeHash) {\n return s.location.hash === next().hash\n }\n return true\n },\n })\n\n const doPreload = () =>\n router.preloadRoute(options as any).catch((err: any) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n\n const preloadViewportIoCallback = (\n entry: IntersectionObserverEntry | undefined,\n ) => {\n if (entry?.isIntersecting) {\n doPreload()\n }\n }\n\n const [ref, setRef] = Solid.createSignal<Element | null>(null)\n\n useIntersectionObserver(\n ref,\n preloadViewportIoCallback,\n { rootMargin: '100px' },\n { disabled: !!local.disabled || !(preload() === 'viewport') },\n )\n\n Solid.createEffect(() => {\n if (hasRenderFetched) {\n return\n }\n if (!local.disabled && preload() === 'render') {\n doPreload()\n hasRenderFetched = true\n }\n })\n\n if (type() === 'external') {\n return Solid.mergeProps(\n propsSafeToSpread,\n {\n ref,\n get type() {\n return type()\n },\n get href() {\n return local.to\n },\n },\n Solid.splitProps(local, [\n 'children',\n 'target',\n 'disabled',\n 'style',\n 'class',\n 'onClick',\n 'onFocus',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseOut',\n 'onMouseOver',\n 'onTouchStart',\n ])[0],\n ) as any\n }\n\n // The click handler\n const handleClick = (e: MouseEvent) => {\n if (\n !local.disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!local.target || local.target === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n setIsTransitioning(true)\n\n const unsub = router.subscribe('onResolved', () => {\n unsub()\n setIsTransitioning(false)\n })\n\n // All is well? Navigate!\n // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n return router.navigate({\n ...options,\n replace: local.replace,\n resetScroll: local.resetScroll,\n hashScrollIntoView: local.hashScrollIntoView,\n startTransition: local.startTransition,\n viewTransition: local.viewTransition,\n ignoreBlocker: local.ignoreBlocker,\n } as any)\n }\n }\n\n // The click handler\n const handleFocus = (_: MouseEvent) => {\n if (local.disabled) return\n if (preload()) {\n doPreload()\n }\n }\n\n const handleTouchStart = handleFocus\n\n const handleEnter = (e: MouseEvent) => {\n if (local.disabled) return\n const eventTarget = (e.target || {}) as LinkCurrentTargetElement\n\n if (preload()) {\n if (eventTarget.preloadTimeout) {\n return\n }\n\n eventTarget.preloadTimeout = setTimeout(() => {\n eventTarget.preloadTimeout = null\n doPreload()\n }, preloadDelay())\n }\n }\n\n const handleLeave = (e: MouseEvent) => {\n if (local.disabled) return\n const eventTarget = (e.target || {}) as LinkCurrentTargetElement\n\n if (eventTarget.preloadTimeout) {\n clearTimeout(eventTarget.preloadTimeout)\n eventTarget.preloadTimeout = null\n }\n }\n\n /** Call a JSX.EventHandlerUnion with the event. */\n function callHandler<T, TEvent extends Event>(\n event: TEvent & { currentTarget: T; target: Element },\n handler: Solid.JSX.EventHandlerUnion<T, TEvent> | undefined,\n ) {\n if (handler) {\n if (typeof handler === 'function') {\n handler(event)\n } else {\n handler[0](handler[1], event)\n }\n }\n\n return event.defaultPrevented\n }\n\n function composeEventHandlers<T>(\n handlers: Array<Solid.JSX.EventHandlerUnion<T, any> | undefined>,\n ) {\n return (event: any) => {\n for (const handler of handlers) {\n callHandler(event, handler)\n }\n }\n }\n\n // Get the active props\n const resolvedActiveProps: () => Omit<Solid.ComponentProps<'a'>, 'style'> & {\n style?: Solid.JSX.CSSProperties\n } = () =>\n isActive() ? (functionalUpdate(local.activeProps as any, {}) ?? {}) : {}\n\n // Get the inactive props\n const resolvedInactiveProps: () => Omit<\n Solid.ComponentProps<'a'>,\n 'style'\n > & { style?: Solid.JSX.CSSProperties } = () =>\n isActive() ? {} : functionalUpdate(local.inactiveProps, {})\n\n const resolvedClassName = () =>\n [local.class, resolvedActiveProps().class, resolvedInactiveProps().class]\n .filter(Boolean)\n .join(' ')\n\n const resolvedStyle = () => ({\n ...local.style,\n ...resolvedActiveProps().style,\n ...resolvedInactiveProps().style,\n })\n\n const href = Solid.createMemo(() => {\n const nextLocation = next()\n const maskedLocation = nextLocation?.maskedLocation\n\n return options.disabled\n ? undefined\n : maskedLocation\n ? router.history.createHref(maskedLocation.href)\n : router.history.createHref(nextLocation?.href)\n })\n\n return Solid.mergeProps(\n propsSafeToSpread,\n resolvedActiveProps,\n resolvedInactiveProps,\n () => {\n return {\n href: href(),\n ref: mergeRefs(setRef, options.ref),\n onClick: composeEventHandlers([local.onClick, handleClick]),\n onFocus: composeEventHandlers([local.onFocus, handleFocus]),\n onMouseEnter: composeEventHandlers([local.onMouseEnter, handleEnter]),\n onMouseOver: composeEventHandlers([local.onMouseOver, handleEnter]),\n onMouseLeave: composeEventHandlers([local.onMouseLeave, handleLeave]),\n onMouseOut: composeEventHandlers([local.onMouseOut, handleLeave]),\n onTouchStart: composeEventHandlers([\n local.onTouchStart,\n handleTouchStart,\n ]),\n disabled: !!local.disabled,\n target: local.target,\n ...(Object.keys(resolvedStyle).length && { style: resolvedStyle }),\n ...(resolvedClassName() && { class: resolvedClassName() }),\n ...(local.disabled && {\n role: 'link',\n 'aria-disabled': true,\n }),\n ...(isActive() && { 'data-status': 'active', 'aria-current': 'page' }),\n ...(isTransitioning() && { 'data-transitioning': 'transitioning' }),\n }\n },\n ) as any\n}\n\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n Omit<Solid.ComponentProps<'a'>, 'style'> & { style?: Solid.JSX.CSSProperties }\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n LinkComponentSolidProps<TComp> & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | Solid.JSX.Element\n | ((state: {\n isActive: boolean\n isTransitioning: boolean\n }) => Solid.JSX.Element)\n}\n\ntype LinkComponentSolidProps<TComp> = TComp extends Solid.ValidComponent\n ? Omit<Solid.ComponentProps<TComp>, keyof CreateLinkProps>\n : never\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentSolidProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<TComp> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Solid.JSX.Element\n\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => Solid.JSX.Element>,\n): LinkComponent<TComp> {\n return (props) => <Link {...(props as any)} _asChild={Comp} />\n}\n\nexport const Link: LinkComponent<'a'> = (props: any) => {\n const [local, rest] = Solid.splitProps(props, ['_asChild'])\n\n const [_, linkProps] = Solid.splitProps(\n useLinkProps(rest as unknown as any),\n ['type', 'children'],\n )\n\n const children = () =>\n typeof rest.children === 'function'\n ? rest.children({\n get isActive() {\n return (linkProps as any)['data-status'] === 'active'\n },\n })\n : rest.children\n\n return (\n <Dynamic component={local._asChild ? local._asChild : 'a'} {...linkProps}>\n {children}\n </Dynamic>\n )\n}\n\nfunction isCtrlEvent(e: MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n"],"names":["useLinkProps","options","router","useRouter","isTransitioning","setIsTransitioning","Solid","createSignal","hasRenderFetched","local","rest","splitProps","mergeProps","activeProps","class","inactiveProps","_","propsSafeToSpread","type","URL","to","currentSearch","useRouterState","select","s","location","searchStr","parentRouteId","useMatch","strict","pathname","from","next","createMemo","buildLocation","preload","reloadDocument","defaultPreload","preloadDelay","defaultPreloadDelay","isActive","activeOptions","exact","testExact","exactPathTest","basepath","currentPathSplit","removeTrailingSlash","split","nextPathSplit","pathIsFuzzyEqual","every","d","i","includeSearch","searchTest","deepEqual","search","partial","ignoreUndefined","explicitUndefined","includeHash","hash","doPreload","preloadRoute","catch","err","console","warn","preloadWarning","preloadViewportIoCallback","entry","isIntersecting","ref","setRef","useIntersectionObserver","rootMargin","disabled","createEffect","href","handleClick","e","isCtrlEvent","defaultPrevented","target","button","preventDefault","unsub","subscribe","navigate","replace","resetScroll","hashScrollIntoView","startTransition","viewTransition","ignoreBlocker","handleFocus","handleTouchStart","handleEnter","eventTarget","preloadTimeout","setTimeout","handleLeave","clearTimeout","callHandler","event","handler","composeEventHandlers","handlers","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","resolvedClassName","filter","Boolean","join","resolvedStyle","style","nextLocation","maskedLocation","undefined","history","createHref","mergeRefs","onClick","onFocus","onMouseEnter","onMouseOver","onMouseLeave","onMouseOut","onTouchStart","Object","keys","length","role","createLink","Comp","props","_$createComponent","Link","_$mergeProps","_asChild","linkProps","children","Dynamic","component","metaKey","altKey","ctrlKey","shiftKey","linkOptions"],"mappings":";;;;;;;;AA+BO,SAASA,aAOdC,S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SAAOJ,WAAA;AAAA,IAAA,IAACK,YAAS;AAAExI,aAAAA,MAAMoI,WAAWpI,MAAMoI,WAAW;AAAA,IAAA;AAAA,KAASC,WAAS;AAAA,IAAAC;AAAAA,EAAAA,CAC7D,CAAA;AAGf;AAEA,SAAS7D,YAAYD,GAAe;AAC3B,SAAA,CAAC,EAAEA,EAAEiE,WAAWjE,EAAEkE,UAAUlE,EAAEmE,WAAWnE,EAAEoE;AACpD;AAkBO,MAAMC,cAAmCrJ,CAAY,YAAA;AACnDA,SAAAA;AACT;"}
@@ -1,5 +1,4 @@
1
- import { RegisteredRouter } from './router.js';
2
- import { RouteIds } from '@tanstack/router-core';
1
+ import { RegisteredRouter, RouteIds } from '@tanstack/router-core';
3
2
  import type * as Solid from 'solid-js';
4
3
  export type NotFoundError = {
5
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"not-found.js","sources":["../../src/not-found.tsx"],"sourcesContent":["import { CatchBoundary } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport type * as Solid from 'solid-js'\nimport type { RegisteredRouter } from './router'\nimport type { RouteIds } from '@tanstack/router-core'\n\nexport type NotFoundError = {\n /**\n @deprecated\n Use `routeId: rootRouteId` instead\n */\n global?: boolean\n /**\n @private\n Do not use this. It's used internally to indicate a path matching error\n */\n _global?: boolean\n data?: any\n throw?: boolean\n routeId?: RouteIds<RegisteredRouter['routeTree']>\n headers?: HeadersInit\n}\n\nexport function notFound(options: NotFoundError = {}) {\n ;(options as any).isNotFound = true\n if (options.throw) throw options\n return options\n}\n\nexport function isNotFound(obj: any): obj is NotFoundError {\n return !!obj?.isNotFound\n}\n\nexport function CatchNotFound(props: {\n fallback?: (error: NotFoundError) => Solid.JSX.Element\n onCatch?: (error: Error) => void\n children: Solid.JSX.Element\n}) {\n // TODO: Some way for the user to programmatically reset the not-found boundary?\n const resetKey = useRouterState({\n select: (s) => `not-found-${s.location.pathname}-${s.status}`,\n })\n\n return (\n <CatchBoundary\n getResetKey={() => resetKey()}\n onCatch={(error) => {\n if (isNotFound(error)) {\n props.onCatch?.(error)\n } else {\n throw error\n }\n }}\n errorComponent={({ error }: { error: Error }) => {\n if (isNotFound(error)) {\n return props.fallback?.(error)\n } else {\n throw error\n }\n }}\n >\n {props.children}\n </CatchBoundary>\n )\n}\n\nexport function DefaultGlobalNotFound() {\n return <p>Not Found</p>\n}\n"],"names":["notFound","options","isNotFound","throw","obj","CatchNotFound","props","resetKey","useRouterState","select","s","location","pathname","status","_$createComponent","CatchBoundary","getResetKey","onCatch","error","errorComponent","fallback","children","DefaultGlobalNotFound","_tmpl$"],"mappings":";;;;AAuBgBA,SAAAA,SAASC,UAAyB,IAAI;AAClDA,UAAgBC,aAAa;AAC3BD,MAAAA,QAAQE,MAAaF,OAAAA;AAClBA,SAAAA;AACT;AAEO,SAASC,WAAWE,KAAgC;AAClD,SAAA,CAAC,EAACA,2BAAKF;AAChB;AAEO,SAASG,cAAcC,OAI3B;AAED,QAAMC,WAAWC,eAAe;AAAA,IAC9BC,QAASC,OAAM,aAAaA,EAAEC,SAASC,QAAQ,IAAIF,EAAEG,MAAM;AAAA,EAAA,CAC5D;AAED,SAAAC,gBACGC,eAAa;AAAA,IACZC,aAAaA,MAAMT,SAAS;AAAA,IAC5BU,SAAUC,CAAU,UAAA;;AACdhB,UAAAA,WAAWgB,KAAK,GAAG;AACrBZ,oBAAMW,YAANX,+BAAgBY;AAAAA,MAAK,OAChB;AACCA,cAAAA;AAAAA,MAAAA;AAAAA,IAEV;AAAA,IACAC,gBAAgBA,CAAC;AAAA,MAAED;AAAAA,IAAAA,MAA8B;;AAC3ChB,UAAAA,WAAWgB,KAAK,GAAG;AACdZ,gBAAAA,WAAMc,aAANd,+BAAiBY;AAAAA,MAAK,OACxB;AACCA,cAAAA;AAAAA,MAAAA;AAAAA,IAEV;AAAA,IAAC,IAAAG,WAAA;AAAA,aAEAf,MAAMe;AAAAA,IAAAA;AAAAA,EAAQ,CAAA;AAGrB;AAEO,SAASC,wBAAwB;AACtC,SAAAC,OAAA;AACF;"}
1
+ {"version":3,"file":"not-found.js","sources":["../../src/not-found.tsx"],"sourcesContent":["import { CatchBoundary } from './CatchBoundary'\nimport { useRouterState } from './useRouterState'\nimport type * as Solid from 'solid-js'\nimport type { RegisteredRouter, RouteIds } from '@tanstack/router-core'\n\nexport type NotFoundError = {\n /**\n @deprecated\n Use `routeId: rootRouteId` instead\n */\n global?: boolean\n /**\n @private\n Do not use this. It's used internally to indicate a path matching error\n */\n _global?: boolean\n data?: any\n throw?: boolean\n routeId?: RouteIds<RegisteredRouter['routeTree']>\n headers?: HeadersInit\n}\n\nexport function notFound(options: NotFoundError = {}) {\n ;(options as any).isNotFound = true\n if (options.throw) throw options\n return options\n}\n\nexport function isNotFound(obj: any): obj is NotFoundError {\n return !!obj?.isNotFound\n}\n\nexport function CatchNotFound(props: {\n fallback?: (error: NotFoundError) => Solid.JSX.Element\n onCatch?: (error: Error) => void\n children: Solid.JSX.Element\n}) {\n // TODO: Some way for the user to programmatically reset the not-found boundary?\n const resetKey = useRouterState({\n select: (s) => `not-found-${s.location.pathname}-${s.status}`,\n })\n\n return (\n <CatchBoundary\n getResetKey={() => resetKey()}\n onCatch={(error) => {\n if (isNotFound(error)) {\n props.onCatch?.(error)\n } else {\n throw error\n }\n }}\n errorComponent={({ error }: { error: Error }) => {\n if (isNotFound(error)) {\n return props.fallback?.(error)\n } else {\n throw error\n }\n }}\n >\n {props.children}\n </CatchBoundary>\n )\n}\n\nexport function DefaultGlobalNotFound() {\n return <p>Not Found</p>\n}\n"],"names":["notFound","options","isNotFound","throw","obj","CatchNotFound","props","resetKey","useRouterState","select","s","location","pathname","status","_$createComponent","CatchBoundary","getResetKey","onCatch","error","errorComponent","fallback","children","DefaultGlobalNotFound","_tmpl$"],"mappings":";;;;AAsBgBA,SAAAA,SAASC,UAAyB,IAAI;AAClDA,UAAgBC,aAAa;AAC3BD,MAAAA,QAAQE,MAAaF,OAAAA;AAClBA,SAAAA;AACT;AAEO,SAASC,WAAWE,KAAgC;AAClD,SAAA,CAAC,EAACA,2BAAKF;AAChB;AAEO,SAASG,cAAcC,OAI3B;AAED,QAAMC,WAAWC,eAAe;AAAA,IAC9BC,QAASC,OAAM,aAAaA,EAAEC,SAASC,QAAQ,IAAIF,EAAEG,MAAM;AAAA,EAAA,CAC5D;AAED,SAAAC,gBACGC,eAAa;AAAA,IACZC,aAAaA,MAAMT,SAAS;AAAA,IAC5BU,SAAUC,CAAU,UAAA;;AACdhB,UAAAA,WAAWgB,KAAK,GAAG;AACrBZ,oBAAMW,YAANX,+BAAgBY;AAAAA,MAAK,OAChB;AACCA,cAAAA;AAAAA,MAAAA;AAAAA,IAEV;AAAA,IACAC,gBAAgBA,CAAC;AAAA,MAAED;AAAAA,IAAAA,MAA8B;;AAC3ChB,UAAAA,WAAWgB,KAAK,GAAG;AACdZ,gBAAAA,WAAMc,aAANd,+BAAiBY;AAAAA,MAAK,OACxB;AACCA,cAAAA;AAAAA,MAAAA;AAAAA,IAEV;AAAA,IAAC,IAAAG,WAAA;AAAA,aAEAf,MAAMe;AAAAA,IAAAA;AAAAA,EAAQ,CAAA;AAGrB;AAEO,SAASC,wBAAwB;AACtC,SAAAC,OAAA;AACF;"}
@@ -1,5 +1,4 @@
1
- import { RegisteredRouter } from './router.js';
2
- import { AnyRedirect, Redirect, ResolvedRedirect } from '@tanstack/router-core';
1
+ import { AnyRedirect, Redirect, RegisteredRouter, ResolvedRedirect } from '@tanstack/router-core';
3
2
  export declare function redirect<TRouter extends RegisteredRouter, const TTo extends string | undefined, const TFrom extends string = string, const TMaskFrom extends string = TFrom, const TMaskTo extends string = ''>(opts: Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>;
4
3
  export declare function isRedirect(obj: any): obj is AnyRedirect;
5
4
  export declare function isResolvedRedirect(obj: any): obj is ResolvedRedirect;
@@ -1 +1 @@
1
- {"version":3,"file":"redirects.js","sources":["../../src/redirects.ts"],"sourcesContent":["import type { RegisteredRouter } from './router'\nimport type {\n AnyRedirect,\n Redirect,\n ResolvedRedirect,\n} from '@tanstack/router-core'\n\nexport function redirect<\n TRouter extends RegisteredRouter,\n const TTo extends string | undefined,\n const TFrom extends string = string,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n opts: Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> {\n ;(opts as any).isRedirect = true\n opts.statusCode = opts.statusCode || opts.code || 307\n opts.headers = opts.headers || {}\n if (!opts.reloadDocument) {\n opts.reloadDocument = false\n try {\n new URL(`${opts.href}`)\n opts.reloadDocument = true\n } catch {}\n }\n\n if (opts.throw) {\n throw opts\n }\n\n return opts\n}\n\nexport function isRedirect(obj: any): obj is AnyRedirect {\n return !!obj?.isRedirect\n}\n\nexport function isResolvedRedirect(obj: any): obj is ResolvedRedirect {\n return !!obj?.isRedirect && obj.href\n}\n"],"names":[],"mappings":"AAOO,SAAS,SAOd,MACmD;AACjD,OAAa,aAAa;AAC5B,OAAK,aAAa,KAAK,cAAc,KAAK,QAAQ;AAC7C,OAAA,UAAU,KAAK,WAAW,CAAC;AAC5B,MAAA,CAAC,KAAK,gBAAgB;AACxB,SAAK,iBAAiB;AAClB,QAAA;AACF,UAAI,IAAI,GAAG,KAAK,IAAI,EAAE;AACtB,WAAK,iBAAiB;AAAA,IAAA,QAChB;AAAA,IAAA;AAAA,EAAC;AAGX,MAAI,KAAK,OAAO;AACR,UAAA;AAAA,EAAA;AAGD,SAAA;AACT;AAEO,SAAS,WAAW,KAA8B;AAChD,SAAA,CAAC,EAAC,2BAAK;AAChB;AAEO,SAAS,mBAAmB,KAAmC;AACpE,SAAO,CAAC,EAAC,2BAAK,eAAc,IAAI;AAClC;"}
1
+ {"version":3,"file":"redirects.js","sources":["../../src/redirects.ts"],"sourcesContent":["import type {\n AnyRedirect,\n Redirect,\n RegisteredRouter,\n ResolvedRedirect,\n} from '@tanstack/router-core'\n\nexport function redirect<\n TRouter extends RegisteredRouter,\n const TTo extends string | undefined,\n const TFrom extends string = string,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n opts: Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> {\n ;(opts as any).isRedirect = true\n opts.statusCode = opts.statusCode || opts.code || 307\n opts.headers = opts.headers || {}\n if (!opts.reloadDocument) {\n opts.reloadDocument = false\n try {\n new URL(`${opts.href}`)\n opts.reloadDocument = true\n } catch {}\n }\n\n if (opts.throw) {\n throw opts\n }\n\n return opts\n}\n\nexport function isRedirect(obj: any): obj is AnyRedirect {\n return !!obj?.isRedirect\n}\n\nexport function isResolvedRedirect(obj: any): obj is ResolvedRedirect {\n return !!obj?.isRedirect && obj.href\n}\n"],"names":[],"mappings":"AAOO,SAAS,SAOd,MACmD;AACjD,OAAa,aAAa;AAC5B,OAAK,aAAa,KAAK,cAAc,KAAK,QAAQ;AAC7C,OAAA,UAAU,KAAK,WAAW,CAAC;AAC5B,MAAA,CAAC,KAAK,gBAAgB;AACxB,SAAK,iBAAiB;AAClB,QAAA;AACF,UAAI,IAAI,GAAG,KAAK,IAAI,EAAE;AACtB,WAAK,iBAAiB;AAAA,IAAA,QAChB;AAAA,IAAA;AAAA,EAAC;AAGX,MAAI,KAAK,OAAO;AACR,UAAA;AAAA,EAAA;AAGD,SAAA;AACT;AAEO,SAAS,WAAW,KAA8B;AAChD,SAAA,CAAC,EAAC,2BAAK;AAChB;AAEO,SAAS,mBAAmB,KAAmC;AACpE,SAAO,CAAC,EAAC,2BAAK,eAAc,IAAI;AAClC;"}
@@ -1,3 +1,2 @@
1
- import { AnyRouter } from './router.js';
2
- import { AnyRoute } from './route.js';
1
+ import { AnyRoute, AnyRouter } from '@tanstack/router-core';
3
2
  export declare function renderRouteNotFound(router: AnyRouter, route: AnyRoute, data: any): import("solid-js").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"renderRouteNotFound.js","sources":["../../src/renderRouteNotFound.tsx"],"sourcesContent":["import warning from 'tiny-warning'\nimport { DefaultGlobalNotFound } from './not-found'\nimport type { AnyRouter } from './router'\nimport type { AnyRoute } from './route'\n\nexport function renderRouteNotFound(\n router: AnyRouter,\n route: AnyRoute,\n data: any,\n) {\n if (!route.options.notFoundComponent) {\n if (router.options.defaultNotFoundComponent) {\n return <router.options.defaultNotFoundComponent data={data} />\n }\n\n if (process.env.NODE_ENV === 'development') {\n warning(\n route.options.notFoundComponent,\n `A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<div>Not Found<div>)`,\n )\n }\n\n return <DefaultGlobalNotFound />\n }\n\n return <route.options.notFoundComponent data={data} />\n}\n"],"names":["renderRouteNotFound","router","route","data","options","notFoundComponent","defaultNotFoundComponent","_$createComponent","process","env","NODE_ENV","warning","id","DefaultGlobalNotFound"],"mappings":";;;AAKgBA,SAAAA,oBACdC,QACAC,OACAC,MACA;AACI,MAAA,CAACD,MAAME,QAAQC,mBAAmB;AAChCJ,QAAAA,OAAOG,QAAQE,0BAA0B;AAC3CC,aAAAA,gBAAQN,OAAOG,QAAQE,0BAAwB;AAAA,QAACH;AAAAA,MAAAA,CAAU;AAAA,IAAA;AAGxDK,QAAAA,QAAQC,IAAIC,aAAa,eAAe;AAC1CC,cACET,MAAME,QAAQC,mBACd,yDAAyDH,MAAMU,EAAE,uPACnE;AAAA,IAAA;AAGFL,WAAAA,gBAAQM,uBAAqB,EAAA;AAAA,EAAA;AAG/BN,SAAAA,gBAAQL,MAAME,QAAQC,mBAAiB;AAAA,IAACF;AAAAA,EAAAA,CAAU;AACpD;"}
1
+ {"version":3,"file":"renderRouteNotFound.js","sources":["../../src/renderRouteNotFound.tsx"],"sourcesContent":["import warning from 'tiny-warning'\nimport { DefaultGlobalNotFound } from './not-found'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\nexport function renderRouteNotFound(\n router: AnyRouter,\n route: AnyRoute,\n data: any,\n) {\n if (!route.options.notFoundComponent) {\n if (router.options.defaultNotFoundComponent) {\n return <router.options.defaultNotFoundComponent data={data} />\n }\n\n if (process.env.NODE_ENV === 'development') {\n warning(\n route.options.notFoundComponent,\n `A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<div>Not Found<div>)`,\n )\n }\n\n return <DefaultGlobalNotFound />\n }\n\n return <route.options.notFoundComponent data={data} />\n}\n"],"names":["renderRouteNotFound","router","route","data","options","notFoundComponent","defaultNotFoundComponent","_$createComponent","process","env","NODE_ENV","warning","id","DefaultGlobalNotFound"],"mappings":";;;AAIgBA,SAAAA,oBACdC,QACAC,OACAC,MACA;AACI,MAAA,CAACD,MAAME,QAAQC,mBAAmB;AAChCJ,QAAAA,OAAOG,QAAQE,0BAA0B;AAC3CC,aAAAA,gBAAQN,OAAOG,QAAQE,0BAAwB;AAAA,QAACH;AAAAA,MAAAA,CAAU;AAAA,IAAA;AAGxDK,QAAAA,QAAQC,IAAIC,aAAa,eAAe;AAC1CC,cACET,MAAME,QAAQC,mBACd,yDAAyDH,MAAMU,EAAE,uPACnE;AAAA,IAAA;AAGFL,WAAAA,gBAAQM,uBAAqB,EAAA;AAAA,EAAA;AAG/BN,SAAAA,gBAAQL,MAAME,QAAQC,mBAAiB;AAAA,IAACF;AAAAA,EAAAA,CAAU;AACpD;"}