@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.
Files changed (38) hide show
  1. package/LICENSE +1 -1
  2. package/build/cjs/Explorer.js +10 -8
  3. package/build/cjs/Explorer.js.map +1 -1
  4. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +2 -4
  5. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  6. package/build/cjs/devtools.js +351 -106
  7. package/build/cjs/devtools.js.map +1 -1
  8. package/build/cjs/index.js +1 -3
  9. package/build/cjs/index.js.map +1 -1
  10. package/build/cjs/styledComponents.js +1 -4
  11. package/build/cjs/styledComponents.js.map +1 -1
  12. package/build/cjs/theme.js +10 -16
  13. package/build/cjs/theme.js.map +1 -1
  14. package/build/cjs/useLocalStorage.js +5 -9
  15. package/build/cjs/useLocalStorage.js.map +1 -1
  16. package/build/cjs/useMediaQuery.js +4 -8
  17. package/build/cjs/useMediaQuery.js.map +1 -1
  18. package/build/cjs/utils.js +36 -16
  19. package/build/cjs/utils.js.map +1 -1
  20. package/build/esm/index.js +342 -65
  21. package/build/esm/index.js.map +1 -1
  22. package/build/stats-html.html +3494 -2700
  23. package/build/stats-react.json +393 -147
  24. package/build/types/Explorer.d.ts +10 -4
  25. package/build/types/devtools.d.ts +1 -1
  26. package/build/types/index.d.ts +77 -1
  27. package/build/types/styledComponents.d.ts +3 -3
  28. package/build/types/theme.d.ts +13 -13
  29. package/build/types/utils.d.ts +3 -2
  30. package/build/umd/index.development.js +662 -145
  31. package/build/umd/index.development.js.map +1 -1
  32. package/build/umd/index.production.js +4 -14
  33. package/build/umd/index.production.js.map +1 -1
  34. package/package.json +2 -3
  35. package/src/Explorer.tsx +5 -0
  36. package/src/devtools.tsx +574 -287
  37. package/src/theme.tsx +6 -6
  38. 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: '#0b1521',
5
- backgroundAlt: '#132337',
4
+ background: '#222222',
5
+ backgroundAlt: '#292929',
6
6
  foreground: 'white',
7
- gray: '#3f4e60',
8
- grayAlt: '#222e3e',
7
+ gray: '#444',
8
+ grayAlt: '#444',
9
9
  inputBackgroundColor: '#fff',
10
10
  inputTextColor: '#000',
11
- success: '#00ab52',
11
+ success: '#80cb00',
12
12
  danger: '#ff0085',
13
- active: '#006bff',
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 { AnyRouteMatch, RouteMatch } from '@tanstack/router'
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.state.status === 'pending'
29
+ return match.status === 'pending' || match.isFetching
30
30
  ? theme.active
31
- : match.state.status === 'error'
31
+ : match.status === 'error'
32
32
  ? theme.danger
33
- : match.state.status === 'success'
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)