@tanstack/router-devtools 0.0.1-beta.100 → 0.0.1-beta.102
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.
- package/build/cjs/devtools.js +18 -17
- package/build/cjs/devtools.js.map +1 -1
- package/build/esm/index.js +18 -17
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +118 -118
- package/build/umd/index.development.js +18 -17
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/devtools.tsx +28 -22
package/package.json
CHANGED
package/src/devtools.tsx
CHANGED
|
@@ -412,27 +412,32 @@ function RouteComp({
|
|
|
412
412
|
route,
|
|
413
413
|
isRoot,
|
|
414
414
|
matches,
|
|
415
|
+
activeRouteId,
|
|
416
|
+
setActiveRouteId,
|
|
415
417
|
}: {
|
|
416
418
|
route: AnyRootRoute | AnyRoute
|
|
417
419
|
isRoot?: boolean
|
|
418
420
|
matches: RouteMatch[]
|
|
421
|
+
activeRouteId: string | undefined
|
|
422
|
+
setActiveRouteId: (id: string) => void
|
|
419
423
|
}) {
|
|
420
424
|
const isActive = matches.find((d) => d.route === route)
|
|
421
425
|
return (
|
|
422
426
|
<div>
|
|
423
427
|
<div
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
428
|
+
role="button"
|
|
429
|
+
aria-label={`Open match details for ${route.id}`}
|
|
430
|
+
onClick={() => {
|
|
431
|
+
if (isActive)
|
|
432
|
+
setActiveRouteId(activeRouteId === route.id ? '' : route.id)
|
|
433
|
+
}}
|
|
429
434
|
style={{
|
|
430
435
|
display: 'flex',
|
|
431
436
|
borderBottom: `solid 1px ${theme.grayAlt}`,
|
|
432
|
-
cursor: 'pointer',
|
|
437
|
+
cursor: isActive ? 'pointer' : 'default',
|
|
433
438
|
alignItems: 'center',
|
|
434
|
-
|
|
435
|
-
|
|
439
|
+
background:
|
|
440
|
+
route.id === activeRouteId ? 'rgba(255,255,255,.1)' : undefined,
|
|
436
441
|
}}
|
|
437
442
|
>
|
|
438
443
|
{isRoot ? null : (
|
|
@@ -468,7 +473,13 @@ function RouteComp({
|
|
|
468
473
|
}}
|
|
469
474
|
>
|
|
470
475
|
{(route.children as Route[]).map((r) => (
|
|
471
|
-
<RouteComp
|
|
476
|
+
<RouteComp
|
|
477
|
+
key={r.id}
|
|
478
|
+
route={r}
|
|
479
|
+
matches={matches}
|
|
480
|
+
activeRouteId={activeRouteId}
|
|
481
|
+
setActiveRouteId={setActiveRouteId}
|
|
482
|
+
/>
|
|
472
483
|
))}
|
|
473
484
|
</div>
|
|
474
485
|
) : null}
|
|
@@ -508,15 +519,6 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
508
519
|
'',
|
|
509
520
|
)
|
|
510
521
|
|
|
511
|
-
const [activeMatchId, setActiveMatchId] = useLocalStorage(
|
|
512
|
-
'tanstackRouterDevtoolsActiveMatchId',
|
|
513
|
-
'',
|
|
514
|
-
)
|
|
515
|
-
|
|
516
|
-
React.useEffect(() => {
|
|
517
|
-
setActiveMatchId('')
|
|
518
|
-
}, [activeRouteId])
|
|
519
|
-
|
|
520
522
|
const allMatches: RouteMatch[] = React.useMemo(
|
|
521
523
|
() => [
|
|
522
524
|
...Object.values(router.state.currentMatches),
|
|
@@ -525,9 +527,7 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
525
527
|
[router.state.currentMatches, router.state.pendingMatches],
|
|
526
528
|
)
|
|
527
529
|
|
|
528
|
-
const activeMatch =
|
|
529
|
-
allMatches?.find((d) => d.id === activeMatchId) ||
|
|
530
|
-
allMatches?.find((d) => d.route.id === activeRouteId)
|
|
530
|
+
const activeMatch = allMatches?.find((d) => d.route.id === activeRouteId)
|
|
531
531
|
|
|
532
532
|
const hasSearch = Object.keys(
|
|
533
533
|
last(router.state.currentMatches)?.state.search || {},
|
|
@@ -698,7 +698,13 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
698
698
|
</button>
|
|
699
699
|
</div>
|
|
700
700
|
{!showMatches ? (
|
|
701
|
-
<RouteComp
|
|
701
|
+
<RouteComp
|
|
702
|
+
route={router.routeTree}
|
|
703
|
+
isRoot
|
|
704
|
+
matches={allMatches}
|
|
705
|
+
activeRouteId={activeRouteId}
|
|
706
|
+
setActiveRouteId={setActiveRouteId}
|
|
707
|
+
/>
|
|
702
708
|
) : (
|
|
703
709
|
<div>
|
|
704
710
|
{router.state.currentMatches.map((match, i) => {
|