@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.
@@ -11,7 +11,7 @@
11
11
  import React from 'react';
12
12
  import { Router } from '@tanstack/react-router';
13
13
 
14
- declare type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
14
+ type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
15
15
  interface DevtoolsOptions {
16
16
  /**
17
17
  * Set this true if you want the dev tools to default to being open
@@ -43,7 +43,7 @@ interface DevtoolsOptions {
43
43
  /**
44
44
  * A boolean variable indicating if the "lite" version of the library is being used
45
45
  */
46
- router: Router<any, any>;
46
+ router?: Router<any, any>;
47
47
  }
48
48
  interface DevtoolsPanelOptions {
49
49
  /**
@@ -69,7 +69,7 @@ interface DevtoolsPanelOptions {
69
69
  /**
70
70
  * A boolean variable indicating if the "lite" version of the library is being used
71
71
  */
72
- router: Router<any, any>;
72
+ router?: Router<any, any>;
73
73
  }
74
74
  declare function TanStackRouterDevtools({ initialIsOpen, panelProps, closeButtonProps, toggleButtonProps, position, containerElement: Container, router, }: DevtoolsOptions): React.ReactElement | null;
75
75
  declare const TanStackRouterDevtoolsPanel: React.ForwardRefExoticComponent<DevtoolsPanelOptions & React.RefAttributes<HTMLDivElement>>;
@@ -1017,7 +1017,7 @@
1017
1017
  const _excluded$2 = ["style"];
1018
1018
  const isServer$1 = typeof window === 'undefined';
1019
1019
  function getStatusColor(match, theme) {
1020
- return match.isPending ? theme.warning : match.isFetching ? theme.active : match.status === 'error' ? theme.danger : match.status === 'success' ? theme.success : theme.gray;
1020
+ return match.isFetching ? theme.active : match.status === 'error' ? theme.danger : match.status === 'success' ? theme.success : theme.gray;
1021
1021
  } // export function getQueryStatusLabel(query: Query) {
1022
1022
  // return query.state.isFetching
1023
1023
  // ? 'fetching'
@@ -1681,10 +1681,13 @@
1681
1681
  const {
1682
1682
  isOpen = true,
1683
1683
  handleDragStart,
1684
- router
1684
+ router: userRouter
1685
1685
  } = props,
1686
1686
  panelProps = _objectWithoutPropertiesLoose(props, _excluded4);
1687
1687
 
1688
+ const routerContextValue = React__default["default"].useContext(reactRouter.routerContext);
1689
+ const router = userRouter != null ? userRouter : routerContextValue == null ? void 0 : routerContextValue.router;
1690
+ reactRouter.invariant(router, '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.');
1688
1691
  const rerender = React__default["default"].useReducer(() => ({}), {})[1];
1689
1692
  React__default["default"].useEffect(() => {
1690
1693
  let interval = setInterval(() => {