@tanstack/router-devtools 1.112.18 → 1.114.1

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 (91) hide show
  1. package/dist/cjs/index.cjs +12 -4
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +2 -2
  4. package/dist/esm/index.d.ts +2 -2
  5. package/dist/esm/index.js +6 -4
  6. package/dist/esm/index.js.map +1 -1
  7. package/package.json +4 -3
  8. package/src/index.tsx +6 -2
  9. package/dist/cjs/AgeTicker.cjs +0 -58
  10. package/dist/cjs/AgeTicker.cjs.map +0 -1
  11. package/dist/cjs/AgeTicker.d.cts +0 -5
  12. package/dist/cjs/BaseTanStackRouterDevtoolsPanel.cjs +0 -421
  13. package/dist/cjs/BaseTanStackRouterDevtoolsPanel.cjs.map +0 -1
  14. package/dist/cjs/BaseTanStackRouterDevtoolsPanel.d.cts +0 -3
  15. package/dist/cjs/Explorer.cjs +0 -310
  16. package/dist/cjs/Explorer.cjs.map +0 -1
  17. package/dist/cjs/Explorer.d.cts +0 -46
  18. package/dist/cjs/TanStackRouterDevtools.cjs +0 -177
  19. package/dist/cjs/TanStackRouterDevtools.cjs.map +0 -1
  20. package/dist/cjs/TanStackRouterDevtools.d.cts +0 -41
  21. package/dist/cjs/TanStackRouterDevtoolsPanel.cjs +0 -21
  22. package/dist/cjs/TanStackRouterDevtoolsPanel.cjs.map +0 -1
  23. package/dist/cjs/TanStackRouterDevtoolsPanel.d.cts +0 -33
  24. package/dist/cjs/context.cjs +0 -18
  25. package/dist/cjs/context.cjs.map +0 -1
  26. package/dist/cjs/context.d.cts +0 -8
  27. package/dist/cjs/logo.cjs +0 -1012
  28. package/dist/cjs/logo.cjs.map +0 -1
  29. package/dist/cjs/logo.d.cts +0 -1
  30. package/dist/cjs/theme.d.cts +0 -34
  31. package/dist/cjs/tokens.cjs +0 -201
  32. package/dist/cjs/tokens.cjs.map +0 -1
  33. package/dist/cjs/tokens.d.cts +0 -298
  34. package/dist/cjs/useLocalStorage.cjs +0 -45
  35. package/dist/cjs/useLocalStorage.cjs.map +0 -1
  36. package/dist/cjs/useLocalStorage.d.cts +0 -1
  37. package/dist/cjs/useMediaQuery.d.cts +0 -1
  38. package/dist/cjs/useStyles.cjs +0 -570
  39. package/dist/cjs/useStyles.cjs.map +0 -1
  40. package/dist/cjs/useStyles.d.cts +0 -52
  41. package/dist/cjs/utils.cjs +0 -84
  42. package/dist/cjs/utils.cjs.map +0 -1
  43. package/dist/cjs/utils.d.cts +0 -23
  44. package/dist/esm/AgeTicker.d.ts +0 -5
  45. package/dist/esm/AgeTicker.js +0 -58
  46. package/dist/esm/AgeTicker.js.map +0 -1
  47. package/dist/esm/BaseTanStackRouterDevtoolsPanel.d.ts +0 -3
  48. package/dist/esm/BaseTanStackRouterDevtoolsPanel.js +0 -421
  49. package/dist/esm/BaseTanStackRouterDevtoolsPanel.js.map +0 -1
  50. package/dist/esm/Explorer.d.ts +0 -46
  51. package/dist/esm/Explorer.js +0 -292
  52. package/dist/esm/Explorer.js.map +0 -1
  53. package/dist/esm/TanStackRouterDevtools.d.ts +0 -41
  54. package/dist/esm/TanStackRouterDevtools.js +0 -177
  55. package/dist/esm/TanStackRouterDevtools.js.map +0 -1
  56. package/dist/esm/TanStackRouterDevtoolsPanel.d.ts +0 -33
  57. package/dist/esm/TanStackRouterDevtoolsPanel.js +0 -21
  58. package/dist/esm/TanStackRouterDevtoolsPanel.js.map +0 -1
  59. package/dist/esm/context.d.ts +0 -8
  60. package/dist/esm/context.js +0 -18
  61. package/dist/esm/context.js.map +0 -1
  62. package/dist/esm/logo.d.ts +0 -1
  63. package/dist/esm/logo.js +0 -1012
  64. package/dist/esm/logo.js.map +0 -1
  65. package/dist/esm/theme.d.ts +0 -34
  66. package/dist/esm/tokens.d.ts +0 -298
  67. package/dist/esm/tokens.js +0 -201
  68. package/dist/esm/tokens.js.map +0 -1
  69. package/dist/esm/useLocalStorage.d.ts +0 -1
  70. package/dist/esm/useLocalStorage.js +0 -46
  71. package/dist/esm/useLocalStorage.js.map +0 -1
  72. package/dist/esm/useMediaQuery.d.ts +0 -1
  73. package/dist/esm/useStyles.d.ts +0 -52
  74. package/dist/esm/useStyles.js +0 -553
  75. package/dist/esm/useStyles.js.map +0 -1
  76. package/dist/esm/utils.d.ts +0 -23
  77. package/dist/esm/utils.js +0 -84
  78. package/dist/esm/utils.js.map +0 -1
  79. package/src/AgeTicker.tsx +0 -73
  80. package/src/BaseTanStackRouterDevtoolsPanel.tsx +0 -488
  81. package/src/Explorer.tsx +0 -362
  82. package/src/TanStackRouterDevtools.tsx +0 -250
  83. package/src/TanStackRouterDevtoolsPanel.tsx +0 -54
  84. package/src/context.ts +0 -22
  85. package/src/logo.tsx +0 -817
  86. package/src/theme.tsx +0 -31
  87. package/src/tokens.ts +0 -305
  88. package/src/useLocalStorage.ts +0 -52
  89. package/src/useMediaQuery.ts +0 -41
  90. package/src/useStyles.tsx +0 -589
  91. package/src/utils.ts +0 -188
