@tanstack/router-devtools-core 1.166.8 → 1.167.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/BaseTanStackRouterDevtoolsPanel-BlI6Kawa.cjs +1998 -0
  2. package/dist/BaseTanStackRouterDevtoolsPanel-BlI6Kawa.cjs.map +1 -0
  3. package/dist/BaseTanStackRouterDevtoolsPanel-DwUaC87U.js +1969 -0
  4. package/dist/BaseTanStackRouterDevtoolsPanel-DwUaC87U.js.map +1 -0
  5. package/dist/FloatingTanStackRouterDevtools-M-UhaKLc.cjs +241 -0
  6. package/dist/FloatingTanStackRouterDevtools-M-UhaKLc.cjs.map +1 -0
  7. package/dist/FloatingTanStackRouterDevtools-U4pxMObm.js +240 -0
  8. package/dist/FloatingTanStackRouterDevtools-U4pxMObm.js.map +1 -0
  9. package/dist/cjs/index.cjs +170 -5
  10. package/dist/cjs/index.cjs.map +1 -1
  11. package/dist/context-D56_tqst.js +1749 -0
  12. package/dist/context-D56_tqst.js.map +1 -0
  13. package/dist/context-DZa5WwQ_.cjs +1916 -0
  14. package/dist/context-DZa5WwQ_.cjs.map +1 -0
  15. package/dist/esm/index.js +168 -5
  16. package/dist/esm/index.js.map +1 -1
  17. package/package.json +2 -2
  18. package/src/BaseTanStackRouterDevtoolsPanel.tsx +59 -14
  19. package/dist/BaseTanStackRouterDevtoolsPanel-BgiCKo12.cjs +0 -1936
  20. package/dist/BaseTanStackRouterDevtoolsPanel-BgiCKo12.cjs.map +0 -1
  21. package/dist/BaseTanStackRouterDevtoolsPanel-Bmws3ikM.js +0 -1920
  22. package/dist/BaseTanStackRouterDevtoolsPanel-Bmws3ikM.js.map +0 -1
  23. package/dist/FloatingTanStackRouterDevtools-B7vy70jP.js +0 -281
  24. package/dist/FloatingTanStackRouterDevtools-B7vy70jP.js.map +0 -1
  25. package/dist/FloatingTanStackRouterDevtools-C-LyXpEh.cjs +0 -281
  26. package/dist/FloatingTanStackRouterDevtools-C-LyXpEh.cjs.map +0 -1
  27. package/dist/index-BoYu2KZp.cjs +0 -1822
  28. package/dist/index-BoYu2KZp.cjs.map +0 -1
  29. package/dist/index-DQ3FiKl6.js +0 -1823
  30. package/dist/index-DQ3FiKl6.js.map +0 -1
