@tanstack/router-devtools 1.16.6 → 1.17.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 (49) hide show
  1. package/dist/cjs/Explorer.cjs +146 -92
  2. package/dist/cjs/Explorer.cjs.map +1 -1
  3. package/dist/cjs/Explorer.d.cts +0 -7
  4. package/dist/cjs/devtools.cjs +901 -894
  5. package/dist/cjs/devtools.cjs.map +1 -1
  6. package/dist/cjs/logo.cjs +1012 -0
  7. package/dist/cjs/logo.cjs.map +1 -0
  8. package/dist/cjs/logo.d.cts +2 -0
  9. package/dist/cjs/tokens.cjs +302 -0
  10. package/dist/cjs/tokens.cjs.map +1 -0
  11. package/dist/cjs/tokens.d.cts +298 -0
  12. package/dist/cjs/utils.cjs +5 -33
  13. package/dist/cjs/utils.cjs.map +1 -1
  14. package/dist/cjs/utils.d.cts +2 -2
  15. package/dist/esm/Explorer.d.ts +0 -7
  16. package/dist/esm/Explorer.js +147 -93
  17. package/dist/esm/Explorer.js.map +1 -1
  18. package/dist/esm/devtools.js +901 -894
  19. package/dist/esm/devtools.js.map +1 -1
  20. package/dist/esm/logo.d.ts +2 -0
  21. package/dist/esm/logo.js +1012 -0
  22. package/dist/esm/logo.js.map +1 -0
  23. package/dist/esm/tokens.d.ts +298 -0
  24. package/dist/esm/tokens.js +302 -0
  25. package/dist/esm/tokens.js.map +1 -0
  26. package/dist/esm/utils.d.ts +2 -2
  27. package/dist/esm/utils.js +5 -33
  28. package/dist/esm/utils.js.map +1 -1
  29. package/package.json +3 -1
  30. package/src/Explorer.tsx +148 -93
  31. package/src/devtools.tsx +956 -851
  32. package/src/logo.tsx +817 -0
  33. package/src/tokens.ts +305 -0
  34. package/src/utils.ts +12 -11
  35. package/dist/cjs/styledComponents.cjs +0 -93
  36. package/dist/cjs/styledComponents.cjs.map +0 -1
  37. package/dist/cjs/styledComponents.d.cts +0 -7
  38. package/dist/cjs/theme.cjs +0 -28
  39. package/dist/cjs/theme.cjs.map +0 -1
  40. package/dist/cjs/useMediaQuery.cjs +0 -27
  41. package/dist/cjs/useMediaQuery.cjs.map +0 -1
  42. package/dist/esm/styledComponents.d.ts +0 -7
  43. package/dist/esm/styledComponents.js +0 -93
  44. package/dist/esm/styledComponents.js.map +0 -1
  45. package/dist/esm/theme.js +0 -28
  46. package/dist/esm/theme.js.map +0 -1
  47. package/dist/esm/useMediaQuery.js +0 -28
  48. package/dist/esm/useMediaQuery.js.map +0 -1
  49. package/src/styledComponents.ts +0 -106
@@ -3,55 +3,29 @@ import React__default from "react";
3
3
  import { useRouter, useRouterState, invariant, trimPath } from "@tanstack/react-router";
4
4
  import useLocalStorage from "./useLocalStorage.js";
5
5
  import { useSafeState, useIsMounted, multiSortBy, getStatusColor, getRouteStatusColor } from "./utils.js";
6
- import { Button, Panel, Code, ActivePanel } from "./styledComponents.js";
7
- import { ThemeProvider, defaultTheme } from "./theme.js";
6
+ import { css } from "goober";
7
+ import { clsx } from "clsx";
8
8
  import Explorer from "./Explorer.js";
9
+ import { tokens } from "./tokens.js";
10
+ import { TanStackLogo } from "./logo.js";
9
11
  const isServer = typeof window === "undefined";
10
12
  function Logo(props) {
11
- return /* @__PURE__ */ jsxs(
12
- "div",
13
- {
14
- ...props,
15
- style: {
16
- ...props.style ?? {},
17
- display: "flex",
18
- alignItems: "center",
19
- flexDirection: "column",
20
- fontSize: "0.8rem",
21
- fontWeight: "bolder",
22
- lineHeight: "1"
23
- },
24
- children: [
25
- /* @__PURE__ */ jsx(
26
- "div",
27
- {
28
- style: {
29
- letterSpacing: "-0.05rem"
30
- },
31
- children: "TANSTACK"
32
- }
33
- ),
34
- /* @__PURE__ */ jsx(
35
- "div",
36
- {
37
- style: {
38
- backgroundImage: "linear-gradient(to right, var(--tw-gradient-stops))",
39
- // @ts-ignore
40
- "--tw-gradient-from": "#84cc16",
41
- "--tw-gradient-stops": "var(--tw-gradient-from), var(--tw-gradient-to)",
42
- "--tw-gradient-to": "#10b981",
43
- WebkitBackgroundClip: "text",
44
- color: "transparent",
45
- letterSpacing: "0.1rem",
46
- marginRight: "-0.2rem"
47
- },
48
- children: "ROUTER"
49
- }
50
- )
51
- ]
52
- }
53
- );
13
+ const { className, ...rest } = props;
14
+ return /* @__PURE__ */ jsxs("button", { ...rest, className: clsx(styles.logo, className), children: [
15
+ /* @__PURE__ */ jsx("div", { className: styles.tanstackLogo, children: "TANSTACK" }),
16
+ /* @__PURE__ */ jsx("div", { className: styles.routerLogo, children: "React Router v1" })
17
+ ] });
54
18
  }