@@ -1,7 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const TanStackRouterDevtools = require("./TanStackRouterDevtools.cjs");
4
- const TanStackRouterDevtoolsPanel = require("./TanStackRouterDevtoolsPanel.cjs");
5
- exports.TanStackRouterDevtools = TanStackRouterDevtools.TanStackRouterDevtools;
6
- exports.TanStackRouterDevtoolsPanel = TanStackRouterDevtoolsPanel.TanStackRouterDevtoolsPanel;
3
+ const reactRouterDevtools = require("@tanstack/react-router-devtools");
4
+ console.warn(
5
+ "[@tanstack/router-devtools] This package has moved to @tanstack/react-router-devtools. Please switch to the new package at your earliest convenience, as this package will be dropped in the next major version release."
6
+ );
7
+ Object.defineProperty(exports, "TanStackRouterDevtools", {
8
+ enumerable: true,
9
+ get: () => reactRouterDevtools.TanStackRouterDevtoolsInProd
10
+ });
11
+ Object.defineProperty(exports, "TanStackRouterDevtoolsPanel", {
12
+ enumerable: true,
13
+ get: () => reactRouterDevtools.TanStackRouterDevtoolsPanelInProd
14
+ });
7
15
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/index.tsx"],"sourcesContent":["console.warn(\n '[@tanstack/router-devtools] This package has moved to @tanstack/react-router-devtools. Please switch to the new package at your earliest convenience, as this package will be dropped in the next major version release.',\n)\n\nexport { TanStackRouterDevtoolsInProd as TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nexport { TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\n"],"names":[],"mappings":";;;AAAA,QAAQ;AAAA,EACN;AACF;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- export { TanStackRouterDevtools } from './TanStackRouterDevtools.cjs';
2
- export { TanStackRouterDevtoolsPanel } from './TanStackRouterDevtoolsPanel.cjs';
1
+ export { TanStackRouterDevtoolsInProd as TanStackRouterDevtools } from '@tanstack/react-router-devtools';
2
+ export { TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools';
@@ -1,2 +1,2 @@
1
- export { TanStackRouterDevtools } from './TanStackRouterDevtools.js';
2
- export { TanStackRouterDevtoolsPanel } from './TanStackRouterDevtoolsPanel.js';
1
+ export { TanStackRouterDevtoolsInProd as TanStackRouterDevtools } from '@tanstack/react-router-devtools';
2
+ export { TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools';
package/dist/esm/index.js CHANGED
@@ -1,7 +1,9 @@
1
- import { TanStackRouterDevtools } from "./TanStackRouterDevtools.js";
2
- import { TanStackRouterDevtoolsPanel } from "./TanStackRouterDevtoolsPanel.js";
1
+ import { TanStackRouterDevtoolsInProd, TanStackRouterDevtoolsPanelInProd } from "@tanstack/react-router-devtools";
2
+ console.warn(
3
+ "[@tanstack/router-devtools] This package has moved to @tanstack/react-router-devtools. Please switch to the new package at your earliest convenience, as this package will be dropped in the next major version release."
4
+ );
3
5
  export {
4
- TanStackRouterDevtools,
5
- TanStackRouterDevtoolsPanel
6
+ TanStackRouterDevtoolsInProd as TanStackRouterDevtools,
7
+ TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel
6
8
  };
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["console.warn(\n '[@tanstack/router-devtools] This package has moved to @tanstack/react-router-devtools. Please switch to the new package at your earliest convenience, as this package will be dropped in the next major version release.',\n)\n\nexport { TanStackRouterDevtoolsInProd as TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nexport { TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\n"],"names":[],"mappings":";AAAA,QAAQ;AAAA,EACN;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/router-devtools",
3
- "version": "1.112.18",
3
+ "version": "1.114.1",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -50,7 +50,8 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "clsx": "^2.1.1",
53
- "goober": "^2.1.16"
53
+ "goober": "^2.1.16",
54
+ "@tanstack/react-router-devtools": "^1.114.1"
54
55
  },
55
56
  "devDependencies": {
56
57
  "@vitejs/plugin-react": "^4.3.4",
@@ -61,7 +62,7 @@
61
62
  "csstype": "^3.0.10",
62
63
  "react": ">=18.0.0 || >=19.0.0",
63
64
  "react-dom": ">=18.0.0 || >=19.0.0",
64
- "@tanstack/react-router": "^1.112.18"
65
+ "@tanstack/react-router": "^1.114.1"
65
66
  },
66
67
  "peerDependenciesMeta": {
67
68
  "csstype": {
package/src/index.tsx CHANGED
@@ -1,2 +1,6 @@
1
- export { TanStackRouterDevtools } from './TanStackRouterDevtools'
2
- export { TanStackRouterDevtoolsPanel } from './TanStackRouterDevtoolsPanel'
1
+ console.warn(
2
+ '[@tanstack/router-devtools] This package has moved to @tanstack/react-router-devtools. Please switch to the new package at your earliest convenience, as this package will be dropped in the next major version release.',
3
+ )
4
+
5
+ export { TanStackRouterDevtoolsInProd as TanStackRouterDevtools } from '@tanstack/react-router-devtools'
6
+ export { TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const clsx = require("clsx");
5
- const React = require("react");
6
- const useStyles = require("./useStyles.cjs");
7
- function formatTime(ms) {
8
- const units = ["s", "min", "h", "d"];
9
- const values = [ms / 1e3, ms / 6e4, ms / 36e5, ms / 864e5];
10
- let chosenUnitIndex = 0;
11
- for (let i = 1; i < values.length; i++) {
12
- if (values[i] < 1) break;
13
- chosenUnitIndex = i;
14
- }
15
- const formatter = new Intl.NumberFormat(navigator.language, {
16
- compactDisplay: "short",
17
- notation: "compact",
18
- maximumFractionDigits: 0
19
- });
20
- return formatter.format(values[chosenUnitIndex]) + units[chosenUnitIndex];
21
- }
22
- function AgeTicker({
23
- match,
24
- router
25
- }) {
26
- const styles = useStyles.useStyles();
27
- const rerender = React.useReducer(
28
- () => ({}),
29
- () => ({})
30
- )[1];
31
- React.useEffect(() => {
32
- const interval = setInterval(() => {
33
- rerender();
34
- }, 1e3);
35
- return () => {
36
- clearInterval(interval);
37
- };
38
- }, [rerender]);
39
- if (!match) {
40
- return null;
41
- }
42
- const route = router.looseRoutesById[match.routeId];
43
- if (!route.options.loader) {
44
- return null;
45
- }
46
- const age = Date.now() - match.updatedAt;
47
- const staleTime = route.options.staleTime ?? router.options.defaultStaleTime ?? 0;
48
- const gcTime = route.options.gcTime ?? router.options.defaultGcTime ?? 30 * 60 * 1e3;
49
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx(styles.ageTicker(age > staleTime)), children: [
50
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: formatTime(age) }),
51
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "/" }),
52
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: formatTime(staleTime) }),
53
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "/" }),
54
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: formatTime(gcTime) })
55
- ] });
56
- }
57
- exports.AgeTicker = AgeTicker;
58
- //# sourceMappingURL=AgeTicker.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgeTicker.cjs","sources":["../../src/AgeTicker.tsx"],"sourcesContent":["import { clsx as cx } from 'clsx'\nimport React from 'react'\nimport { useStyles } from './useStyles'\nimport type { AnyRouteMatch, AnyRouter } from '@tanstack/react-router'\n\nfunction formatTime(ms: number) {\n const units = ['s', 'min', 'h', 'd']\n const values = [ms / 1000, ms / 60000, ms / 3600000, ms / 86400000]\n\n let chosenUnitIndex = 0\n for (let i = 1; i < values.length; i++) {\n if (values[i]! < 1) break\n chosenUnitIndex = i\n }\n\n const formatter = new Intl.NumberFormat(navigator.language, {\n compactDisplay: 'short',\n notation: 'compact',\n maximumFractionDigits: 0,\n })\n\n return formatter.format(values[chosenUnitIndex]!) + units[chosenUnitIndex]\n}\n\nexport function AgeTicker({\n match,\n router,\n}: {\n match?: AnyRouteMatch\n router: AnyRouter\n}) {\n const styles = useStyles()\n const rerender = React.useReducer(\n () => ({}),\n () => ({}),\n )[1]\n\n React.useEffect(() => {\n const interval = setInterval(() => {\n rerender()\n }, 1000)\n\n return () => {\n clearInterval(interval)\n }\n }, [rerender])\n\n if (!match) {\n return null\n }\n\n const route = router.looseRoutesById[match.routeId]!\n\n if (!route.options.loader) {\n return null\n }\n\n const age = Date.now() - match.updatedAt\n const staleTime =\n route.options.staleTime ?? router.options.defaultStaleTime ?? 0\n const gcTime =\n route.options.gcTime ?? router.options.defaultGcTime ?? 30 * 60 * 1000\n\n return (\n <div className={cx(styles.ageTicker(age > staleTime))}>\n <div>{formatTime(age)}</div>\n <div>/</div>\n <div>{formatTime(staleTime)}</div>\n <div>/</div>\n <div>{formatTime(gcTime)}</div>\n </div>\n )\n}\n"],"names":["useStyles","jsxs","cx","jsx"],"mappings":";;;;;;AAKA,SAAS,WAAW,IAAY;AAC9B,QAAM,QAAQ,CAAC,KAAK,OAAO,KAAK,GAAG;AAC7B,QAAA,SAAS,CAAC,KAAK,KAAM,KAAK,KAAO,KAAK,MAAS,KAAK,KAAQ;AAElE,MAAI,kBAAkB;AACtB,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AAClC,QAAA,OAAO,CAAC,IAAK,EAAG;AACF,sBAAA;AAAA,EAAA;AAGpB,QAAM,YAAY,IAAI,KAAK,aAAa,UAAU,UAAU;AAAA,IAC1D,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,uBAAuB;AAAA,EAAA,CACxB;AAED,SAAO,UAAU,OAAO,OAAO,eAAe,CAAE,IAAI,MAAM,eAAe;AAC3E;AAEO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AACF,GAGG;AACD,QAAM,SAASA,UAAAA,UAAU;AACzB,QAAM,WAAW,MAAM;AAAA,IACrB,OAAO;IACP,OAAO,CAAC;AAAA,IACR,CAAC;AAEH,QAAM,UAAU,MAAM;AACd,UAAA,WAAW,YAAY,MAAM;AACxB,eAAA;AAAA,OACR,GAAI;AAEP,WAAO,MAAM;AACX,oBAAc,QAAQ;AAAA,IACxB;AAAA,EAAA,GACC,CAAC,QAAQ,CAAC;AAEb,MAAI,CAAC,OAAO;AACH,WAAA;AAAA,EAAA;AAGT,QAAM,QAAQ,OAAO,gBAAgB,MAAM,OAAO;AAE9C,MAAA,CAAC,MAAM,QAAQ,QAAQ;AAClB,WAAA;AAAA,EAAA;AAGT,QAAM,MAAM,KAAK,IAAI,IAAI,MAAM;AAC/B,QAAM,YACJ,MAAM,QAAQ,aAAa,OAAO,QAAQ,oBAAoB;AAC1D,QAAA,SACJ,MAAM,QAAQ,UAAU,OAAO,QAAQ,iBAAiB,KAAK,KAAK;AAGlE,SAAAC,gCAAC,SAAI,WAAWC,KAAA,KAAG,OAAO,UAAU,MAAM,SAAS,CAAC,GAClD,UAAA;AAAA,IAACC,2BAAA,IAAA,OAAA,EAAK,UAAW,WAAA,GAAG,EAAE,CAAA;AAAA,IACtBA,2BAAAA,IAAC,SAAI,UAAC,IAAA,CAAA;AAAA,IACLA,2BAAA,IAAA,OAAA,EAAK,UAAW,WAAA,SAAS,EAAE,CAAA;AAAA,IAC5BA,2BAAAA,IAAC,SAAI,UAAC,IAAA,CAAA;AAAA,IACLA,2BAAAA,IAAA,OAAA,EAAK,UAAW,WAAA,MAAM,EAAE,CAAA;AAAA,EAAA,GAC3B;AAEJ;;"}
@@ -1,5 +0,0 @@
1
- import { AnyRouteMatch, AnyRouter } from '@tanstack/react-router';
2
- export declare function AgeTicker({ match, router, }: {
3
- match?: AnyRouteMatch;
4
- router: AnyRouter;
5
- }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,421 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
5
- const clsx = require("clsx");
6
- const reactRouter = require("@tanstack/react-router");
7
- const context = require("./context.cjs");
8
- const useStyles = require("./useStyles.cjs");
9
- const useLocalStorage = require("./useLocalStorage.cjs");
10
- const Explorer = require("./Explorer.cjs");
11
- const utils = require("./utils.cjs");
12
- const AgeTicker = require("./AgeTicker.cjs");
13
- function Logo(props) {
14
- const { className, ...rest } = props;
15
- const styles = useStyles.useStyles();
16
- return /* @__PURE__ */ jsxRuntime.jsxs("button", { ...rest, className: clsx.clsx(styles.logo, className), children: [
17
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.tanstackLogo, children: "TANSTACK" }),
18
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.routerLogo, children: "React Router v1" })
19
- ] });
20
- }
21
- function RouteComp({
22
- router,
23
- route,
24
- isRoot,
25
- activeId,
26
- setActiveId
27
- }) {
28
- var _a;
29
- const routerState = reactRouter.useRouterState({
30
- router
31
- });
32
- const styles = useStyles.useStyles();
33
- const matches = routerState.pendingMatches || routerState.matches;
34
- const match = routerState.matches.find((d) => d.routeId === route.id);
35
- const param = React.useMemo(() => {
36
- try {
37
- if (match == null ? void 0 : match.params) {
38
- const p = match.params;
39
- const r = route.path || reactRouter.trimPath(route.id);
40
- if (r.startsWith("$")) {
41
- const trimmed = r.slice(1);
42
- if (p[trimmed]) {
43
- return `(${p[trimmed]})`;
44
- }
45
- }
46
- }
47
- return "";
48
- } catch (error) {
49
- return "";
50
- }
51
- }, [match, route]);
52
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
53
- /* @__PURE__ */ jsxRuntime.jsxs(
54
- "div",
55
- {
56
- role: "button",
57
- "aria-label": `Open match details for ${route.id}`,
58
- onClick: () => {
59
- if (match) {
60
- setActiveId(activeId === route.id ? "" : route.id);
61
- }
62
- },
63
- className: clsx.clsx(
64
- styles.routesRowContainer(route.id === activeId, !!match)
65
- ),
66
- children: [
67
- /* @__PURE__ */ jsxRuntime.jsx(
68
- "div",
69
- {
70
- className: clsx.clsx(
71
- styles.matchIndicator(utils.getRouteStatusColor(matches, route))
72
- )
73
- }
74
- ),
75
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx(styles.routesRow(!!match)), children: [
76
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
77
- /* @__PURE__ */ jsxRuntime.jsxs("code", { className: styles.code, children: [
78
- isRoot ? reactRouter.rootRouteId : route.path || reactRouter.trimPath(route.id),
79
- " "
80
- ] }),
81
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: styles.routeParamInfo, children: param })
82
- ] }),
83
- /* @__PURE__ */ jsxRuntime.jsx(AgeTicker.AgeTicker, { match, router })
84
- ] })
85
- ]
86
- }
87
- ),
88
- ((_a = route.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.nestedRouteRow(!!isRoot), children: [...route.children].sort((a, b) => {
89
- return a.rank - b.rank;
90
- }).map((r) => /* @__PURE__ */ jsxRuntime.jsx(
91
- RouteComp,
92
- {
93
- router,
94
- route: r,
95
- activeId,
96
- setActiveId
97
- },
98
- r.id
99
- )) }) : null
100
- ] });
101
- }
102
- const BaseTanStackRouterDevtoolsPanel = React.forwardRef(function BaseTanStackRouterDevtoolsPanel2(props, ref) {
103
- var _a, _b;
104
- const {
105
- isOpen = true,
106
- setIsOpen,
107
- handleDragStart,
108
- router: userRouter,
109
- shadowDOMTarget,
110
- ...panelProps
111
- } = props;
112
- const { onCloseClick } = context.useDevtoolsOnClose();
113
- const styles = useStyles.useStyles();
114
- const { className, ...otherPanelProps } = panelProps;
115
- const contextRouter = reactRouter.useRouter({ warn: false });
116
- const router = userRouter ?? contextRouter;
117
- const routerState = reactRouter.useRouterState({
118
- router
119
- });
120
- reactRouter.invariant(
121
- router,
122
- "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."
123
- );
124
- const [showMatches, setShowMatches] = useLocalStorage(
125
- "tanstackRouterDevtoolsShowMatches",
126
- true
127
- );
128
- const [activeId, setActiveId] = useLocalStorage(
129
- "tanstackRouterDevtoolsActiveRouteId",
130
- ""
131
- );
132
- const activeMatch = React.useMemo(() => {
133
- const matches = [
134
- ...routerState.pendingMatches ?? [],
135
- ...routerState.matches,
136
- ...routerState.cachedMatches
137
- ];
138
- return matches.find((d) => d.routeId === activeId || d.id === activeId);
139
- }, [
140
- activeId,
141
- routerState.cachedMatches,
142
- routerState.matches,
143
- routerState.pendingMatches
144
- ]);
145
- const hasSearch = Object.keys(routerState.location.search).length;
146
- const explorerState = {
147
- ...router,
148
- state: router.state
149
- };
150
- return /* @__PURE__ */ jsxRuntime.jsxs(
151
- "div",
152
- {
153
- ref,
154
- className: clsx.clsx(
155
- styles.devtoolsPanel,
156
- "TanStackRouterDevtoolsPanel",
157
- className
158
- ),
159
- ...otherPanelProps,
160
- children: [
161
- handleDragStart ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.dragHandle, onMouseDown: handleDragStart }) : null,
162
- /* @__PURE__ */ jsxRuntime.jsx(
163
- "button",
164
- {
165
- className: styles.panelCloseBtn,
166
- onClick: (e) => {
167
- setIsOpen(false);
168
- onCloseClick(e);
169
- },
170
- children: /* @__PURE__ */ jsxRuntime.jsx(
171
- "svg",
172
- {
173
- xmlns: "http://www.w3.org/2000/svg",
174
- width: "10",
175
- height: "6",
176
- fill: "none",
177
- viewBox: "0 0 10 6",
178
- className: styles.panelCloseBtnIcon,
179
- children: /* @__PURE__ */ jsxRuntime.jsx(
180
- "path",
181
- {
182
- stroke: "currentColor",
183
- strokeLinecap: "round",
184
- strokeLinejoin: "round",
185
- strokeWidth: "1.667",
186
- d: "M1 1l4 4 4-4"
187
- }
188
- )
189
- }
190
- )
191
- }
192
- ),
193
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.firstContainer, children: [
194
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.row, children: /* @__PURE__ */ jsxRuntime.jsx(
195
- Logo,
196
- {
197
- "aria-hidden": true,
198
- onClick: (e) => {
199
- setIsOpen(false);
200
- onCloseClick(e);
201
- }
202
- }
203
- ) }),
204
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.routerExplorerContainer, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.routerExplorer, children: /* @__PURE__ */ jsxRuntime.jsx(
205
- Explorer.default,
206
- {
207
- label: "Router",
208
- value: Object.fromEntries(
209
- utils.multiSortBy(
210
- Object.keys(explorerState),
211
- [
212
- "state",
213
- "routesById",
214
- "routesByPath",
215
- "flatRoutes",
216
- "options",
217
- "manifest"
218
- ].map((d) => (dd) => dd !== d)
219
- ).map((key) => [key, explorerState[key]]).filter(
220
- (d) => typeof d[1] !== "function" && ![
221
- "__store",
222
- "basepath",
223
- "injectedHtml",
224
- "subscribers",
225
- "latestLoadPromise",
226
- "navigateTimeout",
227
- "resetNextScroll",
228
- "tempLocationKey",
229
- "latestLocation",
230
- "routeTree",
231
- "history"
232
- ].includes(d[0])
233
- )
234
- ),
235
- defaultExpanded: {
236
- state: {},
237
- context: {},
238
- options: {}
239
- },
240
- filterSubEntries: (subEntries) => {
241
- return subEntries.filter((d) => typeof d.value !== "function");
242
- }
243
- }
244
- ) }) })
245
- ] }),
246
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.secondContainer, children: [
247
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.matchesContainer, children: [
248
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.detailsHeader, children: [
249
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Pathname" }),
250
- routerState.location.maskedLocation ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.maskedBadgeContainer, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.maskedBadge, children: "masked" }) }) : null
251
- ] }),
252
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.detailsContent, children: [
253
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: routerState.location.pathname }),
254
- routerState.location.maskedLocation ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: styles.maskedLocation, children: routerState.location.maskedLocation.pathname }) : null
255
- ] }),
256
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.detailsHeader, children: [
257
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.routeMatchesToggle, children: [
258
- /* @__PURE__ */ jsxRuntime.jsx(
259
- "button",
260
- {
261
- type: "button",
262
- onClick: () => {
263
- setShowMatches(false);
264
- },
265
- disabled: !showMatches,
266
- className: clsx.clsx(styles.routeMatchesToggleBtn(!showMatches, true)),
267
- children: "Routes"
268
- }
269
- ),
270
- /* @__PURE__ */ jsxRuntime.jsx(
271
- "button",
272
- {
273
- type: "button",
274
- onClick: () => {
275
- setShowMatches(true);
276
- },
277
- disabled: showMatches,
278
- className: clsx.clsx(
279
- styles.routeMatchesToggleBtn(!!showMatches, false)
280
- ),
281
- children: "Matches"
282
- }
283
- )
284
- ] }),
285
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsHeaderInfo, children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: "age / staleTime / gcTime" }) })
286
- ] }),
287
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx.clsx(styles.routesContainer), children: !showMatches ? /* @__PURE__ */ jsxRuntime.jsx(
288
- RouteComp,
289
- {
290
- router,
291
- route: router.routeTree,
292
- isRoot: true,
293
- activeId,
294
- setActiveId
295
- }
296
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { children: (((_a = routerState.pendingMatches) == null ? void 0 : _a.length) ? routerState.pendingMatches : routerState.matches).map((match, i) => {
297
- return /* @__PURE__ */ jsxRuntime.jsxs(
298
- "div",
299
- {
300
- role: "button",
301
- "aria-label": `Open match details for ${match.id}`,
302
- onClick: () => setActiveId(activeId === match.id ? "" : match.id),
303
- className: clsx.clsx(styles.matchRow(match === activeMatch)),
304
- children: [
305
- /* @__PURE__ */ jsxRuntime.jsx(
306
- "div",
307
- {
308
- className: clsx.clsx(
309
- styles.matchIndicator(utils.getStatusColor(match))
310
- )
311
- }
312
- ),
313
- /* @__PURE__ */ jsxRuntime.jsx(
314
- "code",
315
- {
316
- className: styles.matchID,
317
- children: `${match.routeId === reactRouter.rootRouteId ? reactRouter.rootRouteId : match.pathname}`
318
- }
319
- ),
320
- /* @__PURE__ */ jsxRuntime.jsx(AgeTicker.AgeTicker, { match, router })
321
- ]
322
- },
323
- match.id || i
324
- );
325
- }) }) })
326
- ] }),
327
- routerState.cachedMatches.length ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.cachedMatchesContainer, children: [
328
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.detailsHeader, children: [
329
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Cached Matches" }),
330
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsHeaderInfo, children: "age / staleTime / gcTime" })
331
- ] }),
332
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: routerState.cachedMatches.map((match) => {
333
- return /* @__PURE__ */ jsxRuntime.jsxs(
334
- "div",
335
- {
336
- role: "button",
337
- "aria-label": `Open match details for ${match.id}`,
338
- onClick: () => setActiveId(activeId === match.id ? "" : match.id),
339
- className: clsx.clsx(styles.matchRow(match === activeMatch)),
340
- children: [
341
- /* @__PURE__ */ jsxRuntime.jsx(
342
- "div",
343
- {
344
- className: clsx.clsx(
345
- styles.matchIndicator(utils.getStatusColor(match))
346
- )
347
- }
348
- ),
349
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: styles.matchID, children: `${match.id}` }),
350
- /* @__PURE__ */ jsxRuntime.jsx(AgeTicker.AgeTicker, { match, router })
351
- ]
352
- },
353
- match.id
354
- );
355
- }) })
356
- ] }) : null
357
- ] }),
358
- activeMatch ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.thirdContainer, children: [
359
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsHeader, children: "Match Details" }),
360
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.matchDetails, children: [
361
- /* @__PURE__ */ jsxRuntime.jsx(
362
- "div",
363
- {
364
- className: styles.matchStatus(
365
- activeMatch.status,
366
- activeMatch.isFetching
367
- ),
368
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: activeMatch.status === "success" && activeMatch.isFetching ? "fetching" : activeMatch.status })
369
- }
370
- ),
371
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.matchDetailsInfoLabel, children: [
372
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "ID:" }),
373
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.matchDetailsInfo, children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: activeMatch.id }) })
374
- ] }),
375
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.matchDetailsInfoLabel, children: [
376
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "State:" }),
377
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.matchDetailsInfo, children: ((_b = routerState.pendingMatches) == null ? void 0 : _b.find(
378
- (d) => d.id === activeMatch.id
379
- )) ? "Pending" : routerState.matches.find((d) => d.id === activeMatch.id) ? "Active" : "Cached" })
380
- ] }),
381
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.matchDetailsInfoLabel, children: [
382
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Last Updated:" }),
383
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.matchDetailsInfo, children: activeMatch.updatedAt ? new Date(activeMatch.updatedAt).toLocaleTimeString() : "N/A" })
384
- ] })
385
- ] }) }),
386
- activeMatch.loaderData ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
387
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsHeader, children: "Loader Data" }),
388
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsContent, children: /* @__PURE__ */ jsxRuntime.jsx(
389
- Explorer.default,
390
- {
391
- label: "loaderData",
392
- value: activeMatch.loaderData,
393
- defaultExpanded: {}
394
- }
395
- ) })
396
- ] }) : null,
397
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsHeader, children: "Explorer" }),
398
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsContent, children: /* @__PURE__ */ jsxRuntime.jsx(Explorer.default, { label: "Match", value: activeMatch, defaultExpanded: {} }) })
399
- ] }) : null,
400
- hasSearch ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.fourthContainer, children: [
401
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsHeader, children: "Search Params" }),
402
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.detailsContent, children: /* @__PURE__ */ jsxRuntime.jsx(
403
- Explorer.default,
404
- {
405
- value: routerState.location.search,
406
- defaultExpanded: Object.keys(routerState.location.search).reduce(
407
- (obj, next) => {
408
- obj[next] = {};
409
- return obj;
410
- },
411
- {}
412
- )
413
- }
414
- ) })
415
- ] }) : null
416
- ]
417
- }
418
- );
419
- });
420
- exports.BaseTanStackRouterDevtoolsPanel = BaseTanStackRouterDevtoolsPanel;
421
- //# sourceMappingURL=BaseTanStackRouterDevtoolsPanel.cjs.map