@tanstack/router-devtools-core 1.114.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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/dist/cjs/AgeTicker.cjs +47 -0
  4. package/dist/cjs/AgeTicker.cjs.map +1 -0
  5. package/dist/cjs/AgeTicker.d.cts +6 -0
  6. package/dist/cjs/BaseTanStackRouterDevtoolsPanel.cjs +505 -0
  7. package/dist/cjs/BaseTanStackRouterDevtoolsPanel.cjs.map +1 -0
  8. package/dist/cjs/BaseTanStackRouterDevtoolsPanel.d.cts +34 -0
  9. package/dist/cjs/Explorer.cjs +307 -0
  10. package/dist/cjs/Explorer.cjs.map +1 -0
  11. package/dist/cjs/Explorer.d.cts +43 -0
  12. package/dist/cjs/FloatingTanStackRouterDevtools.cjs +195 -0
  13. package/dist/cjs/FloatingTanStackRouterDevtools.cjs.map +1 -0
  14. package/dist/cjs/FloatingTanStackRouterDevtools.d.cts +48 -0
  15. package/dist/cjs/TanStackRouterDevtoolsCore.cjs +99 -0
  16. package/dist/cjs/TanStackRouterDevtoolsCore.cjs.map +1 -0
  17. package/dist/cjs/TanStackRouterDevtoolsCore.d.cts +55 -0
  18. package/dist/cjs/TanStackRouterDevtoolsPanelCore.cjs +99 -0
  19. package/dist/cjs/TanStackRouterDevtoolsPanelCore.cjs.map +1 -0
  20. package/dist/cjs/TanStackRouterDevtoolsPanelCore.d.cts +43 -0
  21. package/dist/cjs/context.cjs +20 -0
  22. package/dist/cjs/context.cjs.map +1 -0
  23. package/dist/cjs/context.d.cts +13 -0
  24. package/dist/cjs/index.cjs +7 -0
  25. package/dist/cjs/index.cjs.map +1 -0
  26. package/dist/cjs/index.d.cts +2 -0
  27. package/dist/cjs/logo.cjs +92 -0
  28. package/dist/cjs/logo.cjs.map +1 -0
  29. package/dist/cjs/logo.d.cts +1 -0
  30. package/dist/cjs/theme.d.cts +34 -0
  31. package/dist/cjs/tokens.cjs +201 -0
  32. package/dist/cjs/tokens.cjs.map +1 -0
  33. package/dist/cjs/tokens.d.cts +298 -0
  34. package/dist/cjs/useLocalStorage.cjs +42 -0
  35. package/dist/cjs/useLocalStorage.cjs.map +1 -0
  36. package/dist/cjs/useLocalStorage.d.cts +2 -0
  37. package/dist/cjs/useMediaQuery.d.cts +2 -0
  38. package/dist/cjs/useStyles.cjs +582 -0
  39. package/dist/cjs/useStyles.cjs.map +1 -0
  40. package/dist/cjs/useStyles.d.cts +53 -0
  41. package/dist/cjs/utils.cjs +63 -0
  42. package/dist/cjs/utils.cjs.map +1 -0
  43. package/dist/cjs/utils.d.cts +25 -0
  44. package/dist/esm/AgeTicker.d.ts +6 -0
  45. package/dist/esm/AgeTicker.js +47 -0
  46. package/dist/esm/AgeTicker.js.map +1 -0
  47. package/dist/esm/BaseTanStackRouterDevtoolsPanel.d.ts +34 -0
  48. package/dist/esm/BaseTanStackRouterDevtoolsPanel.js +505 -0
  49. package/dist/esm/BaseTanStackRouterDevtoolsPanel.js.map +1 -0
  50. package/dist/esm/Explorer.d.ts +43 -0
  51. package/dist/esm/Explorer.js +290 -0
  52. package/dist/esm/Explorer.js.map +1 -0
  53. package/dist/esm/FloatingTanStackRouterDevtools.d.ts +48 -0
  54. package/dist/esm/FloatingTanStackRouterDevtools.js +195 -0
  55. package/dist/esm/FloatingTanStackRouterDevtools.js.map +1 -0
  56. package/dist/esm/TanStackRouterDevtoolsCore.d.ts +55 -0
  57. package/dist/esm/TanStackRouterDevtoolsCore.js +99 -0
  58. package/dist/esm/TanStackRouterDevtoolsCore.js.map +1 -0
  59. package/dist/esm/TanStackRouterDevtoolsPanelCore.d.ts +43 -0
  60. package/dist/esm/TanStackRouterDevtoolsPanelCore.js +99 -0
  61. package/dist/esm/TanStackRouterDevtoolsPanelCore.js.map +1 -0
  62. package/dist/esm/context.d.ts +13 -0
  63. package/dist/esm/context.js +20 -0
  64. package/dist/esm/context.js.map +1 -0
  65. package/dist/esm/index.d.ts +2 -0
  66. package/dist/esm/index.js +7 -0
  67. package/dist/esm/index.js.map +1 -0
  68. package/dist/esm/logo.d.ts +1 -0
  69. package/dist/esm/logo.js +92 -0
  70. package/dist/esm/logo.js.map +1 -0
  71. package/dist/esm/theme.d.ts +34 -0
  72. package/dist/esm/tokens.d.ts +298 -0
  73. package/dist/esm/tokens.js +201 -0
  74. package/dist/esm/tokens.js.map +1 -0
  75. package/dist/esm/useLocalStorage.d.ts +2 -0
  76. package/dist/esm/useLocalStorage.js +43 -0
  77. package/dist/esm/useLocalStorage.js.map +1 -0
  78. package/dist/esm/useMediaQuery.d.ts +2 -0
  79. package/dist/esm/useStyles.d.ts +53 -0
  80. package/dist/esm/useStyles.js +565 -0
  81. package/dist/esm/useStyles.js.map +1 -0
  82. package/dist/esm/utils.d.ts +25 -0
  83. package/dist/esm/utils.js +63 -0
  84. package/dist/esm/utils.js.map +1 -0
  85. package/package.json +71 -0
  86. package/src/AgeTicker.tsx +59 -0
  87. package/src/BaseTanStackRouterDevtoolsPanel.tsx +559 -0
  88. package/src/Explorer.tsx +339 -0
  89. package/src/FloatingTanStackRouterDevtools.tsx +280 -0
  90. package/src/TanStackRouterDevtoolsCore.tsx +139 -0
  91. package/src/TanStackRouterDevtoolsPanelCore.tsx +120 -0
  92. package/src/context.ts +24 -0
  93. package/src/index.tsx +2 -0
  94. package/src/logo.tsx +817 -0
  95. package/src/theme.tsx +36 -0
  96. package/src/tokens.ts +305 -0
  97. package/src/useLocalStorage.ts +52 -0
  98. package/src/useMediaQuery.ts +44 -0
  99. package/src/useStyles.tsx +589 -0
  100. package/src/utils.tsx +185 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-present Tanner Linsley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ <img src="https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188" />