19
+ const DevtoolsOnCloseContext = React__default.createContext(void 0);
20
+ const useDevtoolsOnClose = () => {
21
+ const context = React__default.useContext(DevtoolsOnCloseContext);
22
+ if (!context) {
23
+ throw new Error(
24
+ "useDevtoolsOnClose must be used within a TanStackRouterDevtools component"
25
+ );
26
+ }
27
+ return context;
28
+ };
55
29
  function TanStackRouterDevtools({
56
30
  initialIsOpen,
57
31
  panelProps = {},
@@ -100,31 +74,10 @@ function TanStackRouterDevtools({
100
74
  document.addEventListener("mousemove", run);
101
75
  document.addEventListener("mouseup", unsub);
102
76
  };
77
+ const isButtonClosed = isOpen ?? false;
103
78
  React__default.useEffect(() => {
104
79
  setIsResolvedOpen(isOpen ?? false);
105
80
  }, [isOpen, isResolvedOpen, setIsResolvedOpen]);
106
- React__default.useEffect(() => {
107
- const ref = panelRef.current;
108
- if (ref) {
109
- const handlePanelTransitionStart = () => {
110
- if (ref && isResolvedOpen) {
111
- ref.style.visibility = "visible";
112
- }
113
- };
114
- const handlePanelTransitionEnd = () => {
115
- if (ref && !isResolvedOpen) {
116
- ref.style.visibility = "hidden";
117
- }
118
- };
119
- ref.addEventListener("transitionstart", handlePanelTransitionStart);
120
- ref.addEventListener("transitionend", handlePanelTransitionEnd);
121
- return () => {
122
- ref.removeEventListener("transitionstart", handlePanelTransitionStart);
123
- ref.removeEventListener("transitionend", handlePanelTransitionEnd);
124
- };
125
- }
126
- return;
127
- }, [isResolvedOpen]);
128
81
  React__default[isServer ? "useEffect" : "useLayoutEffect"](() => {
129
82
  var _a, _b;
130
83
  if (isResolvedOpen) {
@@ -150,6 +103,13 @@ function TanStackRouterDevtools({
150
103
  }
151
104
  return;
152
105
  }, [isResolvedOpen]);
106
+ React__default[isServer ? "useEffect" : "useLayoutEffect"](() => {
107
+ if (rootRef.current) {
108
+ const el = rootRef.current;
109
+ const fontSize = getComputedStyle(el).fontSize;
110
+ el.style.setProperty("--tsrd-font-size", fontSize);
111
+ }
112
+ }, [rootRef.current]);
153
113
  const { style: panelStyle = {}, ...otherPanelProps } = panelProps;
154
114
  const {
155
115
  style: closeButtonStyle = {},
@@ -163,78 +123,42 @@ function TanStackRouterDevtools({
163
123
  } = toggleButtonProps;
164
124
  if (!isMounted())
165
125
  return null;
126
+ const resolvedHeight = devtoolsHeight ?? 500;
166
127
  return /* @__PURE__ */ jsxs(Container, { ref: rootRef, className: "TanStackRouterDevtools", children: [
167
- /* @__PURE__ */ jsxs(ThemeProvider, { theme: defaultTheme, children: [
168
- /* @__PURE__ */ jsx(
169
- TanStackRouterDevtoolsPanel,
170
- {
171
- ref: panelRef,
172
- ...otherPanelProps,
173
- router,
174
- style: {
175
- direction: "ltr",
176
- position: "fixed",
177
- bottom: "0",
178
- right: "0",
179
- zIndex: 99999,
180
- width: "100%",
181
- height: devtoolsHeight ?? 500,
182
- maxHeight: "90%",
183
- boxShadow: "0 0 20px rgba(0,0,0,.3)",
184
- borderTop: `1px solid ${defaultTheme.gray}`,
185
- transformOrigin: "top",
186
- // visibility will be toggled after transitions, but set initial state here
187
- visibility: isOpen ? "visible" : "hidden",
188
- ...panelStyle,
189
- ...isResizing ? {
190
- transition: `none`
191
- } : { transition: `all .2s ease` },
192
- ...isResolvedOpen ? {
193
- opacity: 1,
194
- pointerEvents: "all",
195
- transform: `translateY(0) scale(1)`
196
- } : {
197
- opacity: 0,
198
- pointerEvents: "none",
199
- transform: `translateY(15px) scale(1.02)`
200
- }
201
- },
202
- isOpen: isResolvedOpen,
203
- setIsOpen,
204
- handleDragStart: (e) => handleDragStart(panelRef.current, e)
205
- }
206
- ),
207
- isResolvedOpen ? /* @__PURE__ */ jsx(
208
- Button,
209
- {
210
- type: "button",
211
- "aria-label": "Close TanStack Router Devtools",
212
- ...otherCloseButtonProps,
213
- onClick: (e) => {
214
- setIsOpen(false);
215
- onCloseClick && onCloseClick(e);
216
- },
217
- style: {
218
- position: "fixed",
219
- zIndex: 99999,
220
- margin: ".5em",
221
- bottom: 0,
222
- ...position === "top-right" ? {
223
- right: "0"
224
- } : position === "top-left" ? {
225
- left: "0"
226
- } : position === "bottom-right" ? {
227
- right: "0"
228
- } : {
229
- left: "0"
128
+ /* @__PURE__ */ jsx(
129
+ DevtoolsOnCloseContext.Provider,
130
+ {
131
+ value: {
132
+ onCloseClick: onCloseClick ?? (() => {
133
+ })
134
+ },
135
+ children: /* @__PURE__ */ jsx(
136
+ TanStackRouterDevtoolsPanel,
137
+ {
138
+ ref: panelRef,
139
+ ...otherPanelProps,
140
+ router,
141
+ className: clsx(
142
+ styles.devtoolsPanelContainer,
143
+ styles.devtoolsPanelContainerVisibility(!!isOpen),
144
+ styles.devtoolsPanelContainerResizing(isResizing),
145
+ styles.devtoolsPanelContainerAnimation(
146
+ isResolvedOpen,
147
+ resolvedHeight + 16
148
+ )
149
+ ),
150
+ style: {
151
+ height: resolvedHeight,
152
+ ...panelStyle
230
153
  },
231
- ...closeButtonStyle
232
- },
233
- children: "Close"
234
- }
235
- ) : null
236
- ] }),
237
- !isResolvedOpen ? /* @__PURE__ */ jsx(
154
+ isOpen: isResolvedOpen,
155
+ setIsOpen,
156
+ handleDragStart: (e) => handleDragStart(panelRef.current, e)
157
+ }
158
+ )
159
+ }
160
+ ),
161
+ /* @__PURE__ */ jsxs(
238
162
  "button",
239
163
  {
240
164
  type: "button",
@@ -244,36 +168,21 @@ function TanStackRouterDevtools({
244
168
  setIsOpen(true);
245
169
  onToggleClick && onToggleClick(e);
246
170
  },
247
- style: {
248
- appearance: "none",
249
- background: "none",
250
- border: 0,
251
- padding: 0,
252
- position: "fixed",
253
- zIndex: 99999,
254
- display: "inline-flex",
255
- fontSize: "1.5em",
256
- margin: ".5em",
257
- cursor: "pointer",
258
- width: "fit-content",
259
- ...position === "top-right" ? {
260
- top: "0",
261
- right: "0"
262
- } : position === "top-left" ? {
263
- top: "0",
264
- left: "0"
265
- } : position === "bottom-right" ? {
266
- bottom: "0",
267
- right: "0"
268
- } : {
269
- bottom: "0",
270
- left: "0"
271
- },
272
- ...toggleButtonStyle
273
- },
274
- children: /* @__PURE__ */ jsx(Logo, { "aria-hidden": true })
171
+ className: clsx(
172
+ styles.mainCloseBtn,
173
+ styles.mainCloseBtnPosition(position),
174
+ styles.mainCloseBtnAnimation(!isButtonClosed)
175
+ ),
176
+ children: [
177
+ /* @__PURE__ */ jsxs("div", { className: styles.mainCloseBtnIconContainer, children: [
178
+ /* @__PURE__ */ jsx("div", { className: styles.mainCloseBtnIconOuter, children: /* @__PURE__ */ jsx(TanStackLogo, {}) }),
179
+ /* @__PURE__ */ jsx("div", { className: styles.mainCloseBtnIconInner, children: /* @__PURE__ */ jsx(TanStackLogo, {}) })
180
+ ] }),
181
+ /* @__PURE__ */ jsx("div", { className: styles.mainCloseBtnDivider, children: "-" }),
182
+ /* @__PURE__ */ jsx("div", { className: styles.routerLogoCloseButton, children: "React Router" })
183
+ ]
275
184
  }
276
- ) : null
185
+ )
277
186
  ] });
278
187
  }
279
188
  function RouteComp({
@@ -286,6 +195,23 @@ function RouteComp({
286
195
  const routerState = useRouterState();
287
196
  const matches = routerState.status === "pending" ? routerState.pendingMatches ?? [] : routerState.matches;
288
197
  const match = routerState.matches.find((d) => d.routeId === route.id);
198
+ const param = React__default.useMemo(() => {
199
+ try {
200
+ if (match == null ? void 0 : match.params) {
201
+ const p = match.params;
202
+ const r = route.path || trimPath(route.id);
203
+ if (r.startsWith("$")) {
204
+ const trimmed = r.slice(1);
205
+ if (p[trimmed]) {
206
+ return `(${p[trimmed]})`;
207
+ }
208
+ }
209
+ }
210
+ return "";
211
+ } catch (error) {
212
+ return "";
213
+ }
214
+ }, [match, route]);
289
215
  return /* @__PURE__ */ jsxs("div", { children: [
290
216
  /* @__PURE__ */ jsxs(
291
217
  "div",
@@ -297,90 +223,42 @@ function RouteComp({
297
223
  setActiveId(activeId === route.id ? "" : route.id);
298
224
  }
299
225
  },
300
- style: {
301
- display: "flex",
302
- borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
303
- cursor: match ? "pointer" : "default",
304
- alignItems: "center",
305
- background: route.id === activeId ? "rgba(255,255,255,.1)" : void 0,
306
- padding: ".25rem .5rem",
307
- gap: ".5rem"
308
- },
226
+ className: clsx(
227
+ styles.routesRowContainer(route.id === activeId, !!match)
228
+ ),
309
229
  children: [
310
- isRoot ? null : /* @__PURE__ */ jsx(
230
+ /* @__PURE__ */ jsx(
311
231
  "div",
312
232
  {
313
- style: {
314
- flex: "0 0 auto",
315
- width: ".7rem",
316
- height: ".7rem",
317
- alignItems: "center",
318
- justifyContent: "center",
319
- fontWeight: "bold",
320
- borderRadius: "100%",
321
- transition: "all .2s ease-out",
322
- background: getRouteStatusColor(matches, route, defaultTheme),
323
- opacity: match ? 1 : 0.3
324
- }
233
+ className: clsx(
234
+ styles.matchIndicator(getRouteStatusColor(matches, route))
235
+ )
325
236
  }
326
237
  ),
327
- /* @__PURE__ */ jsxs(
328
- "div",
329
- {
330
- style: {
331
- flex: "1 0 auto",
332
- display: "flex",
333
- justifyContent: "space-between",
334
- alignItems: "center",
335
- padding: isRoot ? "0 .25rem" : 0,
336
- opacity: match ? 1 : 0.7,
337
- fontSize: "0.7rem"
338
- },
339
- children: [
340
- /* @__PURE__ */ jsxs(Code, { children: [
341
- route.path || trimPath(route.id),
342
- " "
343
- ] }),
344
- /* @__PURE__ */ jsxs(
345
- "div",
346
- {
347
- style: {
348
- display: "flex",
349
- alignItems: "center",
350
- gap: ".5rem"
351
- },
352
- children: [
353
- match ? /* @__PURE__ */ jsx(Code, { style: { opacity: 0.3 }, children: match.id }) : null,
354
- /* @__PURE__ */ jsx(AgeTicker, { match })
355
- ]
356
- }
357
- )
358
- ]
359
- }
360
- )
238
+ /* @__PURE__ */ jsxs("div", { className: clsx(styles.routesRow(!!match)), children: [
239
+ /* @__PURE__ */ jsxs("div", { children: [
240
+ /* @__PURE__ */ jsxs("code", { className: styles.code, children: [
241
+ isRoot ? "__root__" : route.path || trimPath(route.id),
242
+ " "
243
+ ] }),
244
+ /* @__PURE__ */ jsx("code", { className: styles.routeParamInfo, children: param })
245
+ ] }),
246
+ /* @__PURE__ */ jsx(AgeTicker, { match })
247
+ ] })
361
248
  ]
362
249
  }
363
250
  ),
364
- ((_a = route.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx(
365
- "div",
251
+ ((_a = route.children) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx("div", { className: styles.nestedRouteRow(!!isRoot), children: [...route.children].sort((a, b) => {
252
+ return a.rank - b.rank;
253
+ }).map((r) => /* @__PURE__ */ jsx(
254
+ RouteComp,
366
255
  {
367
- style: {
368
- marginLeft: isRoot ? 0 : "1rem",
369
- borderLeft: isRoot ? "" : `solid 1px ${defaultTheme.grayAlt}`
370
- },
371
- children: [...route.children].sort((a, b) => {
372
- return a.rank - b.rank;
373
- }).map((r) => /* @__PURE__ */ jsx(
374
- RouteComp,
375
- {
376
- route: r,
377
- activeId,
378
- setActiveId
379
- },
380
- r.id
381
- ))
382
- }
383
- ) : null
256
+ route: r,
257
+ activeId,
258
+ setActiveId
259
+ },
260
+ r.id
261
+ )) }) : null
384
262
  ] });
385
263
  }
386
264
  const TanStackRouterDevtoolsPanel = React__default.forwardRef(function TanStackRouterDevtoolsPanel2(props, ref) {
@@ -392,6 +270,8 @@ const TanStackRouterDevtoolsPanel = React__default.forwardRef(function TanStackR
392
270
  router: userRouter,
393
271
  ...panelProps
394
272
  } = props;
273
+ const { onCloseClick } = useDevtoolsOnClose();
274
+ const { className, ...otherPanelProps } = panelProps;
395
275
  const contextRouter = useRouter({ warn: false });
396
276
  const router = userRouter ?? contextRouter;
397
277
  const routerState = useRouterState({
@@ -423,670 +303,274 @@ const TanStackRouterDevtoolsPanel = React__default.forwardRef(function TanStackR
423
303
  ...router,
424
304
  state: router.state
425
305
  };
426
- return /* @__PURE__ */ jsx(ThemeProvider, { theme: defaultTheme, children: /* @__PURE__ */ jsxs(Panel, { ref, className: "TanStackRouterDevtoolsPanel", ...panelProps, children: [
427
- /* @__PURE__ */ jsx(
428
- "style",
429
- {
430
- dangerouslySetInnerHTML: {
431
- __html: `
432
-
433
- .TanStackRouterDevtoolsPanel * {
434
- scrollbar-color: ${defaultTheme.backgroundAlt} ${defaultTheme.gray};
435
- }
436
-
437
- .TanStackRouterDevtoolsPanel *::-webkit-scrollbar, .TanStackRouterDevtoolsPanel scrollbar {
438
- width: 1em;
439
- height: 1em;
440
- }
441
-
442
- .TanStackRouterDevtoolsPanel *::-webkit-scrollbar-track, .TanStackRouterDevtoolsPanel scrollbar-track {
443
- background: ${defaultTheme.backgroundAlt};
444
- }
445
-
446
- .TanStackRouterDevtoolsPanel *::-webkit-scrollbar-thumb, .TanStackRouterDevtoolsPanel scrollbar-thumb {
447
- background: ${defaultTheme.gray};
448
- border-radius: .5em;
449
- border: 3px solid ${defaultTheme.backgroundAlt};
450
- }
451
-
452
- .TanStackRouterDevtoolsPanel table {
453
- width: 100%;
454
- }
455
-
456
- .TanStackRouterDevtoolsPanel table tr {
457
- border-bottom: 2px dotted rgba(255, 255, 255, .2);
458
- }
459
-
460
- .TanStackRouterDevtoolsPanel table tr:last-child {
461
- border-bottom: none
462
- }
463
-
464
- .TanStackRouterDevtoolsPanel table td {
465
- padding: .25rem .5rem;
466
- border-right: 2px dotted rgba(255, 255, 255, .05);
467
- }
468
-
469
- .TanStackRouterDevtoolsPanel table td:last-child {
470
- border-right: none
471
- }
472
-
473
- `
474
- }
475
- }
476
- ),
477
- handleDragStart ? /* @__PURE__ */ jsx(
478
- "div",
479
- {
480
- style: {
481
- position: "absolute",
482
- left: 0,
483
- top: 0,
484
- width: "100%",
485
- height: "4px",
486
- marginBottom: "-4px",
487
- cursor: "row-resize",
488
- zIndex: 1e5
489
- },
490
- onMouseDown: handleDragStart
491
- }
492
- ) : null,
493
- /* @__PURE__ */ jsxs(
494
- "div",
495
- {
496
- style: {
497
- flex: "1 1 500px",
498
- minHeight: "40%",
499
- maxHeight: "100%",
500
- overflow: "auto",
501
- borderRight: `1px solid ${defaultTheme.grayAlt}`,
502
- display: "flex",
503
- flexDirection: "column"
504
- },
505
- children: [
506
- /* @__PURE__ */ jsxs(
507
- "div",
508
- {
509
- style: {
510
- display: "flex",
511
- justifyContent: "start",
512
- gap: "1rem",
513
- padding: "1rem",
514
- alignItems: "center",
515
- background: defaultTheme.backgroundAlt
516
- },
517
- children: [
518
- /* @__PURE__ */ jsx(Logo, { "aria-hidden": true }),
519
- /* @__PURE__ */ jsx(
520
- "div",
306
+ return /* @__PURE__ */ jsxs(
307
+ "div",
308
+ {
309
+ ref,
310
+ className: clsx(
311
+ styles.devtoolsPanel,
312
+ "TanStackRouterDevtoolsPanel",
313
+ className
314
+ ),
315
+ ...otherPanelProps,
316
+ children: [
317
+ handleDragStart ? /* @__PURE__ */ jsx("div", { className: styles.dragHandle, onMouseDown: handleDragStart }) : null,
318
+ /* @__PURE__ */ jsx(
319
+ "button",
320
+ {
321
+ className: styles.panelCloseBtn,
322
+ onClick: (e) => {
323
+ setIsOpen(false);
324
+ onCloseClick(e);
325
+ },
326
+ children: /* @__PURE__ */ jsx(
327
+ "svg",
328
+ {
329
+ xmlns: "http://www.w3.org/2000/svg",
330
+ width: "10",
331
+ height: "6",
332
+ fill: "none",
333
+ viewBox: "0 0 10 6",
334
+ className: styles.panelCloseBtnIcon,
335
+ children: /* @__PURE__ */ jsx(
336
+ "path",
521
337
  {
522
- style: {
523
- fontSize: "clamp(.8rem, 2vw, 1.3rem)",
524
- fontWeight: "bold"
525
- },
526
- children: /* @__PURE__ */ jsx(
527
- "span",
528
- {
529
- style: {
530
- fontWeight: 100
531
- },
532
- children: "Devtools"
533
- }
534
- )
338
+ stroke: "currentColor",
339
+ strokeLinecap: "round",
340
+ strokeLinejoin: "round",
341
+ strokeWidth: "1.667",
342
+ d: "M1 1l4 4 4-4"
535
343
  }
536
344
  )
537
- ]
538
- }
539
- ),
540
- /* @__PURE__ */ jsx(
541
- "div",
345
+ }
346
+ )
347
+ }
348
+ ),
349
+ /* @__PURE__ */ jsxs("div", { className: styles.firstContainer, children: [
350
+ /* @__PURE__ */ jsx("div", { className: styles.row, children: /* @__PURE__ */ jsx(
351
+ Logo,
542
352
  {
543
- style: {
544
- overflowY: "auto",
545
- flex: "1"
546
- },
547
- children: /* @__PURE__ */ jsx(
548
- "div",
549
- {
550
- style: {
551
- padding: ".5em"
552
- },
553
- children: /* @__PURE__ */ jsx(
554
- Explorer,
555
- {
556
- label: "Router",
557
- value: Object.fromEntries(
558
- multiSortBy(
559
- Object.keys(explorerState),
560
- [
561
- "state",
562
- "routesById",
563
- "routesByPath",
564
- "flatRoutes",
565
- "options"
566
- ].map((d) => (dd) => dd !== d)
567
- ).map((key) => [key, explorerState[key]]).filter(
568
- (d) => typeof d[1] !== "function" && ![
569
- "__store",
570
- "basepath",
571
- "injectedHtml",
572
- "subscribers",
573
- "latestLoadPromise",
574
- "navigateTimeout",
575
- "resetNextScroll",
576
- "tempLocationKey",
577
- "latestLocation",
578
- "routeTree",
579
- "history"
580
- ].includes(d[0])
581
- )
582
- ),
583
- defaultExpanded: {
584
- state: {},
585
- context: {},
586
- options: {}
587
- },
588
- filterSubEntries: (subEntries) => {
589
- return subEntries.filter((d) => typeof d.value !== "function");
590
- }
591
- }
592
- )
593
- }
594
- )
353
+ "aria-hidden": true,
354
+ onClick: (e) => {
355
+ setIsOpen(false);
356
+ onCloseClick(e);
357
+ }
595
358
  }
596
- )
597
- ]
598
- }
599
- ),
600
- /* @__PURE__ */ jsxs(
601
- "div",
602
- {
603
- style: {
604
- flex: "1 1 500px",
605
- minHeight: "40%",
606
- maxHeight: "100%",
607
- overflow: "auto",
608
- borderRight: `1px solid ${defaultTheme.grayAlt}`,
609
- display: "flex",
610
- flexDirection: "column"
611
- },
612
- children: [
613
- /* @__PURE__ */ jsxs(
614
- "div",
359
+ ) }),
360
+ /* @__PURE__ */ jsx("div", { className: styles.routerExplorerContainer, children: /* @__PURE__ */ jsx("div", { className: styles.routerExplorer, children: /* @__PURE__ */ jsx(
361
+ Explorer,
615
362
  {
616
- style: {
617
- flex: "1 1 auto",
618
- overflowY: "auto"
363
+ label: "Router",
364
+ value: Object.fromEntries(
365
+ multiSortBy(
366
+ Object.keys(explorerState),
367
+ [
368
+ "state",
369
+ "routesById",
370
+ "routesByPath",
371
+ "flatRoutes",
372
+ "options"
373
+ ].map((d) => (dd) => dd !== d)
374
+ ).map((key) => [key, explorerState[key]]).filter(
375
+ (d) => typeof d[1] !== "function" && ![
376
+ "__store",
377
+ "basepath",
378
+ "injectedHtml",
379
+ "subscribers",
380
+ "latestLoadPromise",
381
+ "navigateTimeout",
382
+ "resetNextScroll",
383
+ "tempLocationKey",
384
+ "latestLocation",
385
+ "routeTree",
386
+ "history"
387
+ ].includes(d[0])
388
+ )
389
+ ),
390
+ defaultExpanded: {
391
+ state: {},
392
+ context: {},
393
+ options: {}
619
394
  },
620
- children: [
621
- /* @__PURE__ */ jsxs(
622
- "div",
623
- {
624
- style: {
625
- padding: ".5em",
626
- background: defaultTheme.backgroundAlt,
627
- position: "sticky",
628
- top: 0,
629
- zIndex: 1,
630
- display: "flex",
631
- alignItems: "center",
632
- gap: ".5rem",
633
- fontWeight: "bold"
634
- },
635
- children: [
636
- "Pathname",
637
- " ",
638
- routerState.location.maskedLocation ? /* @__PURE__ */ jsx(
639
- "div",
640
- {
641
- style: {
642
- padding: ".1rem .5rem",
643
- background: defaultTheme.warning,
644
- color: "black",
645
- borderRadius: ".5rem"
646
- },
647
- children: "Masked"
648
- }
649
- ) : null
650
- ]
651
- }
652
- ),
653
- /* @__PURE__ */ jsxs(
654
- "div",
655
- {
656
- style: {
657
- padding: ".5rem",
658
- display: "flex",
659
- gap: ".5rem",
660
- alignItems: "center"
661
- },
662
- children: [
663
- /* @__PURE__ */ jsx(
664
- "code",
665
- {
666
- style: {
667
- opacity: 0.6
668
- },
669
- children: routerState.location.pathname
670
- }
671
- ),
672
- routerState.location.maskedLocation ? /* @__PURE__ */ jsx(
673
- "code",
674
- {
675
- style: {
676
- color: defaultTheme.warning,
677
- fontWeight: "bold"
678
- },
679
- children: routerState.location.maskedLocation.pathname
680
- }
681
- ) : null
682
- ]
683
- }
684
- ),
685
- /* @__PURE__ */ jsxs(
686
- "div",
395
+ filterSubEntries: (subEntries) => {
396
+ return subEntries.filter((d) => typeof d.value !== "function");
397
+ }
398
+ }
399
+ ) }) })
400
+ ] }),
401
+ /* @__PURE__ */ jsxs("div", { className: styles.secondContainer, children: [
402
+ /* @__PURE__ */ jsxs("div", { className: styles.matchesContainer, children: [
403
+ /* @__PURE__ */ jsxs("div", { className: styles.detailsHeader, children: [
404
+ /* @__PURE__ */ jsx("span", { children: "Pathname" }),
405
+ routerState.location.maskedLocation ? /* @__PURE__ */ jsx("div", { className: styles.maskedBadgeContainer, children: /* @__PURE__ */ jsx("span", { className: styles.maskedBadge, children: "masked" }) }) : null
406
+ ] }),
407
+ /* @__PURE__ */ jsxs("div", { className: styles.detailsContent, children: [
408
+ /* @__PURE__ */ jsx("code", { children: routerState.location.pathname }),
409
+ routerState.location.maskedLocation ? /* @__PURE__ */ jsx("code", { className: styles.maskedLocation, children: routerState.location.maskedLocation.pathname }) : null
410
+ ] }),
411
+ /* @__PURE__ */ jsxs("div", { className: styles.detailsHeader, children: [
412
+ /* @__PURE__ */ jsxs("div", { className: styles.routeMatchesToggle, children: [
413
+ /* @__PURE__ */ jsx(
414
+ "button",
687
415
  {
688
- style: {
689
- padding: ".5em",
690
- background: defaultTheme.backgroundAlt,
691
- position: "sticky",
692
- top: 0,
693
- zIndex: 1,
694
- display: "flex",
695
- alignItems: "center",
696
- justifyContent: "space-between",
697
- gap: ".5rem",
698
- fontWeight: "bold"
416
+ type: "button",
417
+ onClick: () => {
418
+ setShowMatches(false);
699
419
  },
700
- children: [
701
- /* @__PURE__ */ jsxs(
702
- "div",
703
- {
704
- style: {
705
- display: "flex",
706
- alignItems: "center",
707
- gap: ".5rem"
708
- },
709
- children: [
710
- /* @__PURE__ */ jsx(
711
- "button",
712
- {
713
- type: "button",
714
- onClick: () => {
715
- setShowMatches(false);
716
- },
717
- disabled: !showMatches,
718
- style: {
719
- appearance: "none",
720
- opacity: showMatches ? 0.5 : 1,
721
- border: 0,
722
- background: "transparent",
723
- color: "inherit",
724
- cursor: "pointer"
725
- },
726
- children: "Routes"
727
- }
728
- ),
729
- "/",
730
- /* @__PURE__ */ jsx(
731
- "button",
732
- {
733
- type: "button",
734
- onClick: () => {
735
- setShowMatches(true);
736
- },
737
- disabled: showMatches,
738
- style: {
739
- appearance: "none",
740
- opacity: !showMatches ? 0.5 : 1,
741
- border: 0,
742
- background: "transparent",
743
- color: "inherit",
744
- cursor: "pointer"
745
- },
746
- children: "Matches"
747
- }
748
- )
749
- ]
750
- }
751
- ),
752
- /* @__PURE__ */ jsx(
753
- "div",
754
- {
755
- style: {
756
- opacity: 0.3,
757
- fontSize: "0.7rem",
758
- fontWeight: "normal"
759
- },
760
- children: "age / staleTime / gcTime"
761
- }
762
- )
763
- ]
420
+ disabled: !showMatches,
421
+ className: clsx(styles.routeMatchesToggleBtn(!showMatches, true)),
422
+ children: "Routes"
764
423
  }
765
424
  ),
766
- !showMatches ? /* @__PURE__ */ jsx(
767
- RouteComp,
768
- {
769
- route: router.routeTree,
770
- isRoot: true,
771
- activeId,
772
- setActiveId
773
- }
774
- ) : /* @__PURE__ */ jsx("div", { children: (routerState.status === "pending" ? routerState.pendingMatches ?? [] : routerState.matches).map((match, i) => {
775
- return /* @__PURE__ */ jsxs(
776
- "div",
777
- {
778
- role: "button",
779
- "aria-label": `Open match details for ${match.id}`,
780
- onClick: () => setActiveId(activeId === match.id ? "" : match.id),
781
- style: {
782
- display: "flex",
783
- borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
784
- cursor: "pointer",
785
- alignItems: "center",
786
- background: match === activeMatch ? "rgba(255,255,255,.1)" : void 0
787
- },
788
- children: [
789
- /* @__PURE__ */ jsx(
790
- "div",
791
- {
792
- style: {
793
- flex: "0 0 auto",
794
- width: "1.3rem",
795
- height: "1.3rem",
796
- marginLeft: ".25rem",
797
- background: getStatusColor(match, defaultTheme),
798
- alignItems: "center",
799
- justifyContent: "center",
800
- fontWeight: "bold",
801
- borderRadius: ".25rem",
802
- transition: "all .2s ease-out"
803
- }
804
- }
805
- ),
806
- /* @__PURE__ */ jsx(
807
- Code,
808
- {
809
- style: {
810
- padding: ".5em",
811
- fontSize: "0.7rem"
812
- },
813
- children: `${match.id}`
814
- }
815
- ),
816
- /* @__PURE__ */ jsx(AgeTicker, { match })
817
- ]
818
- },
819
- match.id || i
820
- );
821
- }) })
822
- ]
823
- }
824
- ),
825
- ((_a = routerState.cachedMatches) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxs(
826
- "div",
827
- {
828
- style: {
829
- flex: "1 1 auto",
830
- overflowY: "auto",
831
- maxHeight: "50%"
832
- },
833
- children: [
834
- /* @__PURE__ */ jsxs(
835
- "div",
425
+ /* @__PURE__ */ jsx(
426
+ "button",
836
427
  {
837
- style: {
838
- padding: ".5em",
839
- background: defaultTheme.backgroundAlt,
840
- position: "sticky",
841
- top: 0,
842
- zIndex: 1,
843
- display: "flex",
844
- alignItems: "center",
845
- justifyContent: "space-between",
846
- gap: ".5rem",
847
- fontWeight: "bold"
428
+ type: "button",
429
+ onClick: () => {
430
+ setShowMatches(true);
848
431
  },
849
- children: [
850
- /* @__PURE__ */ jsx("div", { children: "Cached Matches" }),
851
- /* @__PURE__ */ jsx(
852
- "div",
853
- {
854
- style: {
855
- opacity: 0.3,
856
- fontSize: "0.7rem",
857
- fontWeight: "normal"
858
- },
859
- children: "age / staleTime / gcTime"
860
- }
861
- )
862
- ]
432
+ disabled: showMatches,
433
+ className: clsx(
434
+ styles.routeMatchesToggleBtn(!!showMatches, false)
435
+ ),
436
+ children: "Matches"
863
437
  }
864
- ),
865
- /* @__PURE__ */ jsx("div", { children: routerState.cachedMatches.map((match) => {
866
- return /* @__PURE__ */ jsxs(
867
- "div",
868
- {
869
- role: "button",
870
- "aria-label": `Open match details for ${match.id}`,
871
- onClick: () => setActiveId(activeId === match.id ? "" : match.id),
872
- style: {
873
- display: "flex",
874
- borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
875
- cursor: "pointer",
876
- alignItems: "center",
877
- background: match === activeMatch ? "rgba(255,255,255,.1)" : void 0,
878
- fontSize: "0.7rem"
879
- },
880
- children: [
881
- /* @__PURE__ */ jsx(
882
- "div",
883
- {
884
- style: {
885
- flex: "0 0 auto",
886
- width: ".75rem",
887
- height: ".75rem",
888
- marginLeft: ".25rem",
889
- background: getStatusColor(match, defaultTheme),
890
- alignItems: "center",
891
- justifyContent: "center",
892
- fontWeight: "bold",
893
- borderRadius: "100%",
894
- transition: "all 1s ease-out"
895
- }
896
- }
897
- ),
898
- /* @__PURE__ */ jsx(
899
- Code,
900
- {
901
- style: {
902
- padding: ".5em"
903
- },
904
- children: `${match.id}`
905
- }
906
- ),
907
- /* @__PURE__ */ jsx("div", { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(AgeTicker, { match }) })
908
- ]
909
- },
910
- match.id
911
- );
912
- }) })
913
- ]
914
- }
915
- ) : null
916
- ]
917
- }
918
- ),
919
- activeMatch ? /* @__PURE__ */ jsxs(ActivePanel, { children: [
920
- /* @__PURE__ */ jsx(
921
- "div",
922
- {
923
- style: {
924
- padding: ".5em",
925
- background: defaultTheme.backgroundAlt,
926
- position: "sticky",
927
- top: 0,
928
- bottom: 0,
929
- zIndex: 1
930
- },
931
- children: "Match Details"
932
- }
933
- ),
934
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
935
- "table",
936
- {
937
- style: {
938
- fontSize: "0.8rem"
939
- },
940
- children: /* @__PURE__ */ jsxs("tbody", { children: [
941
- /* @__PURE__ */ jsxs("tr", { children: [
942
- /* @__PURE__ */ jsx("td", { style: { opacity: ".5" }, children: "ID" }),
943
- /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(
944
- Code,
438
+ )
439
+ ] }),
440
+ /* @__PURE__ */ jsx("div", { className: styles.detailsHeaderInfo, children: /* @__PURE__ */ jsx("div", { children: "age / staleTime / gcTime" }) })
441
+ ] }),
442
+ !showMatches ? /* @__PURE__ */ jsx(
443
+ RouteComp,
444
+ {
445
+ route: router.routeTree,
446
+ isRoot: true,
447
+ activeId,
448
+ setActiveId
449
+ }
450
+ ) : /* @__PURE__ */ jsx("div", { children: (routerState.status === "pending" ? routerState.pendingMatches ?? [] : routerState.matches).map((match, i) => {
451
+ return /* @__PURE__ */ jsxs(
452
+ "div",
945
453
  {
946
- style: {
947
- lineHeight: "1.8em"
948
- },
949
- children: JSON.stringify(activeMatch.id, null, 2)
950
- }
951
- ) })
454
+ role: "button",
455
+ "aria-label": `Open match details for ${match.id}`,
456
+ onClick: () => setActiveId(activeId === match.id ? "" : match.id),
457
+ className: clsx(styles.matchRow(match === activeMatch)),
458
+ children: [
459
+ /* @__PURE__ */ jsx(
460
+ "div",
461
+ {
462
+ className: clsx(
463
+ styles.matchIndicator(getStatusColor(match))
464
+ )
465
+ }
466
+ ),
467
+ /* @__PURE__ */ jsx(
468
+ "code",
469
+ {
470
+ className: styles.matchID,
471
+ children: `${match.routeId === "__root__" ? "__root__" : match.pathname}`
472
+ }
473
+ ),
474
+ /* @__PURE__ */ jsx(AgeTicker, { match })
475
+ ]
476
+ },
477
+ match.id || i
478
+ );
479
+ }) })
480
+ ] }),
481
+ ((_a = routerState.cachedMatches) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsxs("div", { className: styles.cachedMatchesContainer, children: [
482
+ /* @__PURE__ */ jsxs("div", { className: styles.detailsHeader, children: [
483
+ /* @__PURE__ */ jsx("div", { children: "Cached Matches" }),
484
+ /* @__PURE__ */ jsx("div", { className: styles.detailsHeaderInfo, children: "age / staleTime / gcTime" })
952
485
  ] }),
953
- /* @__PURE__ */ jsxs("tr", { children: [
954
- /* @__PURE__ */ jsx("td", { style: { opacity: ".5" }, children: "Status" }),
955
- /* @__PURE__ */ jsxs("td", { children: [
956
- ((_b = routerState.pendingMatches) == null ? void 0 : _b.find(
957
- (d) => d.id === activeMatch.id
958
- )) ? "Pending" : ((_c = routerState.matches) == null ? void 0 : _c.find(
959
- (d) => d.id === activeMatch.id
960
- )) ? "Active" : "Cached",
961
- " ",
962
- "- ",
963
- activeMatch.status
964
- ] })
486
+ /* @__PURE__ */ jsx("div", { children: routerState.cachedMatches.map((match) => {
487
+ return /* @__PURE__ */ jsxs(
488
+ "div",
489
+ {
490
+ role: "button",
491
+ "aria-label": `Open match details for ${match.id}`,
492
+ onClick: () => setActiveId(activeId === match.id ? "" : match.id),
493
+ className: clsx(styles.matchRow(match === activeMatch)),
494
+ children: [
495
+ /* @__PURE__ */ jsx(
496
+ "div",
497
+ {
498
+ className: clsx(
499
+ styles.matchIndicator(getStatusColor(match))
500
+ )
501
+ }
502
+ ),
503
+ /* @__PURE__ */ jsx("code", { className: styles.matchID, children: `${match.id}` }),
504
+ /* @__PURE__ */ jsx(AgeTicker, { match })
505
+ ]
506
+ },
507
+ match.id
508
+ );
509
+ }) })
510
+ ] }) : null
511
+ ] }),
512
+ activeMatch ? /* @__PURE__ */ jsxs("div", { className: styles.thirdContainer, children: [
513
+ /* @__PURE__ */ jsx("div", { className: styles.detailsHeader, children: "Match Details" }),
514
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: styles.matchDetails, children: [
515
+ /* @__PURE__ */ jsx(
516
+ "div",
517
+ {
518
+ className: styles.matchStatus(
519
+ activeMatch.status,
520
+ activeMatch.isFetching
521
+ ),
522
+ children: /* @__PURE__ */ jsx("div", { children: activeMatch.status === "success" && activeMatch.isFetching ? "fetching" : activeMatch.status })
523
+ }
524
+ ),
525
+ /* @__PURE__ */ jsxs("div", { className: styles.matchDetailsInfoLabel, children: [
526
+ /* @__PURE__ */ jsx("div", { children: "ID:" }),
527
+ /* @__PURE__ */ jsx("div", { className: styles.matchDetailsInfo, children: /* @__PURE__ */ jsx("code", { children: activeMatch.id }) })
528
+ ] }),
529
+ /* @__PURE__ */ jsxs("div", { className: styles.matchDetailsInfoLabel, children: [
530
+ /* @__PURE__ */ jsx("div", { children: "State:" }),
531
+ /* @__PURE__ */ jsx("div", { className: styles.matchDetailsInfo, children: ((_b = routerState.pendingMatches) == null ? void 0 : _b.find(
532
+ (d) => d.id === activeMatch.id
533
+ )) ? "Pending" : ((_c = routerState.matches) == null ? void 0 : _c.find((d) => d.id === activeMatch.id)) ? "Active" : "Cached" })
965
534
  ] }),
966
- /* @__PURE__ */ jsxs("tr", { children: [
967
- /* @__PURE__ */ jsx("td", { style: { opacity: ".5" }, children: "Last Updated" }),
968
- /* @__PURE__ */ jsx("td", { children: activeMatch.updatedAt ? new Date(
535
+ /* @__PURE__ */ jsxs("div", { className: styles.matchDetailsInfoLabel, children: [
536
+ /* @__PURE__ */ jsx("div", { children: "Last Updated:" }),
537
+ /* @__PURE__ */ jsx("div", { className: styles.matchDetailsInfo, children: activeMatch.updatedAt ? new Date(
969
538
  activeMatch.updatedAt
970
539
  ).toLocaleTimeString() : "N/A" })
971
540
  ] })
972
- ] })
973
- }
974
- ) }),
975
- activeMatch.loaderData ? /* @__PURE__ */ jsxs(Fragment, { children: [
976
- /* @__PURE__ */ jsx(
977
- "div",
978
- {
979
- style: {
980
- background: defaultTheme.backgroundAlt,
981
- padding: ".5em",
982
- position: "sticky",
983
- top: 0,
984
- bottom: 0,
985
- zIndex: 1
986
- },
987
- children: "Loader Data"
988
- }
989
- ),
990
- /* @__PURE__ */ jsx(
991
- "div",
992
- {
993
- style: {
994
- padding: ".5em"
995
- },
996
- children: /* @__PURE__ */ jsx(
541
+ ] }) }),
542
+ activeMatch.loaderData ? /* @__PURE__ */ jsxs(Fragment, { children: [
543
+ /* @__PURE__ */ jsx("div", { className: styles.detailsHeader, children: "Loader Data" }),
544
+ /* @__PURE__ */ jsx("div", { className: styles.detailsContent, children: /* @__PURE__ */ jsx(
997
545
  Explorer,
998
546
  {
999
547
  label: "loaderData",
1000
548
  value: activeMatch.loaderData,
1001
549
  defaultExpanded: {}
1002
550
  }
1003
- )
1004
- }
1005
- )
1006
- ] }) : null,
1007
- /* @__PURE__ */ jsx(
1008
- "div",
1009
- {
1010
- style: {
1011
- background: defaultTheme.backgroundAlt,
1012
- padding: ".5em",
1013
- position: "sticky",
1014
- top: 0,
1015
- bottom: 0,
1016
- zIndex: 1
1017
- },
1018
- children: "Explorer"
1019
- }
1020
- ),
1021
- /* @__PURE__ */ jsx(
1022
- "div",
1023
- {
1024
- style: {
1025
- padding: ".5em"
1026
- },
1027
- children: /* @__PURE__ */ jsx(
551
+ ) })
552
+ ] }) : null,
553
+ /* @__PURE__ */ jsx("div", { className: styles.detailsHeader, children: "Explorer" }),
554
+ /* @__PURE__ */ jsx("div", { className: styles.detailsContent, children: /* @__PURE__ */ jsx(Explorer, { label: "Match", value: activeMatch, defaultExpanded: {} }) })
555
+ ] }) : null,
556
+ hasSearch ? /* @__PURE__ */ jsxs("div", { className: styles.fourthContainer, children: [
557
+ /* @__PURE__ */ jsx("div", { className: styles.detailsHeader, children: "Search Params" }),
558
+ /* @__PURE__ */ jsx("div", { className: styles.detailsContent, children: /* @__PURE__ */ jsx(
1028
559
  Explorer,
1029
560
  {
1030
- label: "Match",
1031
- value: activeMatch,
1032
- defaultExpanded: {}
561
+ value: routerState.location.search || {},
562
+ defaultExpanded: Object.keys(
563
+ routerState.location.search || {}
564
+ ).reduce((obj, next) => {
565
+ obj[next] = {};
566
+ return obj;
567
+ }, {})
1033
568
  }
1034
- )
1035
- }
1036
- )
1037
- ] }) : null,
1038
- hasSearch ? /* @__PURE__ */ jsxs(
1039
- "div",
1040
- {
1041
- style: {
1042
- flex: "1 1 500px",
1043
- minHeight: "40%",
1044
- maxHeight: "100%",
1045
- overflow: "auto",
1046
- borderRight: `1px solid ${defaultTheme.grayAlt}`,
1047
- display: "flex",
1048
- flexDirection: "column"
1049
- },
1050
- children: [
1051
- /* @__PURE__ */ jsx(
1052
- "div",
1053
- {
1054
- style: {
1055
- padding: ".5em",
1056
- background: defaultTheme.backgroundAlt,
1057
- position: "sticky",
1058
- top: 0,
1059
- bottom: 0,
1060
- zIndex: 1,
1061
- fontWeight: "bold"
1062
- },
1063
- children: "Search Params"
1064
- }
1065
- ),
1066
- /* @__PURE__ */ jsx(
1067
- "div",
1068
- {
1069
- style: {
1070
- padding: ".5em"
1071
- },
1072
- children: /* @__PURE__ */ jsx(
1073
- Explorer,
1074
- {
1075
- value: routerState.location.search || {},
1076
- defaultExpanded: Object.keys(
1077
- routerState.location.search || {}
1078
- ).reduce((obj, next) => {
1079
- obj[next] = {};
1080
- return obj;
1081
- }, {})
1082
- }
1083
- )
1084
- }
1085
- )
1086
- ]
1087
- }
1088
- ) : null
1089
- ] }) });
569
+ ) })
570
+ ] }) : null
571
+ ]
572
+ }
573
+ );
1090
574
  });
1091
575
  function AgeTicker({ match }) {
1092
576
  const router = useRouter();
@@ -1112,24 +596,13 @@ function AgeTicker({ match }) {
1112
596
  const age = Date.now() - (match == null ? void 0 : match.updatedAt);
1113
597
  const staleTime = route.options.staleTime ?? router.options.defaultStaleTime ?? 0;
1114
598
  const gcTime = route.options.gcTime ?? router.options.defaultGcTime ?? 30 * 60 * 1e3;
1115
- return /* @__PURE__ */ jsxs(
1116
- "div",
1117
- {
1118
- style: {
1119
- display: "inline-flex",
1120
- alignItems: "center",
1121
- gap: ".25rem",
1122
- color: age > staleTime ? defaultTheme.warning : void 0
1123
- },
1124
- children: [
1125
- /* @__PURE__ */ jsx("div", { style: {}, children: formatTime(age) }),
1126
- /* @__PURE__ */ jsx("div", { children: "/" }),
1127
- /* @__PURE__ */ jsx("div", { children: formatTime(staleTime) }),
1128
- /* @__PURE__ */ jsx("div", { children: "/" }),
1129
- /* @__PURE__ */ jsx("div", { children: formatTime(gcTime) })
1130
- ]
1131
- }
1132
- );
599
+ return /* @__PURE__ */ jsxs("div", { className: clsx(styles.ageTicker(age > staleTime)), children: [
600
+ /* @__PURE__ */ jsx("div", { children: formatTime(age) }),
601
+ /* @__PURE__ */ jsx("div", { children: "/" }),
602
+ /* @__PURE__ */ jsx("div", { children: formatTime(staleTime) }),
603
+ /* @__PURE__ */ jsx("div", { children: "/" }),
604
+ /* @__PURE__ */ jsx("div", { children: formatTime(gcTime) })
605
+ ] });
1133
606
  }
1134
607
  function formatTime(ms) {
1135
608
  const units = ["s", "min", "h", "d"];
@@ -1147,6 +620,540 @@ function formatTime(ms) {
1147
620
  });
1148
621
  return formatter.format(values[chosenUnitIndex]) + units[chosenUnitIndex];
1149
622
  }
623
+ const stylesFactory = () => {
624
+ const { colors, font, size, alpha, shadow, border } = tokens;
625
+ const { fontFamily, lineHeight, size: fontSize } = font;
626
+ return {
627
+ devtoolsPanelContainer: css`
628
+ direction: ltr;
629
+ position: fixed;
630
+ bottom: 0;
631
+ right: 0;
632
+ z-index: 99999;
633
+ width: 100%;
634
+ max-height: 90%;
635
+ border-top: 1px solid ${colors.gray[700]};
636
+ transform-origin: top;
637
+ `,
638
+ devtoolsPanelContainerVisibility: (isOpen) => {
639
+ return css`
640
+ visibility: ${isOpen ? "visible" : "hidden"};
641
+ `;
642
+ },
643
+ devtoolsPanelContainerResizing: (isResizing) => {
644
+ if (isResizing) {
645
+ return css`
646
+ transition: none;
647
+ `;
648
+ }
649
+ return css`
650
+ transition: all 0.4s ease;
651
+ `;
652
+ },
653
+ devtoolsPanelContainerAnimation: (isOpen, height) => {
654
+ if (isOpen) {
655
+ return css`
656
+ pointer-events: auto;
657
+ transform: translateY(0);
658
+ `;
659
+ }
660
+ return css`
661
+ pointer-events: none;
662
+ transform: translateY(${height}px);
663
+ `;
664
+ },
665
+ logo: css`
666
+ cursor: pointer;
667
+ display: flex;
668
+ flex-direction: column;
669
+ background-color: transparent;
670
+ border: none;
671
+ font-family: ${fontFamily.sans};
672
+ gap: ${tokens.size[0.5]};
673
+ padding: 0px;
674
+ &:hover {
675
+ opacity: 0.7;
676
+ }
677
+ &:focus-visible {
678
+ outline-offset: 4px;
679
+ border-radius: ${border.radius.xs};
680
+ outline: 2px solid ${colors.blue[800]};
681
+ }
682
+ `,
683
+ tanstackLogo: css`
684
+ font-size: ${font.size.md};
685
+ font-weight: ${font.weight.bold};
686
+ line-height: ${font.lineHeight.xs};
687
+ white-space: nowrap;
688
+ color: ${colors.gray[300]};
689
+ `,
690
+ routerLogo: css`
691
+ font-weight: ${font.weight.semibold};
692
+ font-size: ${font.size.xs};
693
+ background: linear-gradient(to right, #84cc16, #10b981);
694
+ background-clip: text;
695
+ -webkit-background-clip: text;
696
+ line-height: 1;
697
+ -webkit-text-fill-color: transparent;
698
+ white-space: nowrap;
699
+ `,
700
+ devtoolsPanel: css`
701
+ display: flex;
702
+ font-size: ${fontSize.sm};
703
+ font-family: ${fontFamily.sans};
704
+ background-color: ${colors.darkGray[700]};
705
+ color: ${colors.gray[300]};
706
+
707
+ @media (max-width: 700px) {
708
+ flex-direction: column;
709
+ }
710
+ @media (max-width: 600px) {
711
+ font-size: ${fontSize.xs};
712
+ }
713
+ `,
714
+ dragHandle: css`
715
+ position: absolute;
716
+ left: 0;
717
+ top: 0;
718
+ width: 100%;
719
+ height: 4px;
720
+ cursor: row-resize;
721
+ z-index: 100000;
722
+ &:hover {
723
+ background-color: ${colors.purple[400]}${alpha[90]};
724
+ }
725
+ `,
726
+ firstContainer: css`
727
+ flex: 1 1 500px;
728
+ min-height: 40%;
729
+ max-height: 100%;
730
+ overflow: auto;
731
+ border-right: 1px solid ${colors.gray[700]};
732
+ display: flex;
733
+ flex-direction: column;
734
+ `,
735
+ routerExplorerContainer: css`
736
+ overflow-y: auto;
737
+ flex: 1;
738
+ `,
739
+ routerExplorer: css`
740
+ padding: ${tokens.size[2]};
741
+ `,
742
+ row: css`
743
+ display: flex;
744
+ align-items: center;
745
+ padding: ${tokens.size[2]} ${tokens.size[2.5]};
746
+ gap: ${tokens.size[2.5]};
747
+ border-bottom: ${colors.darkGray[500]} 1px solid;
748
+ align-items: center;
749
+ `,
750
+ detailsHeader: css`
751
+ font-family: ui-sans-serif, Inter, system-ui, sans-serif, sans-serif;
752
+ position: sticky;
753
+ top: 0;
754
+ z-index: 2;
755
+ background-color: ${colors.darkGray[600]};
756
+ padding: 0px ${tokens.size[2]};
757
+ font-weight: ${font.weight.medium};
758
+ font-size: ${font.size.xs};
759
+ min-height: ${tokens.size[8]};
760
+ line-height: ${font.lineHeight.xs};
761
+ text-align: left;
762
+ display: flex;
763
+ align-items: center;
764
+ `,
765
+ maskedBadge: css`
766
+ background: ${colors.yellow[900]}${alpha[70]};
767
+ color: ${colors.yellow[300]};
768
+ display: inline-block;
769
+ padding: ${tokens.size[0]} ${tokens.size[2.5]};
770
+ border-radius: ${border.radius.full};
771
+ font-size: ${font.size.xs};
772
+ font-weight: ${font.weight.normal};
773
+ border: 1px solid ${colors.yellow[300]};
774
+ `,
775
+ maskedLocation: css`
776
+ color: ${colors.yellow[300]};
777
+ `,
778
+ detailsContent: css`
779
+ padding: ${tokens.size[1.5]} ${tokens.size[2]};
780
+ display: flex;
781
+ align-items: center;
782
+ font-size: ${font.size.xs};
783
+ `,
784
+ routeMatchesToggle: css`
785
+ display: flex;
786
+ align-items: center;
787
+ border: 1px solid ${colors.gray[500]};
788
+ border-radius: ${border.radius.sm};
789
+ overflow: hidden;
790
+ `,
791
+ routeMatchesToggleBtn: (active, showBorder) => {
792
+ const base = css`
793
+ appearance: none;
794
+ border: none;
795
+ font-size: 12px;
796
+ padding: 4px 8px;
797
+ background: transparent;
798
+ cursor: pointer;
799
+ font-family: ${fontFamily.sans};
800
+ font-weight: ${font.weight.medium};
801
+ `;
802
+ const classes = [base];
803
+ if (active) {
804
+ const activeStyles = css`
805
+ background: ${colors.darkGray[400]};
806
+ color: ${colors.gray[300]};
807
+ `;
808
+ classes.push(activeStyles);
809
+ } else {
810
+ const inactiveStyles = css`
811
+ color: ${colors.gray[500]};
812
+ background: ${colors.darkGray[800]}${alpha[20]};
813
+ `;
814
+ classes.push(inactiveStyles);
815
+ }
816
+ if (showBorder) {
817
+ const border2 = css`
818
+ border-right: 1px solid ${tokens.colors.gray[500]};
819
+ `;
820
+ classes.push(border2);
821
+ }
822
+ return classes;
823
+ },
824
+ detailsHeaderInfo: css`
825
+ flex: 1;
826
+ justify-content: flex-end;
827
+ display: flex;
828
+ align-items: center;
829
+ font-weight: ${font.weight.normal};
830
+ color: ${colors.gray[400]};
831
+ `,
832
+ matchRow: (active) => {
833
+ const base = css`
834
+ display: flex;
835
+ border-bottom: 1px solid ${colors.darkGray[400]};
836
+ cursor: pointer;
837
+ align-items: center;
838
+ padding: ${size[1]} ${size[2]};
839
+ gap: ${size[2]};
840
+ font-size: ${fontSize.xs};
841
+ color: ${colors.gray[300]};
842
+ `;
843
+ const classes = [base];
844
+ if (active) {
845
+ const activeStyles = css`
846
+ background: ${colors.darkGray[500]};
847
+ `;
848
+ classes.push(activeStyles);
849
+ }
850
+ return classes;
851
+ },
852
+ matchIndicator: (color) => {
853
+ const base = css`
854
+ flex: 0 0 auto;
855
+ width: ${size[3]};
856
+ height: ${size[3]};
857
+ background: ${colors[color][900]};
858
+ border: 1px solid ${colors[color][500]};
859
+ border-radius: ${border.radius.full};
860
+ transition: all 0.25s ease-out;
861
+ box-sizing: border-box;
862
+ `;
863
+ const classes = [base];
864
+ if (color === "gray") {
865
+ const grayStyles = css`
866
+ background: ${colors.gray[700]};
867
+ border-color: ${colors.gray[400]};
868
+ `;
869
+ classes.push(grayStyles);
870
+ }
871
+ return classes;
872
+ },
873
+ matchID: css`
874
+ flex: 1;
875
+ line-height: ${lineHeight["xs"]};
876
+ `,
877
+ ageTicker: (showWarning) => {
878
+ const base = css`
879
+ display: flex;
880
+ gap: ${size[1]};
881
+ font-size: ${fontSize.xs};
882
+ color: ${colors.gray[400]};
883
+ font-variant-numeric: tabular-nums;
884
+ line-height: ${lineHeight["xs"]};
885
+ `;
886
+ const classes = [base];
887
+ if (showWarning) {
888
+ const warningStyles = css`
889
+ color: ${colors.yellow[400]};
890
+ `;
891
+ classes.push(warningStyles);
892
+ }
893
+ return classes;
894
+ },
895
+ secondContainer: css`
896
+ flex: 1 1 500px;
897
+ min-height: 40%;
898
+ max-height: 100%;
899
+ overflow: auto;
900
+ border-right: 1px solid ${colors.gray[700]};
901
+ display: flex;
902
+ flex-direction: column;
903
+ `,
904
+ thirdContainer: css`
905
+ flex: 1 1 500px;
906
+ overflow: auto;
907
+ display: flex;
908
+ flex-direction: column;
909
+ height: 100%;
910
+ border-right: 1px solid ${colors.gray[700]};
911
+
912
+ @media (max-width: 700px) {
913
+ border-top: 2px solid ${colors.gray[700]};
914
+ }
915
+ `,
916
+ fourthContainer: css`
917
+ flex: 1 1 500px;
918
+ min-height: 40%;
919
+ max-height: 100%;
920
+ overflow: auto;
921
+ display: flex;
922
+ flex-direction: column;
923
+ `,
924
+ routesRowContainer: (active, isMatch) => {
925
+ const base = css`
926
+ display: flex;
927
+ border-bottom: 1px solid ${colors.darkGray[400]};
928
+ align-items: center;
929
+ padding: ${size[1]} ${size[2]};
930
+ gap: ${size[2]};
931
+ font-size: ${fontSize.xs};
932
+ color: ${colors.gray[300]};
933
+ cursor: ${isMatch ? "pointer" : "default"};
934
+ line-height: ${lineHeight["xs"]};
935
+ `;
936
+ const classes = [base];
937
+ if (active) {
938
+ const activeStyles = css`
939
+ background: ${colors.darkGray[500]};
940
+ `;
941
+ classes.push(activeStyles);
942
+ }
943
+ return classes;
944
+ },
945
+ routesRow: (isMatch) => {
946
+ const base = css`
947
+ flex: 1 0 auto;
948
+ display: flex;
949
+ justify-content: space-between;
950
+ align-items: center;
951
+ font-size: ${fontSize.xs};
952
+ line-height: ${lineHeight["xs"]};
953
+ `;
954
+ const classes = [base];
955
+ if (!isMatch) {
956
+ const matchStyles = css`
957
+ color: ${colors.gray[400]};
958
+ `;
959
+ classes.push(matchStyles);
960
+ }
961
+ return classes;
962
+ },
963
+ routeParamInfo: css`
964
+ color: ${colors.gray[400]};
965
+ font-size: ${fontSize.xs};
966
+ line-height: ${lineHeight["xs"]};
967
+ `,
968
+ nestedRouteRow: (isRoot) => {
969
+ const base = css`
970
+ margin-left: ${isRoot ? 0 : size[3.5]};
971
+ border-left: ${isRoot ? "" : `solid 1px ${colors.gray[700]}`};
972
+ `;
973
+ return base;
974
+ },
975
+ code: css`
976
+ font-size: ${fontSize.xs};
977
+ line-height: ${lineHeight["xs"]};
978
+ `,
979
+ matchesContainer: css`
980
+ flex: 1 1 auto;
981
+ overflow-y: auto;
982
+ `,
983
+ cachedMatchesContainer: css`
984
+ flex: 1 1 auto;
985
+ overflow-y: auto;
986
+ max-height: 50%;
987
+ `,
988
+ maskedBadgeContainer: css`
989
+ flex: 1;
990
+ justify-content: flex-end;
991
+ display: flex;
992
+ `,
993
+ matchDetails: css`
994
+ display: flex;
995
+ flex-direction: column;
996
+ padding: ${tokens.size[2]};
997
+ font-size: ${tokens.font.size.xs};
998
+ color: ${tokens.colors.gray[300]};
999
+ line-height: ${tokens.font.lineHeight.sm};
1000
+ `,
1001
+ matchStatus: (status, isFetching) => {
1002
+ const colorMap = {
1003
+ pending: "yellow",
1004
+ success: "green",
1005
+ error: "red"
1006
+ };
1007
+ const color = isFetching && status === "success" ? "blue" : colorMap[status];
1008
+ return css`
1009
+ display: flex;
1010
+ justify-content: center;
1011
+ align-items: center;
1012
+ height: 40px;
1013
+ border-radius: ${tokens.border.radius.sm};
1014
+ font-weight: ${tokens.font.weight.normal};
1015
+ background-color: ${tokens.colors[color][900]}${tokens.alpha[90]};
1016
+ color: ${tokens.colors[color][300]};
1017
+ border: 1px solid ${tokens.colors[color][600]};
1018
+ margin-bottom: ${tokens.size[2]};
1019
+ transition: all 0.25s ease-out;
1020
+ `;
1021
+ },
1022
+ matchDetailsInfo: css`
1023
+ display: flex;
1024
+ justify-content: flex-end;
1025
+ flex: 1;
1026
+ `,
1027
+ matchDetailsInfoLabel: css`
1028
+ display: flex;
1029
+ `,
1030
+ mainCloseBtn: css`
1031
+ background: ${colors.darkGray[700]};
1032
+ padding: ${size[1]} ${size[2]} ${size[1]} ${size[1.5]};
1033
+ border-radius: ${border.radius.md};
1034
+ position: fixed;
1035
+ z-index: 99999;
1036
+ display: inline-flex;
1037
+ width: fit-content;
1038
+ cursor: pointer;
1039
+ appearance: none;
1040
+ border: 0;
1041
+ gap: 8px;
1042
+ align-items: center;
1043
+ border: 1px solid ${colors.gray[500]};
1044
+ font-size: ${font.size.xs};
1045
+ cursor: pointer;
1046
+ transition: all 0.25s ease-out;
1047
+
1048
+ &:hover {
1049
+ background: ${colors.darkGray[500]};
1050
+ }
1051
+ `,
1052
+ mainCloseBtnPosition: (position) => {
1053
+ const base = css`
1054
+ ${position === "top-left" ? `top: ${size[2]}; left: ${size[2]};` : ""}
1055
+ ${position === "top-right" ? `top: ${size[2]}; right: ${size[2]};` : ""}
1056
+ ${position === "bottom-left" ? `bottom: ${size[2]}; left: ${size[2]};` : ""}
1057
+ ${position === "bottom-right" ? `bottom: ${size[2]}; right: ${size[2]};` : ""}
1058
+ `;
1059
+ return base;
1060
+ },
1061
+ mainCloseBtnAnimation: (isOpen) => {
1062
+ if (isOpen) {
1063
+ return css`
1064
+ opacity: 1;
1065
+ pointer-events: auto;
1066
+ visibility: visible;
1067
+ `;
1068
+ }
1069
+ return css`
1070
+ opacity: 0;
1071
+ pointer-events: none;
1072
+ visibility: hidden;
1073
+ `;
1074
+ },
1075
+ routerLogoCloseButton: css`
1076
+ font-weight: ${font.weight.semibold};
1077
+ font-size: ${font.size.xs};
1078
+ background: linear-gradient(to right, #98f30c, #00f4a3);
1079
+ background-clip: text;
1080
+ -webkit-background-clip: text;
1081
+ line-height: 1;
1082
+ -webkit-text-fill-color: transparent;
1083
+ white-space: nowrap;
1084
+ `,
1085
+ mainCloseBtnDivider: css`
1086
+ width: 1px;
1087
+ background: ${tokens.colors.gray[600]};
1088
+ height: 100%;
1089
+ border-radius: 999999px;
1090
+ color: transparent;
1091
+ `,
1092
+ mainCloseBtnIconContainer: css`
1093
+ position: relative;
1094
+ width: ${size[5]};
1095
+ height: ${size[5]};
1096
+ background: pink;
1097
+ border-radius: 999999px;
1098
+ overflow: hidden;
1099
+ `,
1100
+ mainCloseBtnIconOuter: css`
1101
+ width: ${size[5]};
1102
+ height: ${size[5]};
1103
+ position: absolute;
1104
+ top: 50%;
1105
+ left: 50%;
1106
+ transform: translate(-50%, -50%);
1107
+ filter: blur(3px) saturate(1.8) contrast(2);
1108
+ `,
1109
+ mainCloseBtnIconInner: css`
1110
+ width: ${size[4]};
1111
+ height: ${size[4]};
1112
+ position: absolute;
1113
+ top: 50%;
1114
+ left: 50%;
1115
+ transform: translate(-50%, -50%);
1116
+ `,
1117
+ panelCloseBtn: css`
1118
+ position: absolute;
1119
+ cursor: pointer;
1120
+ z-index: 100001;
1121
+ display: flex;
1122
+ align-items: center;
1123
+ justify-content: center;
1124
+ outline: none;
1125
+ background-color: ${colors.darkGray[700]};
1126
+ &:hover {
1127
+ background-color: ${colors.darkGray[500]};
1128
+ }
1129
+
1130
+ top: 0;
1131
+ right: ${size[2]};
1132
+ transform: translate(0, -100%);
1133
+ border-right: ${colors.darkGray[300]} 1px solid;
1134
+ border-left: ${colors.darkGray[300]} 1px solid;
1135
+ border-top: ${colors.darkGray[300]} 1px solid;
1136
+ border-bottom: none;
1137
+ border-radius: ${border.radius.sm} ${border.radius.sm} 0px 0px;
1138
+ padding: ${size[1]} ${size[1.5]} ${size[0.5]} ${size[1.5]};
1139
+
1140
+ &::after {
1141
+ content: ' ';
1142
+ position: absolute;
1143
+ top: 100%;
1144
+ left: -${size[2.5]};
1145
+ height: ${size[1.5]};
1146
+ width: calc(100% + ${size[5]});
1147
+ }
1148
+ `,
1149
+ panelCloseBtnIcon: css`
1150
+ color: ${colors.gray[400]};
1151
+ width: ${size[2]};
1152
+ height: ${size[2]};
1153
+ `
1154
+ };
1155
+ };
1156
+ const styles = stylesFactory();
1150
1157
  export {
1151
1158
  TanStackRouterDevtools,
1152
1159
  TanStackRouterDevtoolsPanel