@tanstack/router-devtools 0.0.1-beta.203 → 0.0.1-beta.205
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 +16 -62
- package/build/cjs/devtools.js.map +1 -1
- package/build/cjs/utils.js +1 -2
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +18 -64
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +115 -223
- package/build/types/utils.d.ts +2 -2
- package/build/umd/index.development.js +45 -123
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -23
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/devtools.tsx +17 -21
- package/src/utils.ts +1 -9
package/build/esm/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import React__default from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { useRouter, invariant, trimPath } from '@tanstack/react-router';
|
|
14
14
|
|
|
15
15
|
function _extends() {
|
|
16
16
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -127,7 +127,7 @@ function useMediaQuery(query) {
|
|
|
127
127
|
|
|
128
128
|
const isServer$1 = typeof window === 'undefined';
|
|
129
129
|
function getStatusColor(match, theme) {
|
|
130
|
-
return match.status === 'pending' || match.isFetching ? theme.active :
|
|
130
|
+
return match.status === 'pending' || match.isFetching ? theme.active : match.status === 'error' ? theme.danger : match.status === 'success' ? theme.success : theme.gray;
|
|
131
131
|
}
|
|
132
132
|
function getRouteStatusColor(matches, route, theme) {
|
|
133
133
|
const found = matches.find(d => d.routeId === route.id);
|
|
@@ -681,13 +681,13 @@ function TanStackRouterDevtools({
|
|
|
681
681
|
function RouteComp({
|
|
682
682
|
route,
|
|
683
683
|
isRoot,
|
|
684
|
-
router,
|
|
685
684
|
activeRouteId,
|
|
686
685
|
activeMatchId,
|
|
687
686
|
setActiveRouteId,
|
|
688
687
|
setActiveMatchId
|
|
689
688
|
}) {
|
|
690
|
-
const
|
|
689
|
+
const router = useRouter();
|
|
690
|
+
const matches = [...router.state.pendingMatches, ...router.state.matches];
|
|
691
691
|
const match = router.state.matches.find(d => d.routeId === route.id);
|
|
692
692
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
|
|
693
693
|
role: "button",
|
|
@@ -743,7 +743,6 @@ function RouteComp({
|
|
|
743
743
|
}).map(r => /*#__PURE__*/React__default.createElement(RouteComp, {
|
|
744
744
|
key: r.id,
|
|
745
745
|
route: r,
|
|
746
|
-
router: router,
|
|
747
746
|
activeRouteId: activeRouteId,
|
|
748
747
|
activeMatchId: activeMatchId,
|
|
749
748
|
setActiveRouteId: setActiveRouteId,
|
|
@@ -758,18 +757,24 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
758
757
|
router: userRouter,
|
|
759
758
|
...panelProps
|
|
760
759
|
} = props;
|
|
761
|
-
const
|
|
762
|
-
const
|
|
760
|
+
const router = useRouter();
|
|
761
|
+
const matches = [...router.state.pendingMatches, ...router.state.matches];
|
|
763
762
|
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.');
|
|
764
|
-
|
|
763
|
+
|
|
764
|
+
// useStore(router.__store)
|
|
765
|
+
|
|
765
766
|
const [showMatches, setShowMatches] = useLocalStorage('tanstackRouterDevtoolsShowMatches', true);
|
|
766
767
|
const [activeRouteId, setActiveRouteId] = useLocalStorage('tanstackRouterDevtoolsActiveRouteId', '');
|
|
767
768
|
const [activeMatchId, setActiveMatchId] = useLocalStorage('tanstackRouterDevtoolsActiveMatchId', '');
|
|
768
|
-
const activeMatch = React__default.useMemo(() =>
|
|
769
|
+
const activeMatch = React__default.useMemo(() => matches.find(d => d.id === activeRouteId) || matches.find(d => d.id === activeMatchId), [activeRouteId, activeMatchId]);
|
|
769
770
|
const hasSearch = Object.keys(router.state.location.search || {}).length;
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
771
|
+
|
|
772
|
+
// const preloadMatches = matches.filter((match) => {
|
|
773
|
+
// return (
|
|
774
|
+
// !state.matchIds.includes(match.id) &&
|
|
775
|
+
// !state.pendingMatchIds.includes(match.id)
|
|
776
|
+
// )
|
|
777
|
+
// })
|
|
773
778
|
|
|
774
779
|
// React.useEffect(() => {
|
|
775
780
|
// const interval = setInterval(() => {
|
|
@@ -983,7 +988,6 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
983
988
|
}
|
|
984
989
|
}, "Matches")), !showMatches ? /*#__PURE__*/React__default.createElement(RouteComp, {
|
|
985
990
|
route: router.routeTree,
|
|
986
|
-
router: router,
|
|
987
991
|
isRoot: true,
|
|
988
992
|
activeRouteId: activeRouteId,
|
|
989
993
|
activeMatchId: activeMatchId,
|
|
@@ -1021,57 +1025,7 @@ const TanStackRouterDevtoolsPanel = /*#__PURE__*/React__default.forwardRef(funct
|
|
|
1021
1025
|
fontSize: '0.7rem'
|
|
1022
1026
|
}
|
|
1023
1027
|
}, `${match.id}`));
|
|
1024
|
-
}))),
|
|
1025
|
-
style: {
|
|
1026
|
-
flex: '1 1 auto',
|
|
1027
|
-
overflowY: 'auto',
|
|
1028
|
-
maxHeight: '50%'
|
|
1029
|
-
}
|
|
1030
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1031
|
-
style: {
|
|
1032
|
-
padding: '.5em',
|
|
1033
|
-
background: defaultTheme.backgroundAlt,
|
|
1034
|
-
position: 'sticky',
|
|
1035
|
-
top: 0,
|
|
1036
|
-
zIndex: 1,
|
|
1037
|
-
display: 'flex',
|
|
1038
|
-
alignItems: 'center',
|
|
1039
|
-
gap: '.5rem',
|
|
1040
|
-
fontWeight: 'bold'
|
|
1041
|
-
}
|
|
1042
|
-
}, "Preloaded Matches"), preloadMatches.map(match => {
|
|
1043
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
1044
|
-
key: match.id,
|
|
1045
|
-
role: "button",
|
|
1046
|
-
"aria-label": `Open match details for ${match.routeId}`,
|
|
1047
|
-
onClick: () => setActiveMatchId(activeMatchId === match.id ? '' : match.id),
|
|
1048
|
-
style: {
|
|
1049
|
-
display: 'flex',
|
|
1050
|
-
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
1051
|
-
cursor: 'pointer',
|
|
1052
|
-
alignItems: 'center',
|
|
1053
|
-
background: match === activeMatch ? 'rgba(255,255,255,.1)' : undefined
|
|
1054
|
-
}
|
|
1055
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1056
|
-
style: {
|
|
1057
|
-
flex: '0 0 auto',
|
|
1058
|
-
width: '1.3rem',
|
|
1059
|
-
height: '1.3rem',
|
|
1060
|
-
marginLeft: '.25rem',
|
|
1061
|
-
background: getStatusColor(match, defaultTheme),
|
|
1062
|
-
alignItems: 'center',
|
|
1063
|
-
justifyContent: 'center',
|
|
1064
|
-
fontWeight: 'bold',
|
|
1065
|
-
borderRadius: '.25rem',
|
|
1066
|
-
transition: 'all .2s ease-out'
|
|
1067
|
-
}
|
|
1068
|
-
}), /*#__PURE__*/React__default.createElement(Code, {
|
|
1069
|
-
style: {
|
|
1070
|
-
padding: '.5em',
|
|
1071
|
-
fontSize: '0.7rem'
|
|
1072
|
-
}
|
|
1073
|
-
}, `${match.id}`));
|
|
1074
|
-
})) : null), activeMatch ? /*#__PURE__*/React__default.createElement(ActivePanel, null, /*#__PURE__*/React__default.createElement("div", {
|
|
1028
|
+
})))), activeMatch ? /*#__PURE__*/React__default.createElement(ActivePanel, null, /*#__PURE__*/React__default.createElement("div", {
|
|
1075
1029
|
style: {
|
|
1076
1030
|
padding: '.5em',
|
|
1077
1031
|
background: defaultTheme.backgroundAlt,
|