2
+
3
+ # TanStack React Router Devtools
4
+
5
+ See https://tanstack.com/router/latest/docs/framework/react/devtools
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const web = require("solid-js/web");
4
+ const clsx = require("clsx");
5
+ const useStyles = require("./useStyles.cjs");
6
+ var _tmpl$ = /* @__PURE__ */ web.template(`<div><div></div><div>/</div><div></div><div>/</div><div>`);
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
+ if (!match) {
28
+ return null;
29
+ }
30
+ const route = router().looseRoutesById[match.routeId];
31
+ if (!route.options.loader) {
32
+ return null;
33
+ }
34
+ const age = Date.now() - match.updatedAt;
35
+ const staleTime = route.options.staleTime ?? router().options.defaultStaleTime ?? 0;
36
+ const gcTime = route.options.gcTime ?? router().options.defaultGcTime ?? 30 * 60 * 1e3;
37
+ return (() => {
38
+ var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.nextSibling, _el$5 = _el$4.nextSibling, _el$6 = _el$5.nextSibling;
39
+ web.insert(_el$2, () => formatTime(age));
40
+ web.insert(_el$4, () => formatTime(staleTime));
41
+ web.insert(_el$6, () => formatTime(gcTime));
42
+ web.effect(() => web.className(_el$, clsx.clsx(styles().ageTicker(age > staleTime))));
43
+ return _el$;
44
+ })();
45
+ }
46
+ exports.AgeTicker = AgeTicker;
47
+ //# sourceMappingURL=AgeTicker.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgeTicker.cjs","sources":["../../src/AgeTicker.tsx"],"sourcesContent":["import { clsx as cx } from 'clsx'\nimport { useStyles } from './useStyles'\nimport type { AnyRouteMatch, AnyRouter } from '@tanstack/router-core'\nimport type { Accessor } from 'solid-js'\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: Accessor<AnyRouter>\n}) {\n const styles = useStyles()\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 class={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":["formatTime","ms","units","values","chosenUnitIndex","i","length","formatter","Intl","NumberFormat","navigator","language","compactDisplay","notation","maximumFractionDigits","format","AgeTicker","match","router","styles","useStyles","route","looseRoutesById","routeId","options","loader","age","Date","now","updatedAt","staleTime","defaultStaleTime","gcTime","defaultGcTime","_el$","_tmpl$","_el$2","firstChild","_el$3","nextSibling","_el$4","_el$5","_el$6","_$insert","_$className","cx","ageTicker"],"mappings":";;;;;;AAKA,SAASA,WAAWC,IAAY;AAC9B,QAAMC,QAAQ,CAAC,KAAK,OAAO,KAAK,GAAG;AAC7BC,QAAAA,SAAS,CAACF,KAAK,KAAMA,KAAK,KAAOA,KAAK,MAASA,KAAK,KAAQ;AAElE,MAAIG,kBAAkB;AACtB,WAASC,IAAI,GAAGA,IAAIF,OAAOG,QAAQD,KAAK;AAClCF,QAAAA,OAAOE,CAAC,IAAK,EAAG;AACFA,sBAAAA;AAAAA,EAAAA;AAGpB,QAAME,YAAY,IAAIC,KAAKC,aAAaC,UAAUC,UAAU;AAAA,IAC1DC,gBAAgB;AAAA,IAChBC,UAAU;AAAA,IACVC,uBAAuB;AAAA,EAAA,CACxB;AAED,SAAOP,UAAUQ,OAAOZ,OAAOC,eAAe,CAAE,IAAIF,MAAME,eAAe;AAC3E;AAEO,SAASY,UAAU;AAAA,EACxBC;AAAAA,EACAC;AAIF,GAAG;AACD,QAAMC,SAASC,UAAAA,UAAU;AAEzB,MAAI,CAACH,OAAO;AACH,WAAA;AAAA,EAAA;AAGT,QAAMI,QAAQH,OAAAA,EAASI,gBAAgBL,MAAMM,OAAO;AAEhD,MAAA,CAACF,MAAMG,QAAQC,QAAQ;AAClB,WAAA;AAAA,EAAA;AAGT,QAAMC,MAAMC,KAAKC,IAAI,IAAIX,MAAMY;AAC/B,QAAMC,YACJT,MAAMG,QAAQM,aAAaZ,SAASM,QAAQO,oBAAoB;AAC5DC,QAAAA,SACJX,MAAMG,QAAQQ,UAAUd,SAASM,QAAQS,iBAAiB,KAAK,KAAK;AAEtE,UAAA,MAAA;AAAA,QAAAC,OAAAC,UAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAG,aAAAC,QAAAF,MAAAC,aAAAE,QAAAD,MAAAD,aAAAG,QAAAD,MAAAF;AAAAI,QAAAA,OAAAP,OAAA,MAEUpC,WAAW0B,GAAG,CAAC;AAAAiB,QAAAA,OAAAH,OAAA,MAEfxC,WAAW8B,SAAS,CAAC;AAAAa,QAAAA,OAAAD,OAAA,MAErB1C,WAAWgC,MAAM,CAAC;qBAAAY,IAAAA,UAAAV,MALdW,UAAG1B,SAAS2B,UAAUpB,MAAMI,SAAS,CAAC,CAAC,CAAA;AAAAI,WAAAA;AAAAA,EAAAA,GAAA;AAQvD;;"}
@@ -0,0 +1,6 @@
1
+ import { AnyRouteMatch, AnyRouter } from '@tanstack/router-core';
2
+ import { Accessor } from 'solid-js';
3
+ export declare function AgeTicker({ match, router, }: {
4
+ match?: AnyRouteMatch;
5
+ router: Accessor<AnyRouter>;
6
+ }): import("solid-js").JSX.Element;
@@ -0,0 +1,505 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const web = require("solid-js/web");
4
+ const clsx = require("clsx");
5
+ const invariant = require("tiny-invariant");
6
+ const routerCore = require("@tanstack/router-core");
7
+ const solidJs = require("solid-js");
8
+ const context = require("./context.cjs");
9
+ const useStyles = require("./useStyles.cjs");
10
+ const useLocalStorage = require("./useLocalStorage.cjs");
11
+ const Explorer = require("./Explorer.cjs");
12
+ const utils = require("./utils.cjs");
13
+ const AgeTicker = require("./AgeTicker.cjs");
14
+ var _tmpl$ = /* @__PURE__ */ web.template(`<button><div>TANSTACK</div><div>TanStack Router v1`), _tmpl$2 = /* @__PURE__ */ web.template(`<div><div role=button><div></div><div><div><code> </code><code>`), _tmpl$3 = /* @__PURE__ */ web.template(`<div>`), _tmpl$4 = /* @__PURE__ */ web.template(`<div><button><svg xmlns=http://www.w3.org/2000/svg width=10 height=6 fill=none viewBox="0 0 10 6"><path stroke=currentColor stroke-linecap=round stroke-linejoin=round stroke-width=1.667 d="M1 1l4 4 4-4"></path></svg></button><div><div></div><div><div></div></div></div><div><div><div><span>Pathname</span></div><div><code></code></div><div><div><button type=button>Routes</button><button type=button>Matches</button></div><div><div>age / staleTime / gcTime</div></div></div><div>`), _tmpl$5 = /* @__PURE__ */ web.template(`<div><span>masked`), _tmpl$6 = /* @__PURE__ */ web.template(`<code>`), _tmpl$7 = /* @__PURE__ */ web.template(`<div role=button><div></div><code>`), _tmpl$8 = /* @__PURE__ */ web.template(`<div><div><div>Cached Matches</div><div>age / staleTime / gcTime</div></div><div>`), _tmpl$9 = /* @__PURE__ */ web.template(`<div><div>Match Details</div><div><div><div><div></div></div><div><div>ID:</div><div><code></code></div></div><div><div>State:</div><div></div></div><div><div>Last Updated:</div><div></div></div></div></div><div>Explorer</div><div>`), _tmpl$10 = /* @__PURE__ */ web.template(`<div>Loader Data`), _tmpl$11 = /* @__PURE__ */ web.template(`<div><div>Search Params</div><div>`);
15
+ function Logo(props) {
16
+ const {
17
+ className,
18
+ ...rest
19
+ } = props;
20
+ const styles = useStyles.useStyles();
21
+ return (() => {
22
+ var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
23
+ web.spread(_el$, web.mergeProps(rest, {
24
+ get ["class"]() {
25
+ return clsx.clsx(styles().logo, className ? className() : "");
26
+ }
27
+ }), false, true);
28
+ web.effect((_p$) => {
29
+ var _v$ = styles().tanstackLogo, _v$2 = styles().routerLogo;
30
+ _v$ !== _p$.e && web.className(_el$2, _p$.e = _v$);
31
+ _v$2 !== _p$.t && web.className(_el$3, _p$.t = _v$2);
32
+ return _p$;
33
+ }, {
34
+ e: void 0,
35
+ t: void 0
36
+ });
37
+ return _el$;
38
+ })();
39
+ }
40
+ function RouteComp({
41
+ routerState,
42
+ router,
43
+ route,
44
+ isRoot,
45
+ activeId,
46
+ setActiveId
47
+ }) {
48
+ const styles = useStyles.useStyles();
49
+ const matches = solidJs.createMemo(() => routerState().pendingMatches || routerState().matches);
50
+ const match = solidJs.createMemo(() => routerState().matches.find((d) => d.routeId === route.id));
51
+ const param = solidJs.createMemo(() => {
52
+ var _a, _b;
53
+ try {
54
+ if ((_a = match()) == null ? void 0 : _a.params) {
55
+ const p = (_b = match()) == null ? void 0 : _b.params;
56
+ const r = route.path || routerCore.trimPath(route.id);
57
+ if (r.startsWith("$")) {
58
+ const trimmed = r.slice(1);
59
+ if (p[trimmed]) {
60
+ return `(${p[trimmed]})`;
61
+ }
62
+ }
63
+ }
64
+ return "";
65
+ } catch (error) {
66
+ return "";
67
+ }
68
+ });
69
+ return (() => {
70
+ var _el$4 = _tmpl$2(), _el$5 = _el$4.firstChild, _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling, _el$8 = _el$7.firstChild, _el$9 = _el$8.firstChild, _el$10 = _el$9.firstChild, _el$11 = _el$9.nextSibling;
71
+ _el$5.$$click = () => {
72
+ if (match()) {
73
+ setActiveId(activeId() === route.id ? "" : route.id);
74
+ }
75
+ };
76
+ web.insert(_el$9, () => isRoot ? routerCore.rootRouteId : route.path || routerCore.trimPath(route.id), _el$10);
77
+ web.insert(_el$11, param);
78
+ web.insert(_el$7, web.createComponent(AgeTicker.AgeTicker, {
79
+ get match() {
80
+ return match();
81
+ },
82
+ router
83
+ }), null);
84
+ web.insert(_el$4, (() => {
85
+ var _c$ = web.memo(() => {
86
+ var _a;
87
+ return !!((_a = route.children) == null ? void 0 : _a.length);
88
+ });
89
+ return () => _c$() ? (() => {
90
+ var _el$12 = _tmpl$3();
91
+ web.insert(_el$12, () => [...route.children].sort((a, b) => {
92
+ return a.rank - b.rank;
93
+ }).map((r) => web.createComponent(RouteComp, {
94
+ routerState,
95
+ router,
96
+ route: r,
97
+ activeId,
98
+ setActiveId
99
+ })));
100
+ web.effect(() => web.className(_el$12, styles().nestedRouteRow(!!isRoot)));
101
+ return _el$12;
102
+ })() : null;
103
+ })(), null);
104
+ web.effect((_p$) => {
105
+ var _v$3 = `Open match details for ${route.id}`, _v$4 = clsx.clsx(styles().routesRowContainer(route.id === activeId(), !!match())), _v$5 = clsx.clsx(styles().matchIndicator(utils.getRouteStatusColor(matches(), route))), _v$6 = clsx.clsx(styles().routesRow(!!match())), _v$7 = styles().code, _v$8 = styles().routeParamInfo;
106
+ _v$3 !== _p$.e && web.setAttribute(_el$5, "aria-label", _p$.e = _v$3);
107
+ _v$4 !== _p$.t && web.className(_el$5, _p$.t = _v$4);
108
+ _v$5 !== _p$.a && web.className(_el$6, _p$.a = _v$5);
109
+ _v$6 !== _p$.o && web.className(_el$7, _p$.o = _v$6);
110
+ _v$7 !== _p$.i && web.className(_el$9, _p$.i = _v$7);
111
+ _v$8 !== _p$.n && web.className(_el$11, _p$.n = _v$8);
112
+ return _p$;
113
+ }, {
114
+ e: void 0,
115
+ t: void 0,
116
+ a: void 0,
117
+ o: void 0,
118
+ i: void 0,
119
+ n: void 0
120
+ });
121
+ return _el$4;
122
+ })();
123
+ }
124
+ const BaseTanStackRouterDevtoolsPanel = function BaseTanStackRouterDevtoolsPanel2({
125
+ ...props
126
+ }) {
127
+ const {
128
+ isOpen = true,
129
+ setIsOpen,
130
+ handleDragStart,
131
+ router,
132
+ routerState,
133
+ shadowDOMTarget,
134
+ ...panelProps
135
+ } = props;
136
+ const {
137
+ onCloseClick
138
+ } = context.useDevtoolsOnClose();
139
+ const styles = useStyles.useStyles();
140
+ const {
141
+ className,
142
+ style,
143
+ ...otherPanelProps
144
+ } = panelProps;
145
+ 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.");
146
+ const [showMatches, setShowMatches] = useLocalStorage("tanstackRouterDevtoolsShowMatches", true);
147
+ const [activeId, setActiveId] = useLocalStorage("tanstackRouterDevtoolsActiveRouteId", "");
148
+ const activeMatch = solidJs.createMemo(() => {
149
+ const matches = [...routerState().pendingMatches ?? [], ...routerState().matches, ...routerState().cachedMatches];
150
+ return matches.find((d) => d.routeId === activeId() || d.id === activeId());
151
+ });
152
+ const hasSearch = solidJs.createMemo(() => Object.keys(routerState().location.search).length);
153
+ const explorerState = solidJs.createMemo(() => {
154
+ return {
155
+ ...router(),
156
+ state: routerState()
157
+ };
158
+ });
159
+ const routerExplorerValue = solidJs.createMemo(() => Object.fromEntries(utils.multiSortBy(Object.keys(explorerState()), ["state", "routesById", "routesByPath", "flatRoutes", "options", "manifest"].map((d) => (dd) => dd !== d)).map((key) => [key, explorerState()[key]]).filter((d) => typeof d[1] !== "function" && !["__store", "basepath", "injectedHtml", "subscribers", "latestLoadPromise", "navigateTimeout", "resetNextScroll", "tempLocationKey", "latestLocation", "routeTree", "history"].includes(d[0]))));
160
+ const activeMatchLoaderData = solidJs.createMemo(() => {
161
+ var _a;
162
+ return (_a = activeMatch()) == null ? void 0 : _a.loaderData;
163
+ });
164
+ const activeMatchValue = solidJs.createMemo(() => activeMatch());
165
+ const locationSearchValue = solidJs.createMemo(() => routerState().location.search);
166
+ return (() => {
167
+ var _el$13 = _tmpl$4(), _el$14 = _el$13.firstChild, _el$15 = _el$14.firstChild, _el$16 = _el$14.nextSibling, _el$17 = _el$16.firstChild, _el$18 = _el$17.nextSibling, _el$19 = _el$18.firstChild, _el$20 = _el$16.nextSibling, _el$21 = _el$20.firstChild, _el$22 = _el$21.firstChild;
168
+ _el$22.firstChild;
169
+ var _el$24 = _el$22.nextSibling, _el$25 = _el$24.firstChild, _el$26 = _el$24.nextSibling, _el$27 = _el$26.firstChild, _el$28 = _el$27.firstChild, _el$29 = _el$28.nextSibling, _el$30 = _el$27.nextSibling, _el$31 = _el$26.nextSibling;
170
+ web.spread(_el$13, web.mergeProps({
171
+ get ["class"]() {
172
+ return clsx.clsx(styles().devtoolsPanel, "TanStackRouterDevtoolsPanel", className ? className() : "");
173
+ },
174
+ get style() {
175
+ return style ? style() : "";
176
+ }
177
+ }, otherPanelProps), false, true);
178
+ web.insert(_el$13, handleDragStart ? (() => {
179
+ var _el$32 = _tmpl$3();
180
+ web.addEventListener(_el$32, "mousedown", handleDragStart, true);
181
+ web.effect(() => web.className(_el$32, styles().dragHandle));
182
+ return _el$32;
183
+ })() : null, _el$14);
184
+ _el$14.$$click = (e) => {
185
+ if (setIsOpen) {
186
+ setIsOpen(false);
187
+ }
188
+ onCloseClick(e);
189
+ };
190
+ web.insert(_el$17, web.createComponent(Logo, {
191
+ "aria-hidden": true,
192
+ onClick: (e) => {
193
+ if (setIsOpen) {
194
+ setIsOpen(false);
195
+ }
196
+ onCloseClick(e);
197
+ }
198
+ }));
199
+ web.insert(_el$19, web.createComponent(Explorer.Explorer, {
200
+ label: "Router",
201
+ value: routerExplorerValue,
202
+ defaultExpanded: {
203
+ state: {},
204
+ context: {},
205
+ options: {}
206
+ },
207
+ filterSubEntries: (subEntries) => {
208
+ return subEntries.filter((d) => typeof d.value() !== "function");
209
+ }
210
+ }));
211
+ web.insert(_el$22, (() => {
212
+ var _c$2 = web.memo(() => !!routerState().location.maskedLocation);
213
+ return () => _c$2() ? (() => {
214
+ var _el$33 = _tmpl$5(), _el$34 = _el$33.firstChild;
215
+ web.effect((_p$) => {
216
+ var _v$27 = styles().maskedBadgeContainer, _v$28 = styles().maskedBadge;
217
+ _v$27 !== _p$.e && web.className(_el$33, _p$.e = _v$27);
218
+ _v$28 !== _p$.t && web.className(_el$34, _p$.t = _v$28);
219
+ return _p$;
220
+ }, {
221
+ e: void 0,
222
+ t: void 0
223
+ });
224
+ return _el$33;
225
+ })() : null;
226
+ })(), null);
227
+ web.insert(_el$25, () => routerState().location.pathname);
228
+ web.insert(_el$24, (() => {
229
+ var _c$3 = web.memo(() => !!routerState().location.maskedLocation);
230
+ return () => _c$3() ? (() => {
231
+ var _el$35 = _tmpl$6();
232
+ web.insert(_el$35, () => {
233
+ var _a;
234
+ return (_a = routerState().location.maskedLocation) == null ? void 0 : _a.pathname;
235
+ });
236
+ web.effect(() => web.className(_el$35, styles().maskedLocation));
237
+ return _el$35;
238
+ })() : null;
239
+ })(), null);
240
+ _el$28.$$click = () => {
241
+ setShowMatches(false);
242
+ };
243
+ _el$29.$$click = () => {
244
+ setShowMatches(true);
245
+ };
246
+ web.insert(_el$31, (() => {
247
+ var _c$4 = web.memo(() => !!!showMatches());
248
+ return () => _c$4() ? web.createComponent(RouteComp, {
249
+ routerState,
250
+ router,
251
+ get route() {
252
+ return router().routeTree;
253
+ },
254
+ isRoot: true,
255
+ activeId,
256
+ setActiveId
257
+ }) : (() => {
258
+ var _el$36 = _tmpl$3();
259
+ web.insert(_el$36, () => {
260
+ var _a, _b;
261
+ return (_b = ((_a = routerState().pendingMatches) == null ? void 0 : _a.length) ? routerState().pendingMatches : routerState().matches) == null ? void 0 : _b.map((match, i) => {
262
+ return (() => {
263
+ var _el$37 = _tmpl$7(), _el$38 = _el$37.firstChild, _el$39 = _el$38.nextSibling;
264
+ _el$37.$$click = () => setActiveId(activeId() === match.id ? "" : match.id);
265
+ web.insert(_el$39, () => `${match.routeId === routerCore.rootRouteId ? routerCore.rootRouteId : match.pathname}`);
266
+ web.insert(_el$37, web.createComponent(AgeTicker.AgeTicker, {
267
+ match,
268
+ router
269
+ }), null);
270
+ web.effect((_p$) => {
271
+ var _v$29 = `Open match details for ${match.id}`, _v$30 = clsx.clsx(styles().matchRow(match === activeMatch())), _v$31 = clsx.clsx(styles().matchIndicator(utils.getStatusColor(match))), _v$32 = styles().matchID;
272
+ _v$29 !== _p$.e && web.setAttribute(_el$37, "aria-label", _p$.e = _v$29);
273
+ _v$30 !== _p$.t && web.className(_el$37, _p$.t = _v$30);
274
+ _v$31 !== _p$.a && web.className(_el$38, _p$.a = _v$31);
275
+ _v$32 !== _p$.o && web.className(_el$39, _p$.o = _v$32);
276
+ return _p$;
277
+ }, {
278
+ e: void 0,
279
+ t: void 0,
280
+ a: void 0,
281
+ o: void 0
282
+ });
283
+ return _el$37;
284
+ })();
285
+ });
286
+ });
287
+ return _el$36;
288
+ })();
289
+ })());
290
+ web.insert(_el$20, (() => {
291
+ var _c$5 = web.memo(() => !!routerState().cachedMatches.length);
292
+ return () => _c$5() ? (() => {
293
+ var _el$40 = _tmpl$8(), _el$41 = _el$40.firstChild, _el$42 = _el$41.firstChild, _el$43 = _el$42.nextSibling, _el$44 = _el$41.nextSibling;
294
+ web.insert(_el$44, () => routerState().cachedMatches.map((match) => {
295
+ return (() => {
296
+ var _el$45 = _tmpl$7(), _el$46 = _el$45.firstChild, _el$47 = _el$46.nextSibling;
297
+ _el$45.$$click = () => setActiveId(activeId() === match.id ? "" : match.id);
298
+ web.insert(_el$47, () => `${match.id}`);
299
+ web.insert(_el$45, web.createComponent(AgeTicker.AgeTicker, {
300
+ match,
301
+ router
302
+ }), null);
303
+ web.effect((_p$) => {
304
+ var _v$36 = `Open match details for ${match.id}`, _v$37 = clsx.clsx(styles().matchRow(match === activeMatch())), _v$38 = clsx.clsx(styles().matchIndicator(utils.getStatusColor(match))), _v$39 = styles().matchID;
305
+ _v$36 !== _p$.e && web.setAttribute(_el$45, "aria-label", _p$.e = _v$36);
306
+ _v$37 !== _p$.t && web.className(_el$45, _p$.t = _v$37);
307
+ _v$38 !== _p$.a && web.className(_el$46, _p$.a = _v$38);
308
+ _v$39 !== _p$.o && web.className(_el$47, _p$.o = _v$39);
309
+ return _p$;
310
+ }, {
311
+ e: void 0,
312
+ t: void 0,
313
+ a: void 0,
314
+ o: void 0
315
+ });
316
+ return _el$45;
317
+ })();
318
+ }));
319
+ web.effect((_p$) => {
320
+ var _v$33 = styles().cachedMatchesContainer, _v$34 = styles().detailsHeader, _v$35 = styles().detailsHeaderInfo;
321
+ _v$33 !== _p$.e && web.className(_el$40, _p$.e = _v$33);
322
+ _v$34 !== _p$.t && web.className(_el$41, _p$.t = _v$34);
323
+ _v$35 !== _p$.a && web.className(_el$43, _p$.a = _v$35);
324
+ return _p$;
325
+ }, {
326
+ e: void 0,
327
+ t: void 0,
328
+ a: void 0
329
+ });
330
+ return _el$40;
331
+ })() : null;
332
+ })(), null);
333
+ web.insert(_el$13, (() => {
334
+ var _c$6 = web.memo(() => {
335
+ var _a;
336
+ return !!(activeMatch() && ((_a = activeMatch()) == null ? void 0 : _a.status));
337
+ });
338
+ return () => _c$6() ? (() => {
339
+ var _el$48 = _tmpl$9(), _el$49 = _el$48.firstChild, _el$50 = _el$49.nextSibling, _el$51 = _el$50.firstChild, _el$52 = _el$51.firstChild, _el$53 = _el$52.firstChild, _el$54 = _el$52.nextSibling, _el$55 = _el$54.firstChild, _el$56 = _el$55.nextSibling, _el$57 = _el$56.firstChild, _el$58 = _el$54.nextSibling, _el$59 = _el$58.firstChild, _el$60 = _el$59.nextSibling, _el$61 = _el$58.nextSibling, _el$62 = _el$61.firstChild, _el$63 = _el$62.nextSibling, _el$64 = _el$50.nextSibling, _el$65 = _el$64.nextSibling;
340
+ web.insert(_el$53, (() => {
341
+ var _c$8 = web.memo(() => {
342
+ var _a, _b;
343
+ return !!(((_a = activeMatch()) == null ? void 0 : _a.status) === "success" && ((_b = activeMatch()) == null ? void 0 : _b.isFetching));
344
+ });
345
+ return () => {
346
+ var _a;
347
+ return _c$8() ? "fetching" : (_a = activeMatch()) == null ? void 0 : _a.status;
348
+ };
349
+ })());
350
+ web.insert(_el$57, () => {
351
+ var _a;
352
+ return (_a = activeMatch()) == null ? void 0 : _a.id;
353
+ });
354
+ web.insert(_el$60, (() => {
355
+ var _c$9 = web.memo(() => {
356
+ var _a;
357
+ return !!((_a = routerState().pendingMatches) == null ? void 0 : _a.find((d) => {
358
+ var _a2;
359
+ return d.id === ((_a2 = activeMatch()) == null ? void 0 : _a2.id);
360
+ }));
361
+ });
362
+ return () => _c$9() ? "Pending" : routerState().matches.find((d) => {
363
+ var _a;
364
+ return d.id === ((_a = activeMatch()) == null ? void 0 : _a.id);
365
+ }) ? "Active" : "Cached";
366
+ })());
367
+ web.insert(_el$63, (() => {
368
+ var _c$10 = web.memo(() => {
369
+ var _a;
370
+ return !!((_a = activeMatch()) == null ? void 0 : _a.updatedAt);
371
+ });
372
+ return () => {
373
+ var _a;
374
+ return _c$10() ? new Date((_a = activeMatch()) == null ? void 0 : _a.updatedAt).toLocaleTimeString() : "N/A";
375
+ };
376
+ })());
377
+ web.insert(_el$48, (() => {
378
+ var _c$11 = web.memo(() => !!activeMatchLoaderData());
379
+ return () => _c$11() ? [(() => {
380
+ var _el$66 = _tmpl$10();
381
+ web.effect(() => web.className(_el$66, styles().detailsHeader));
382
+ return _el$66;
383
+ })(), (() => {
384
+ var _el$67 = _tmpl$3();
385
+ web.insert(_el$67, web.createComponent(Explorer.Explorer, {
386
+ label: "loaderData",
387
+ value: activeMatchLoaderData,
388
+ defaultExpanded: {}
389
+ }));
390
+ web.effect(() => web.className(_el$67, styles().detailsContent));
391
+ return _el$67;
392
+ })()] : null;
393
+ })(), _el$64);
394
+ web.insert(_el$65, web.createComponent(Explorer.Explorer, {
395
+ label: "Match",
396
+ value: activeMatchValue,
397
+ defaultExpanded: {}
398
+ }));
399
+ web.effect((_p$) => {
400
+ var _a, _b;
401
+ var _v$40 = styles().thirdContainer, _v$41 = styles().detailsHeader, _v$42 = styles().matchDetails, _v$43 = styles().matchStatus((_a = activeMatch()) == null ? void 0 : _a.status, (_b = activeMatch()) == null ? void 0 : _b.isFetching), _v$44 = styles().matchDetailsInfoLabel, _v$45 = styles().matchDetailsInfo, _v$46 = styles().matchDetailsInfoLabel, _v$47 = styles().matchDetailsInfo, _v$48 = styles().matchDetailsInfoLabel, _v$49 = styles().matchDetailsInfo, _v$50 = styles().detailsHeader, _v$51 = styles().detailsContent;
402
+ _v$40 !== _p$.e && web.className(_el$48, _p$.e = _v$40);
403
+ _v$41 !== _p$.t && web.className(_el$49, _p$.t = _v$41);
404
+ _v$42 !== _p$.a && web.className(_el$51, _p$.a = _v$42);
405
+ _v$43 !== _p$.o && web.className(_el$52, _p$.o = _v$43);
406
+ _v$44 !== _p$.i && web.className(_el$54, _p$.i = _v$44);
407
+ _v$45 !== _p$.n && web.className(_el$56, _p$.n = _v$45);
408
+ _v$46 !== _p$.s && web.className(_el$58, _p$.s = _v$46);
409
+ _v$47 !== _p$.h && web.className(_el$60, _p$.h = _v$47);
410
+ _v$48 !== _p$.r && web.className(_el$61, _p$.r = _v$48);
411
+ _v$49 !== _p$.d && web.className(_el$63, _p$.d = _v$49);
412
+ _v$50 !== _p$.l && web.className(_el$64, _p$.l = _v$50);
413
+ _v$51 !== _p$.u && web.className(_el$65, _p$.u = _v$51);
414
+ return _p$;
415
+ }, {
416
+ e: void 0,
417
+ t: void 0,
418
+ a: void 0,
419
+ o: void 0,
420
+ i: void 0,
421
+ n: void 0,
422
+ s: void 0,
423
+ h: void 0,
424
+ r: void 0,
425
+ d: void 0,
426
+ l: void 0,
427
+ u: void 0
428
+ });
429
+ return _el$48;
430
+ })() : null;
431
+ })(), null);
432
+ web.insert(_el$13, (() => {
433
+ var _c$7 = web.memo(() => !!hasSearch());
434
+ return () => _c$7() ? (() => {
435
+ var _el$68 = _tmpl$11(), _el$69 = _el$68.firstChild, _el$70 = _el$69.nextSibling;
436
+ web.insert(_el$70, web.createComponent(Explorer.Explorer, {
437
+ value: locationSearchValue,
438
+ get defaultExpanded() {
439
+ return Object.keys(routerState().location.search).reduce((obj, next) => {
440
+ obj[next] = {};
441
+ return obj;
442
+ }, {});
443
+ }
444
+ }));
445
+ web.effect((_p$) => {
446
+ var _v$52 = styles().fourthContainer, _v$53 = styles().detailsHeader, _v$54 = styles().detailsContent;
447
+ _v$52 !== _p$.e && web.className(_el$68, _p$.e = _v$52);
448
+ _v$53 !== _p$.t && web.className(_el$69, _p$.t = _v$53);
449
+ _v$54 !== _p$.a && web.className(_el$70, _p$.a = _v$54);
450
+ return _p$;
451
+ }, {
452
+ e: void 0,
453
+ t: void 0,
454
+ a: void 0
455
+ });
456
+ return _el$68;
457
+ })() : null;
458
+ })(), null);
459
+ web.effect((_p$) => {
460
+ var _v$9 = styles().panelCloseBtn, _v$10 = styles().panelCloseBtnIcon, _v$11 = styles().firstContainer, _v$12 = styles().row, _v$13 = styles().routerExplorerContainer, _v$14 = styles().routerExplorer, _v$15 = styles().secondContainer, _v$16 = styles().matchesContainer, _v$17 = styles().detailsHeader, _v$18 = styles().detailsContent, _v$19 = styles().detailsHeader, _v$20 = styles().routeMatchesToggle, _v$21 = !showMatches(), _v$22 = clsx.clsx(styles().routeMatchesToggleBtn(!showMatches(), true)), _v$23 = showMatches(), _v$24 = clsx.clsx(styles().routeMatchesToggleBtn(!!showMatches(), false)), _v$25 = styles().detailsHeaderInfo, _v$26 = clsx.clsx(styles().routesContainer);
461
+ _v$9 !== _p$.e && web.className(_el$14, _p$.e = _v$9);
462
+ _v$10 !== _p$.t && web.setAttribute(_el$15, "class", _p$.t = _v$10);
463
+ _v$11 !== _p$.a && web.className(_el$16, _p$.a = _v$11);
464
+ _v$12 !== _p$.o && web.className(_el$17, _p$.o = _v$12);
465
+ _v$13 !== _p$.i && web.className(_el$18, _p$.i = _v$13);
466
+ _v$14 !== _p$.n && web.className(_el$19, _p$.n = _v$14);
467
+ _v$15 !== _p$.s && web.className(_el$20, _p$.s = _v$15);
468
+ _v$16 !== _p$.h && web.className(_el$21, _p$.h = _v$16);
469
+ _v$17 !== _p$.r && web.className(_el$22, _p$.r = _v$17);
470
+ _v$18 !== _p$.d && web.className(_el$24, _p$.d = _v$18);
471
+ _v$19 !== _p$.l && web.className(_el$26, _p$.l = _v$19);
472
+ _v$20 !== _p$.u && web.className(_el$27, _p$.u = _v$20);
473
+ _v$21 !== _p$.c && (_el$28.disabled = _p$.c = _v$21);
474
+ _v$22 !== _p$.w && web.className(_el$28, _p$.w = _v$22);
475
+ _v$23 !== _p$.m && (_el$29.disabled = _p$.m = _v$23);
476
+ _v$24 !== _p$.f && web.className(_el$29, _p$.f = _v$24);
477
+ _v$25 !== _p$.y && web.className(_el$30, _p$.y = _v$25);
478
+ _v$26 !== _p$.g && web.className(_el$31, _p$.g = _v$26);
479
+ return _p$;
480
+ }, {
481
+ e: void 0,
482
+ t: void 0,
483
+ a: void 0,
484
+ o: void 0,
485
+ i: void 0,
486
+ n: void 0,
487
+ s: void 0,
488
+ h: void 0,
489
+ r: void 0,
490
+ d: void 0,
491
+ l: void 0,
492
+ u: void 0,
493
+ c: void 0,
494
+ w: void 0,
495
+ m: void 0,
496
+ f: void 0,
497
+ y: void 0,
498
+ g: void 0
499
+ });
500
+ return _el$13;
501
+ })();
502
+ };
503
+ web.delegateEvents(["click", "mousedown"]);
504
+ exports.BaseTanStackRouterDevtoolsPanel = BaseTanStackRouterDevtoolsPanel;
505
+ //# sourceMappingURL=BaseTanStackRouterDevtoolsPanel.cjs.map