@tanstack/react-router-devtools 0.0.1-beta.13 → 0.0.1-beta.19
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/packages/react-router-devtools/src/devtools.js +4 -1
- package/build/cjs/packages/react-router-devtools/src/devtools.js.map +1 -1
- package/build/cjs/packages/react-router-devtools/src/utils.js +1 -1
- package/build/cjs/packages/react-router-devtools/src/utils.js.map +1 -1
- package/build/esm/index.js +6 -3
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +2666 -2666
- package/build/types/index.d.ts +3 -3
- package/build/umd/index.development.js +5 -2
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/devtools.tsx +12 -4
- package/src/utils.ts +1 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router-devtools",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.19",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router/",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"sideEffects": false,
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@tanstack/react-router": "0.0.1-beta.
|
|
39
|
+
"@tanstack/react-router": "0.0.1-beta.19",
|
|
40
40
|
"react": ">=16",
|
|
41
41
|
"react-dom": ">=16"
|
|
42
42
|
},
|
package/src/devtools.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Router, last } from '@tanstack/react-router'
|
|
2
|
+
import { Router, last, routerContext, invariant } from '@tanstack/react-router'
|
|
3
3
|
import { formatDistanceStrict } from 'date-fns'
|
|
4
4
|
|
|
5
5
|
import useLocalStorage from './useLocalStorage'
|
|
@@ -56,7 +56,7 @@ interface DevtoolsOptions {
|
|
|
56
56
|
/**
|
|
57
57
|
* A boolean variable indicating if the "lite" version of the library is being used
|
|
58
58
|
*/
|
|
59
|
-
router
|
|
59
|
+
router?: Router<any, any>
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
interface DevtoolsPanelOptions {
|
|
@@ -83,7 +83,7 @@ interface DevtoolsPanelOptions {
|
|
|
83
83
|
/**
|
|
84
84
|
* A boolean variable indicating if the "lite" version of the library is being used
|
|
85
85
|
*/
|
|
86
|
-
router
|
|
86
|
+
router?: Router<any, any>
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
const isServer = typeof window === 'undefined'
|
|
@@ -406,10 +406,18 @@ export const TanStackRouterDevtoolsPanel = React.forwardRef<
|
|
|
406
406
|
isOpen = true,
|
|
407
407
|
setIsOpen,
|
|
408
408
|
handleDragStart,
|
|
409
|
-
router,
|
|
409
|
+
router: userRouter,
|
|
410
410
|
...panelProps
|
|
411
411
|
} = props
|
|
412
412
|
|
|
413
|
+
const routerContextValue = React.useContext(routerContext)
|
|
414
|
+
const router = userRouter ?? routerContextValue?.router
|
|
415
|
+
|
|
416
|
+
invariant(
|
|
417
|
+
router,
|
|
418
|
+
'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.',
|
|
419
|
+
)
|
|
420
|
+
|
|
413
421
|
const rerender = React.useReducer(() => ({}), {})[1]
|
|
414
422
|
|
|
415
423
|
React.useEffect(() => {
|
package/src/utils.ts
CHANGED
|
@@ -26,9 +26,7 @@ type StyledComponent<T> = T extends 'button'
|
|
|
26
26
|
: never
|
|
27
27
|
|
|
28
28
|
export function getStatusColor(match: RouteMatch, theme: Theme) {
|
|
29
|
-
return match.
|
|
30
|
-
? theme.warning
|
|
31
|
-
: match.isFetching
|
|
29
|
+
return match.isFetching
|
|
32
30
|
? theme.active
|
|
33
31
|
: match.status === 'error'
|
|
34
32
|
? theme.danger
|