@@ -102,6 +102,7 @@ function NavigateLink(props: {
102
102
 
103
103
  function RouteComp({
104
104
  routerState,
105
+ pendingMatches,
105
106
  router,
106
107
  route,
107
108
  isRoot,
@@ -133,6 +134,7 @@ function RouteComp({
133
134
  MakeRouteMatchUnion
134
135
  >
135
136
  >
137
+ pendingMatches: Accessor<Array<AnyRouteMatch>>
136
138
  router: Accessor<AnyRouter>
137
139
  route: AnyRoute
138
140
  isRoot?: boolean
@@ -140,8 +142,8 @@ function RouteComp({
140
142
  setActiveId: (id: string) => void
141
143
  }) {
142
144
  const styles = useStyles()
143
- const matches = createMemo(
144
- () => routerState().pendingMatches || routerState().matches,
145
+ const matches = createMemo(() =>
146
+ pendingMatches().length ? pendingMatches() : routerState().matches,
145
147
  )
146
148
  const match = createMemo(() =>
147
149
  routerState().matches.find((d) => d.routeId === route.id),
@@ -231,6 +233,7 @@ function RouteComp({
231
233
  .map((r) => (
232
234
  <RouteComp
233
235
  routerState={routerState}
236
+ pendingMatches={pendingMatches}
234
237
  router={router}
235
238
  route={r}
236
239
  activeId={activeId}
@@ -266,7 +269,7 @@ export const BaseTanStackRouterDevtoolsPanel =
266
269
  'No router was found for the TanStack Router Devtools. Please place the devtools in the <RouterProvider> component tree or pass the router instance to the devtools manually.',
267
270
  )
268
271
 
269
- // useStore(router.__store)
272
+ // useStore(router.stores.__store)
270
273
 
271
274
  const [currentTab, setCurrentTab] = useLocalStorage<
272
275
  'routes' | 'matches' | 'history'
@@ -280,6 +283,49 @@ export const BaseTanStackRouterDevtoolsPanel =
280
283
  const [history, setHistory] = createSignal<Array<AnyRouteMatch>>([])
281
284
  const [hasHistoryOverflowed, setHasHistoryOverflowed] = createSignal(false)
282
285
 
286
+ let pendingMatches: Accessor<Array<AnyRouteMatch>>
287
+ let cachedMatches: Accessor<Array<AnyRouteMatch>>
288
+ // subscribable implementation
289
+ if ('subscribe' in router().stores.pendingMatchesSnapshot) {
290
+ const [_pendingMatches, setPendingMatches] = createSignal<
291
+ Array<AnyRouteMatch>
292
+ >([])
293
+ pendingMatches = _pendingMatches
294
+
295
+ const [_cachedMatches, setCachedMatches] = createSignal<
296
+ Array<AnyRouteMatch>
297
+ >([])
298
+ cachedMatches = _cachedMatches
299
+
300
+ type Subscribe = (fn: () => void) => { unsubscribe: () => void }
301
+ createEffect(() => {
302
+ const pendingMatchesStore = router().stores.pendingMatchesSnapshot
303
+ setPendingMatches(pendingMatchesStore.state)
304
+ const subscription = (
305
+ (pendingMatchesStore as any).subscribe as Subscribe
306
+ )(() => {
307
+ setPendingMatches(pendingMatchesStore.state)
308
+ })
309
+ onCleanup(() => subscription.unsubscribe())
310
+ })
311
+
312
+ createEffect(() => {
313
+ const cachedMatchesStore = router().stores.cachedMatchesSnapshot
314
+ setCachedMatches(cachedMatchesStore.state)
315
+ const subscription = (
316
+ (cachedMatchesStore as any).subscribe as Subscribe
317
+ )(() => {
318
+ setCachedMatches(cachedMatchesStore.state)
319
+ })
320
+ onCleanup(() => subscription.unsubscribe())
321
+ })
322
+ }
323
+ // signal implementation
324
+ else {
325
+ pendingMatches = () => router().stores.pendingMatchesSnapshot.state
326
+ cachedMatches = () => router().stores.cachedMatchesSnapshot.state
327
+ }
328
+
283
329
  createEffect(() => {
284
330
  const matches = routerState().matches
285
331
  const currentMatch = matches[matches.length - 1]
@@ -309,9 +355,9 @@ export const BaseTanStackRouterDevtoolsPanel =
309
355
 
310
356
  const activeMatch = createMemo(() => {
311
357
  const matches = [
312
- ...(routerState().pendingMatches ?? []),
358
+ ...pendingMatches(),
313
359
  ...routerState().matches,
314
- ...routerState().cachedMatches,
360
+ ...cachedMatches(),
315
361
  ]
316
362
  return matches.find(
317
363
  (d) => d.routeId === activeId() || d.id === activeId(),
@@ -348,7 +394,7 @@ export const BaseTanStackRouterDevtoolsPanel =
348
394
  (d) =>
349
395
  typeof d[1] !== 'function' &&
350
396
  ![
351
- '__store',
397
+ 'stores',
352
398
  'basepath',
353
399
  'injectedHtml',
354
400
  'subscribers',
@@ -512,6 +558,7 @@ export const BaseTanStackRouterDevtoolsPanel =
512
558
  <Match when={currentTab() === 'routes'}>
513
559
  <RouteComp
514
560
  routerState={routerState}
561
+ pendingMatches={pendingMatches}
515
562
  router={router}
516
563
  route={router().routeTree}
517
564
  isRoot
@@ -521,10 +568,10 @@ export const BaseTanStackRouterDevtoolsPanel =
521
568
  </Match>
522
569
  <Match when={currentTab() === 'matches'}>
523
570
  <div>
524
- {(routerState().pendingMatches?.length
525
- ? routerState().pendingMatches
571
+ {(pendingMatches().length
572
+ ? pendingMatches()
526
573
  : routerState().matches
527
- )?.map((match: any, _i: any) => {
574
+ ).map((match: any, _i: any) => {
528
575
  return (
529
576
  <div
530
577
  role="button"
@@ -608,7 +655,7 @@ export const BaseTanStackRouterDevtoolsPanel =
608
655
  </Switch>
609
656
  </div>
610
657
  </div>
611
- {routerState().cachedMatches.length ? (
658
+ {cachedMatches().length ? (
612
659
  <div class={styles().cachedMatchesContainer}>
613
660
  <div class={styles().detailsHeader}>
614
661
  <div>Cached Matches</div>
@@ -617,7 +664,7 @@ export const BaseTanStackRouterDevtoolsPanel =
617
664
  </div>
618
665
  </div>
619
666
  <div>
620
- {routerState().cachedMatches.map((match: any) => {
667
+ {cachedMatches().map((match: any) => {
621
668
  return (
622
669
  <div
623
670
  role="button"
@@ -679,9 +726,7 @@ export const BaseTanStackRouterDevtoolsPanel =
679
726
  <div class={styles().matchDetailsInfoLabel}>
680
727
  <div>State:</div>
681
728
  <div class={styles().matchDetailsInfo}>
682
- {routerState().pendingMatches?.find(
683
- (d: any) => d.id === activeMatch()?.id,
684
- )
729
+ {pendingMatches().find((d) => d.id === activeMatch()?.id)
685
730
  ? 'Pending'
686
731
  : routerState().matches.find(
687
732
  (d: any) => d.id === activeMatch()?.id,