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