@tanstack/router-devtools 0.0.1-beta.99 → 1.0.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.
- package/LICENSE +1 -1
- package/build/cjs/Explorer.js +10 -8
- package/build/cjs/Explorer.js.map +1 -1
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +2 -4
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/devtools.js +351 -106
- package/build/cjs/devtools.js.map +1 -1
- package/build/cjs/index.js +1 -3
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/styledComponents.js +1 -4
- package/build/cjs/styledComponents.js.map +1 -1
- package/build/cjs/theme.js +10 -16
- package/build/cjs/theme.js.map +1 -1
- package/build/cjs/useLocalStorage.js +5 -9
- package/build/cjs/useLocalStorage.js.map +1 -1
- package/build/cjs/useMediaQuery.js +4 -8
- package/build/cjs/useMediaQuery.js.map +1 -1
- package/build/cjs/utils.js +36 -16
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +342 -65
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +3494 -2700
- package/build/stats-react.json +393 -147
- package/build/types/Explorer.d.ts +10 -4
- package/build/types/devtools.d.ts +1 -1
- package/build/types/index.d.ts +77 -1
- package/build/types/styledComponents.d.ts +3 -3
- package/build/types/theme.d.ts +13 -13
- package/build/types/utils.d.ts +3 -2
- package/build/umd/index.development.js +662 -145
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +4 -14
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -3
- package/src/Explorer.tsx +5 -0
- package/src/devtools.tsx +574 -287
- package/src/theme.tsx +6 -6
- package/src/utils.ts +14 -4
package/src/theme.tsx
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
export const defaultTheme = {
|
|
4
|
-
background: '#
|
|
5
|
-
backgroundAlt: '#
|
|
4
|
+
background: '#222222',
|
|
5
|
+
backgroundAlt: '#292929',
|
|
6
6
|
foreground: 'white',
|
|
7
|
-
gray: '#
|
|
8
|
-
grayAlt: '#
|
|
7
|
+
gray: '#444',
|
|
8
|
+
grayAlt: '#444',
|
|
9
9
|
inputBackgroundColor: '#fff',
|
|
10
10
|
inputTextColor: '#000',
|
|
11
|
-
success: '#
|
|
11
|
+
success: '#80cb00',
|
|
12
12
|
danger: '#ff0085',
|
|
13
|
-
active: '#
|
|
13
|
+
active: '#0099ff',
|
|
14
14
|
warning: '#ffb200',
|
|
15
15
|
} as const
|
|
16
16
|
|
package/src/utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { AnyRootRoute, AnyRoute, AnyRouteMatch } from '@tanstack/react-router'
|
|
3
3
|
|
|
4
4
|
import { Theme, useTheme } from './theme'
|
|
5
5
|
import useMediaQuery from './useMediaQuery'
|
|
@@ -26,15 +26,25 @@ type StyledComponent<T> = T extends 'button'
|
|
|
26
26
|
: never
|
|
27
27
|
|
|
28
28
|
export function getStatusColor(match: AnyRouteMatch, theme: Theme) {
|
|
29
|
-
return match.
|
|
29
|
+
return match.status === 'pending' || match.isFetching
|
|
30
30
|
? theme.active
|
|
31
|
-
: match.
|
|
31
|
+
: match.status === 'error'
|
|
32
32
|
? theme.danger
|
|
33
|
-
: match.
|
|
33
|
+
: match.status === 'success'
|
|
34
34
|
? theme.success
|
|
35
35
|
: theme.gray
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
export function getRouteStatusColor(
|
|
39
|
+
matches: AnyRouteMatch[],
|
|
40
|
+
route: AnyRoute | AnyRootRoute,
|
|
41
|
+
theme: Theme,
|
|
42
|
+
) {
|
|
43
|
+
const found = matches.find((d) => d.routeId === route.id)
|
|
44
|
+
if (!found) return theme.gray
|
|
45
|
+
return getStatusColor(found, theme)
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
type Styles =
|
|
39
49
|
| React.CSSProperties
|
|
40
50
|
| ((props: Record<string, any>, theme: Theme) => React.CSSProperties)
|