@tanstack/devtools 0.6.7 → 0.6.8
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/chunk/CEHNENNI.js +251 -0
- package/dist/{esm/core.js → dev.js} +10 -12
- package/dist/devtools/DJF65R3Y.js +1674 -0
- package/dist/devtools/ITBBRMTQ.js +1966 -0
- package/dist/index.d.ts +168 -0
- package/dist/index.js +76 -0
- package/dist/server.js +44 -0
- package/package.json +21 -12
- package/src/core.tsx +3 -0
- package/dist/esm/components/content-panel.d.ts +0 -6
- package/dist/esm/components/content-panel.js +0 -32
- package/dist/esm/components/content-panel.js.map +0 -1
- package/dist/esm/components/main-panel.d.ts +0 -6
- package/dist/esm/components/main-panel.js +0 -42
- package/dist/esm/components/main-panel.js.map +0 -1
- package/dist/esm/components/tab-content.d.ts +0 -2
- package/dist/esm/components/tab-content.js +0 -23
- package/dist/esm/components/tab-content.js.map +0 -1
- package/dist/esm/components/tabs.d.ts +0 -5
- package/dist/esm/components/tabs.js +0 -75
- package/dist/esm/components/tabs.js.map +0 -1
- package/dist/esm/components/trigger.d.ts +0 -5
- package/dist/esm/components/trigger.js +0 -31
- package/dist/esm/components/trigger.js.map +0 -1
- package/dist/esm/constants.d.ts +0 -2
- package/dist/esm/constants.js +0 -7
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/context/devtools-context.d.ts +0 -62
- package/dist/esm/context/devtools-context.js +0 -77
- package/dist/esm/context/devtools-context.js.map +0 -1
- package/dist/esm/context/devtools-store.d.ts +0 -59
- package/dist/esm/context/devtools-store.js +0 -29
- package/dist/esm/context/devtools-store.js.map +0 -1
- package/dist/esm/context/draw-context.d.ts +0 -13
- package/dist/esm/context/draw-context.js +0 -55
- package/dist/esm/context/draw-context.js.map +0 -1
- package/dist/esm/context/pip-context.d.ts +0 -14
- package/dist/esm/context/pip-context.js +0 -117
- package/dist/esm/context/pip-context.js.map +0 -1
- package/dist/esm/context/use-devtools-context.d.ts +0 -40
- package/dist/esm/context/use-devtools-context.js +0 -96
- package/dist/esm/context/use-devtools-context.js.map +0 -1
- package/dist/esm/core.d.ts +0 -39
- package/dist/esm/core.js.map +0 -1
- package/dist/esm/devtools.d.ts +0 -1
- package/dist/esm/devtools.js +0 -200
- package/dist/esm/devtools.js.map +0 -1
- package/dist/esm/hooks/use-disable-tabbing.d.ts +0 -6
- package/dist/esm/hooks/use-disable-tabbing.js +0 -23
- package/dist/esm/hooks/use-disable-tabbing.js.map +0 -1
- package/dist/esm/hooks/use-head-changes.d.ts +0 -39
- package/dist/esm/hooks/use-head-changes.js +0 -65
- package/dist/esm/hooks/use-head-changes.js.map +0 -1
- package/dist/esm/index.d.ts +0 -4
- package/dist/esm/index.js +0 -8
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/styles/tokens.d.ts +0 -298
- package/dist/esm/styles/tokens.js +0 -63
- package/dist/esm/styles/tokens.js.map +0 -1
- package/dist/esm/styles/use-styles.d.ts +0 -42
- package/dist/esm/styles/use-styles.js +0 -422
- package/dist/esm/styles/use-styles.js.map +0 -1
- package/dist/esm/tabs/index.d.ts +0 -17
- package/dist/esm/tabs/index.js +0 -25
- package/dist/esm/tabs/index.js.map +0 -1
- package/dist/esm/tabs/plugins-tab.d.ts +0 -1
- package/dist/esm/tabs/plugins-tab.js +0 -88
- package/dist/esm/tabs/plugins-tab.js.map +0 -1
- package/dist/esm/tabs/seo-tab.d.ts +0 -1
- package/dist/esm/tabs/seo-tab.js +0 -296
- package/dist/esm/tabs/seo-tab.js.map +0 -1
- package/dist/esm/tabs/settings-tab.d.ts +0 -1
- package/dist/esm/tabs/settings-tab.js +0 -308
- package/dist/esm/tabs/settings-tab.js.map +0 -1
- package/dist/esm/utils/sanitize.d.ts +0 -3
- package/dist/esm/utils/sanitize.js +0 -31
- package/dist/esm/utils/sanitize.js.map +0 -1
- package/dist/esm/utils/storage.d.ts +0 -5
- package/dist/esm/utils/storage.js +0 -19
- package/dist/esm/utils/storage.js.map +0 -1
|
@@ -0,0 +1,1674 @@
|
|
|
1
|
+
import { usePiPWindow, keyboardModifiers, getAllPermutations, TANSTACK_DEVTOOLS, DevtoolsContext, PLUGIN_TITLE_CONTAINER_ID, PLUGIN_CONTAINER_ID, uppercaseFirstLetter } from '../chunk/CEHNENNI.js';
|
|
2
|
+
import { createComponent, Portal, ssr, ssrAttribute, escape } from 'solid-js/web';
|
|
3
|
+
import { createContext, createSignal, createEffect, onCleanup, Show, createMemo, For, useContext, onMount } from 'solid-js';
|
|
4
|
+
import { createShortcut } from '@solid-primitives/keyboard';
|
|
5
|
+
import { ThemeContextProvider, TanStackLogo, MainPanel as MainPanel$1, Section, SectionTitle, SectionIcon, SectionDescription, Checkbox, Select, Input, Button } from '@tanstack/devtools-ui';
|
|
6
|
+
import clsx3 from 'clsx';
|
|
7
|
+
import * as goober from 'goober';
|
|
8
|
+
import { PiP, X, List, PageSearch, Cogs, SettingsCog, Link, Keyboard, GeoTag, SocialBubble } from '@tanstack/devtools-ui/icons';
|
|
9
|
+
|
|
10
|
+
var useDraw = (props) => {
|
|
11
|
+
const [activeHover, setActiveHover] = createSignal(false);
|
|
12
|
+
const [forceExpand, setForceExpand] = createSignal(false);
|
|
13
|
+
const expanded = createMemo(() => activeHover() || forceExpand());
|
|
14
|
+
let hoverTimeout = null;
|
|
15
|
+
onCleanup(() => {
|
|
16
|
+
if (hoverTimeout) clearTimeout(hoverTimeout);
|
|
17
|
+
});
|
|
18
|
+
const hoverUtils = {
|
|
19
|
+
enter: () => {
|
|
20
|
+
if (hoverTimeout) {
|
|
21
|
+
clearTimeout(hoverTimeout);
|
|
22
|
+
hoverTimeout = null;
|
|
23
|
+
}
|
|
24
|
+
setActiveHover(true);
|
|
25
|
+
},
|
|
26
|
+
leave: () => {
|
|
27
|
+
hoverTimeout = setTimeout(() => {
|
|
28
|
+
setActiveHover(false);
|
|
29
|
+
}, props.animationMs);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
expanded,
|
|
34
|
+
setForceExpand,
|
|
35
|
+
hoverUtils,
|
|
36
|
+
animationMs: props.animationMs
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var DrawContext = createContext(void 0);
|
|
40
|
+
var DrawClientProvider = (props) => {
|
|
41
|
+
const value = useDraw({
|
|
42
|
+
animationMs: props.animationMs
|
|
43
|
+
});
|
|
44
|
+
return createComponent(DrawContext.Provider, {
|
|
45
|
+
value,
|
|
46
|
+
get children() {
|
|
47
|
+
return props.children;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
function useDrawContext() {
|
|
52
|
+
const context = useContext(DrawContext);
|
|
53
|
+
if (context === void 0) {
|
|
54
|
+
throw new Error(`useDrawContext must be used within a DrawClientProvider`);
|
|
55
|
+
}
|
|
56
|
+
return context;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/context/use-devtools-context.ts
|
|
60
|
+
var useDevtoolsContext = () => {
|
|
61
|
+
const context = useContext(DevtoolsContext);
|
|
62
|
+
if (context === void 0) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
"useDevtoolsShellContext must be used within a ShellContextProvider"
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return context;
|
|
68
|
+
};
|
|
69
|
+
function useTheme() {
|
|
70
|
+
const { settings, setSettings } = useDevtoolsSettings();
|
|
71
|
+
const theme = createMemo(() => settings().theme);
|
|
72
|
+
return {
|
|
73
|
+
theme,
|
|
74
|
+
setTheme: (theme2) => setSettings({ theme: theme2 })
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
var usePlugins = () => {
|
|
78
|
+
const { store, setStore } = useDevtoolsContext();
|
|
79
|
+
const { setForceExpand } = useDrawContext();
|
|
80
|
+
const plugins = createMemo(() => store.plugins);
|
|
81
|
+
const activePlugin = createMemo(() => store.state.activePlugin);
|
|
82
|
+
createEffect(() => {
|
|
83
|
+
if (activePlugin() == null) {
|
|
84
|
+
setForceExpand(false);
|
|
85
|
+
} else {
|
|
86
|
+
setForceExpand(true);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const setActivePlugin = (pluginId) => {
|
|
90
|
+
setStore((prev) => ({
|
|
91
|
+
...prev,
|
|
92
|
+
state: {
|
|
93
|
+
...prev.state,
|
|
94
|
+
activePlugin: pluginId
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
97
|
+
};
|
|
98
|
+
return { plugins, setActivePlugin, activePlugin };
|
|
99
|
+
};
|
|
100
|
+
var useDevtoolsState = () => {
|
|
101
|
+
const { store, setStore } = useDevtoolsContext();
|
|
102
|
+
const state = createMemo(() => store.state);
|
|
103
|
+
const setState = (newState) => {
|
|
104
|
+
setStore((prev) => ({
|
|
105
|
+
...prev,
|
|
106
|
+
state: {
|
|
107
|
+
...prev.state,
|
|
108
|
+
...newState
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
return { state, setState };
|
|
113
|
+
};
|
|
114
|
+
var useDevtoolsSettings = () => {
|
|
115
|
+
const { store, setStore } = useDevtoolsContext();
|
|
116
|
+
const settings = createMemo(() => store.settings);
|
|
117
|
+
const setSettings = (newSettings) => {
|
|
118
|
+
setStore((prev) => ({
|
|
119
|
+
...prev,
|
|
120
|
+
settings: {
|
|
121
|
+
...prev.settings,
|
|
122
|
+
...newSettings
|
|
123
|
+
}
|
|
124
|
+
}));
|
|
125
|
+
};
|
|
126
|
+
return { setSettings, settings };
|
|
127
|
+
};
|
|
128
|
+
var usePersistOpen = () => {
|
|
129
|
+
const { state, setState } = useDevtoolsState();
|
|
130
|
+
const persistOpen = createMemo(() => state().persistOpen);
|
|
131
|
+
const setPersistOpen = (value) => {
|
|
132
|
+
setState({ persistOpen: value });
|
|
133
|
+
};
|
|
134
|
+
return { persistOpen, setPersistOpen };
|
|
135
|
+
};
|
|
136
|
+
var useHeight = () => {
|
|
137
|
+
const { state, setState } = useDevtoolsState();
|
|
138
|
+
const height = createMemo(() => state().height);
|
|
139
|
+
const setHeight = (newHeight) => {
|
|
140
|
+
setState({ height: newHeight });
|
|
141
|
+
};
|
|
142
|
+
return { height, setHeight };
|
|
143
|
+
};
|
|
144
|
+
var recursivelyChangeTabIndex = (node, remove = true) => {
|
|
145
|
+
if (remove) {
|
|
146
|
+
node.setAttribute("tabIndex", "-1");
|
|
147
|
+
} else {
|
|
148
|
+
node.removeAttribute("tabIndex");
|
|
149
|
+
}
|
|
150
|
+
for (const child of node.children) {
|
|
151
|
+
recursivelyChangeTabIndex(child, remove);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var useDisableTabbing = (isOpen) => {
|
|
155
|
+
createEffect(() => {
|
|
156
|
+
const el = document.getElementById(TANSTACK_DEVTOOLS);
|
|
157
|
+
if (!el) return;
|
|
158
|
+
recursivelyChangeTabIndex(el, !isOpen());
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// src/styles/tokens.ts
|
|
163
|
+
var tokens = {
|
|
164
|
+
colors: {
|
|
165
|
+
inherit: "inherit",
|
|
166
|
+
current: "currentColor",
|
|
167
|
+
transparent: "transparent",
|
|
168
|
+
black: "#000000",
|
|
169
|
+
white: "#ffffff",
|
|
170
|
+
neutral: {
|
|
171
|
+
50: "#f9fafb",
|
|
172
|
+
100: "#f2f4f7",
|
|
173
|
+
200: "#eaecf0",
|
|
174
|
+
300: "#d0d5dd",
|
|
175
|
+
400: "#98a2b3",
|
|
176
|
+
500: "#667085",
|
|
177
|
+
600: "#475467",
|
|
178
|
+
700: "#344054",
|
|
179
|
+
800: "#1d2939",
|
|
180
|
+
900: "#101828"
|
|
181
|
+
},
|
|
182
|
+
darkGray: {
|
|
183
|
+
50: "#525c7a",
|
|
184
|
+
100: "#49536e",
|
|
185
|
+
200: "#414962",
|
|
186
|
+
300: "#394056",
|
|
187
|
+
400: "#313749",
|
|
188
|
+
500: "#292e3d",
|
|
189
|
+
600: "#212530",
|
|
190
|
+
700: "#191c24",
|
|
191
|
+
800: "#111318",
|
|
192
|
+
900: "#0b0d10"
|
|
193
|
+
},
|
|
194
|
+
gray: {
|
|
195
|
+
50: "#f9fafb",
|
|
196
|
+
100: "#f2f4f7",
|
|
197
|
+
200: "#eaecf0",
|
|
198
|
+
300: "#d0d5dd",
|
|
199
|
+
400: "#98a2b3",
|
|
200
|
+
500: "#667085",
|
|
201
|
+
600: "#475467",
|
|
202
|
+
700: "#344054",
|
|
203
|
+
800: "#1d2939",
|
|
204
|
+
900: "#101828"
|
|
205
|
+
},
|
|
206
|
+
blue: {
|
|
207
|
+
25: "#F5FAFF",
|
|
208
|
+
50: "#EFF8FF",
|
|
209
|
+
100: "#D1E9FF",
|
|
210
|
+
200: "#B2DDFF",
|
|
211
|
+
300: "#84CAFF",
|
|
212
|
+
400: "#53B1FD",
|
|
213
|
+
500: "#2E90FA",
|
|
214
|
+
600: "#1570EF",
|
|
215
|
+
700: "#175CD3",
|
|
216
|
+
800: "#1849A9",
|
|
217
|
+
900: "#194185"
|
|
218
|
+
},
|
|
219
|
+
green: {
|
|
220
|
+
25: "#F6FEF9",
|
|
221
|
+
50: "#ECFDF3",
|
|
222
|
+
100: "#D1FADF",
|
|
223
|
+
200: "#A6F4C5",
|
|
224
|
+
300: "#6CE9A6",
|
|
225
|
+
400: "#32D583",
|
|
226
|
+
500: "#12B76A",
|
|
227
|
+
600: "#039855",
|
|
228
|
+
700: "#027A48",
|
|
229
|
+
800: "#05603A",
|
|
230
|
+
900: "#054F31"
|
|
231
|
+
},
|
|
232
|
+
red: {
|
|
233
|
+
50: "#fef2f2",
|
|
234
|
+
100: "#fee2e2",
|
|
235
|
+
200: "#fecaca",
|
|
236
|
+
300: "#fca5a5",
|
|
237
|
+
400: "#f87171",
|
|
238
|
+
500: "#ef4444",
|
|
239
|
+
600: "#dc2626",
|
|
240
|
+
700: "#b91c1c",
|
|
241
|
+
800: "#991b1b",
|
|
242
|
+
900: "#7f1d1d",
|
|
243
|
+
950: "#450a0a"
|
|
244
|
+
},
|
|
245
|
+
yellow: {
|
|
246
|
+
25: "#FFFCF5",
|
|
247
|
+
50: "#FFFAEB",
|
|
248
|
+
100: "#FEF0C7",
|
|
249
|
+
200: "#FEDF89",
|
|
250
|
+
300: "#FEC84B",
|
|
251
|
+
400: "#FDB022",
|
|
252
|
+
500: "#F79009",
|
|
253
|
+
600: "#DC6803",
|
|
254
|
+
700: "#B54708",
|
|
255
|
+
800: "#93370D",
|
|
256
|
+
900: "#7A2E0E"
|
|
257
|
+
},
|
|
258
|
+
purple: {
|
|
259
|
+
25: "#FAFAFF",
|
|
260
|
+
50: "#F4F3FF",
|
|
261
|
+
100: "#EBE9FE",
|
|
262
|
+
200: "#D9D6FE",
|
|
263
|
+
300: "#BDB4FE",
|
|
264
|
+
400: "#9B8AFB",
|
|
265
|
+
500: "#7A5AF8",
|
|
266
|
+
600: "#6938EF",
|
|
267
|
+
700: "#5925DC",
|
|
268
|
+
800: "#4A1FB8",
|
|
269
|
+
900: "#3E1C96"
|
|
270
|
+
},
|
|
271
|
+
teal: {
|
|
272
|
+
25: "#F6FEFC",
|
|
273
|
+
50: "#F0FDF9",
|
|
274
|
+
100: "#CCFBEF",
|
|
275
|
+
200: "#99F6E0",
|
|
276
|
+
300: "#5FE9D0",
|
|
277
|
+
400: "#2ED3B7",
|
|
278
|
+
500: "#15B79E",
|
|
279
|
+
600: "#0E9384",
|
|
280
|
+
700: "#107569",
|
|
281
|
+
800: "#125D56",
|
|
282
|
+
900: "#134E48"
|
|
283
|
+
},
|
|
284
|
+
pink: {
|
|
285
|
+
25: "#fdf2f8",
|
|
286
|
+
50: "#fce7f3",
|
|
287
|
+
100: "#fbcfe8",
|
|
288
|
+
200: "#f9a8d4",
|
|
289
|
+
300: "#f472b6",
|
|
290
|
+
400: "#ec4899",
|
|
291
|
+
500: "#db2777",
|
|
292
|
+
600: "#be185d",
|
|
293
|
+
700: "#9d174d",
|
|
294
|
+
800: "#831843",
|
|
295
|
+
900: "#500724"
|
|
296
|
+
},
|
|
297
|
+
cyan: {
|
|
298
|
+
25: "#ecfeff",
|
|
299
|
+
50: "#cffafe",
|
|
300
|
+
100: "#a5f3fc",
|
|
301
|
+
200: "#67e8f9",
|
|
302
|
+
300: "#22d3ee",
|
|
303
|
+
400: "#06b6d4",
|
|
304
|
+
500: "#0891b2",
|
|
305
|
+
600: "#0e7490",
|
|
306
|
+
700: "#155e75",
|
|
307
|
+
800: "#164e63",
|
|
308
|
+
900: "#083344"
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
alpha: {
|
|
312
|
+
100: "ff",
|
|
313
|
+
90: "e5",
|
|
314
|
+
80: "cc",
|
|
315
|
+
70: "b3",
|
|
316
|
+
60: "99",
|
|
317
|
+
50: "80",
|
|
318
|
+
40: "66",
|
|
319
|
+
30: "4d",
|
|
320
|
+
20: "33",
|
|
321
|
+
10: "1a",
|
|
322
|
+
0: "00"
|
|
323
|
+
},
|
|
324
|
+
font: {
|
|
325
|
+
size: {
|
|
326
|
+
"2xs": "calc(var(--tsrd-font-size) * 0.625)",
|
|
327
|
+
xs: "calc(var(--tsrd-font-size) * 0.75)",
|
|
328
|
+
sm: "calc(var(--tsrd-font-size) * 0.875)",
|
|
329
|
+
md: "var(--tsrd-font-size)",
|
|
330
|
+
lg: "calc(var(--tsrd-font-size) * 1.125)",
|
|
331
|
+
xl: "calc(var(--tsrd-font-size) * 1.25)",
|
|
332
|
+
"2xl": "calc(var(--tsrd-font-size) * 1.5)",
|
|
333
|
+
"3xl": "calc(var(--tsrd-font-size) * 1.875)",
|
|
334
|
+
"4xl": "calc(var(--tsrd-font-size) * 2.25)",
|
|
335
|
+
"5xl": "calc(var(--tsrd-font-size) * 3)",
|
|
336
|
+
"6xl": "calc(var(--tsrd-font-size) * 3.75)",
|
|
337
|
+
"7xl": "calc(var(--tsrd-font-size) * 4.5)",
|
|
338
|
+
"8xl": "calc(var(--tsrd-font-size) * 6)",
|
|
339
|
+
"9xl": "calc(var(--tsrd-font-size) * 8)"
|
|
340
|
+
},
|
|
341
|
+
lineHeight: {
|
|
342
|
+
"3xs": "calc(var(--tsrd-font-size) * 0.75)",
|
|
343
|
+
"2xs": "calc(var(--tsrd-font-size) * 0.875)",
|
|
344
|
+
xs: "calc(var(--tsrd-font-size) * 1)",
|
|
345
|
+
sm: "calc(var(--tsrd-font-size) * 1.25)",
|
|
346
|
+
md: "calc(var(--tsrd-font-size) * 1.5)",
|
|
347
|
+
lg: "calc(var(--tsrd-font-size) * 1.75)",
|
|
348
|
+
xl: "calc(var(--tsrd-font-size) * 2)",
|
|
349
|
+
"2xl": "calc(var(--tsrd-font-size) * 2.25)",
|
|
350
|
+
"3xl": "calc(var(--tsrd-font-size) * 2.5)",
|
|
351
|
+
"4xl": "calc(var(--tsrd-font-size) * 2.75)",
|
|
352
|
+
"5xl": "calc(var(--tsrd-font-size) * 3)",
|
|
353
|
+
"6xl": "calc(var(--tsrd-font-size) * 3.25)",
|
|
354
|
+
"7xl": "calc(var(--tsrd-font-size) * 3.5)",
|
|
355
|
+
"8xl": "calc(var(--tsrd-font-size) * 3.75)",
|
|
356
|
+
"9xl": "calc(var(--tsrd-font-size) * 4)"
|
|
357
|
+
},
|
|
358
|
+
weight: {
|
|
359
|
+
thin: "100",
|
|
360
|
+
extralight: "200",
|
|
361
|
+
light: "300",
|
|
362
|
+
normal: "400",
|
|
363
|
+
medium: "500",
|
|
364
|
+
semibold: "600",
|
|
365
|
+
bold: "700",
|
|
366
|
+
extrabold: "800",
|
|
367
|
+
black: "900"
|
|
368
|
+
},
|
|
369
|
+
fontFamily: {
|
|
370
|
+
sans: "ui-sans-serif, Inter, system-ui, sans-serif, sans-serif",
|
|
371
|
+
mono: `ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace`
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
breakpoints: {
|
|
375
|
+
xs: "320px",
|
|
376
|
+
sm: "640px",
|
|
377
|
+
md: "768px",
|
|
378
|
+
lg: "1024px",
|
|
379
|
+
xl: "1280px",
|
|
380
|
+
"2xl": "1536px"
|
|
381
|
+
},
|
|
382
|
+
border: {
|
|
383
|
+
radius: {
|
|
384
|
+
none: "0px",
|
|
385
|
+
xs: "calc(var(--tsrd-font-size) * 0.125)",
|
|
386
|
+
sm: "calc(var(--tsrd-font-size) * 0.25)",
|
|
387
|
+
md: "calc(var(--tsrd-font-size) * 0.375)",
|
|
388
|
+
lg: "calc(var(--tsrd-font-size) * 0.5)",
|
|
389
|
+
xl: "calc(var(--tsrd-font-size) * 0.75)",
|
|
390
|
+
"2xl": "calc(var(--tsrd-font-size) * 1)",
|
|
391
|
+
"3xl": "calc(var(--tsrd-font-size) * 1.5)",
|
|
392
|
+
full: "9999px"
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
size: {
|
|
396
|
+
0: "0px",
|
|
397
|
+
0.25: "calc(var(--tsrd-font-size) * 0.0625)",
|
|
398
|
+
0.5: "calc(var(--tsrd-font-size) * 0.125)",
|
|
399
|
+
1: "calc(var(--tsrd-font-size) * 0.25)",
|
|
400
|
+
1.5: "calc(var(--tsrd-font-size) * 0.375)",
|
|
401
|
+
2: "calc(var(--tsrd-font-size) * 0.5)",
|
|
402
|
+
2.5: "calc(var(--tsrd-font-size) * 0.625)",
|
|
403
|
+
3: "calc(var(--tsrd-font-size) * 0.75)",
|
|
404
|
+
3.5: "calc(var(--tsrd-font-size) * 0.875)",
|
|
405
|
+
4: "calc(var(--tsrd-font-size) * 1)",
|
|
406
|
+
4.5: "calc(var(--tsrd-font-size) * 1.125)",
|
|
407
|
+
5: "calc(var(--tsrd-font-size) * 1.25)",
|
|
408
|
+
5.5: "calc(var(--tsrd-font-size) * 1.375)",
|
|
409
|
+
6: "calc(var(--tsrd-font-size) * 1.5)",
|
|
410
|
+
6.5: "calc(var(--tsrd-font-size) * 1.625)",
|
|
411
|
+
7: "calc(var(--tsrd-font-size) * 1.75)",
|
|
412
|
+
8: "calc(var(--tsrd-font-size) * 2)",
|
|
413
|
+
9: "calc(var(--tsrd-font-size) * 2.25)",
|
|
414
|
+
10: "calc(var(--tsrd-font-size) * 2.5)",
|
|
415
|
+
11: "calc(var(--tsrd-font-size) * 2.75)",
|
|
416
|
+
12: "calc(var(--tsrd-font-size) * 3)",
|
|
417
|
+
14: "calc(var(--tsrd-font-size) * 3.5)",
|
|
418
|
+
16: "calc(var(--tsrd-font-size) * 4)",
|
|
419
|
+
20: "calc(var(--tsrd-font-size) * 5)",
|
|
420
|
+
24: "calc(var(--tsrd-font-size) * 6)",
|
|
421
|
+
28: "calc(var(--tsrd-font-size) * 7)",
|
|
422
|
+
32: "calc(var(--tsrd-font-size) * 8)",
|
|
423
|
+
36: "calc(var(--tsrd-font-size) * 9)",
|
|
424
|
+
40: "calc(var(--tsrd-font-size) * 10)",
|
|
425
|
+
44: "calc(var(--tsrd-font-size) * 11)",
|
|
426
|
+
48: "calc(var(--tsrd-font-size) * 12)",
|
|
427
|
+
52: "calc(var(--tsrd-font-size) * 13)",
|
|
428
|
+
56: "calc(var(--tsrd-font-size) * 14)",
|
|
429
|
+
60: "calc(var(--tsrd-font-size) * 15)",
|
|
430
|
+
64: "calc(var(--tsrd-font-size) * 16)",
|
|
431
|
+
72: "calc(var(--tsrd-font-size) * 18)",
|
|
432
|
+
80: "calc(var(--tsrd-font-size) * 20)",
|
|
433
|
+
96: "calc(var(--tsrd-font-size) * 24)"
|
|
434
|
+
},
|
|
435
|
+
shadow: {
|
|
436
|
+
xs: (_ = "rgb(0 0 0 / 0.1)") => `0 1px 2px 0 rgb(0 0 0 / 0.05)`,
|
|
437
|
+
sm: (color = "rgb(0 0 0 / 0.1)") => `0 1px 3px 0 ${color}, 0 1px 2px -1px ${color}`,
|
|
438
|
+
md: (color = "rgb(0 0 0 / 0.1)") => `0 4px 6px -1px ${color}, 0 2px 4px -2px ${color}`,
|
|
439
|
+
lg: (color = "rgb(0 0 0 / 0.1)") => `0 10px 15px -3px ${color}, 0 4px 6px -4px ${color}`,
|
|
440
|
+
xl: (color = "rgb(0 0 0 / 0.1)") => `0 20px 25px -5px ${color}, 0 8px 10px -6px ${color}`,
|
|
441
|
+
"2xl": (color = "rgb(0 0 0 / 0.25)") => `0 25px 50px -12px ${color}`,
|
|
442
|
+
inner: (color = "rgb(0 0 0 / 0.05)") => `inset 0 2px 4px 0 ${color}`,
|
|
443
|
+
none: () => `none`
|
|
444
|
+
},
|
|
445
|
+
zIndices: {
|
|
446
|
+
hide: -1,
|
|
447
|
+
auto: "auto",
|
|
448
|
+
base: 0,
|
|
449
|
+
docked: 10,
|
|
450
|
+
dropdown: 1e3,
|
|
451
|
+
sticky: 1100,
|
|
452
|
+
banner: 1200,
|
|
453
|
+
overlay: 1300,
|
|
454
|
+
modal: 1400,
|
|
455
|
+
popover: 1500,
|
|
456
|
+
skipLink: 1600,
|
|
457
|
+
toast: 1700,
|
|
458
|
+
tooltip: 1800
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
// src/styles/use-styles.ts
|
|
463
|
+
var mSecondsToCssSeconds = (mSeconds) => `${(mSeconds / 1e3).toFixed(2)}s`;
|
|
464
|
+
var stylesFactory = (theme) => {
|
|
465
|
+
const { colors, font, size, border } = tokens;
|
|
466
|
+
const { fontFamily, size: fontSize } = font;
|
|
467
|
+
const css2 = goober.css;
|
|
468
|
+
const t = (light, dark) => theme === "light" ? light : dark;
|
|
469
|
+
return {
|
|
470
|
+
seoTabContainer: css2`
|
|
471
|
+
padding: 0;
|
|
472
|
+
margin: 0 auto;
|
|
473
|
+
background: ${t(colors.white, colors.darkGray[700])};
|
|
474
|
+
border-radius: 12px;
|
|
475
|
+
box-shadow: 0 2px 16px ${t("rgba(0, 0, 0, 0.04)", "rgba(0, 0, 0, 0.08)")};
|
|
476
|
+
overflow-y: auto;
|
|
477
|
+
height: 100%;
|
|
478
|
+
display: flex;
|
|
479
|
+
flex-direction: column;
|
|
480
|
+
gap: 0;
|
|
481
|
+
width: 100%;
|
|
482
|
+
overflow-y: auto;
|
|
483
|
+
`,
|
|
484
|
+
seoTabTitle: css2`
|
|
485
|
+
font-size: 1.25rem;
|
|
486
|
+
font-weight: 600;
|
|
487
|
+
color: ${t(colors.purple[500], colors.purple[400])};
|
|
488
|
+
margin: 0;
|
|
489
|
+
padding: 1rem 1.5rem 0.5rem 1.5rem;
|
|
490
|
+
text-align: left;
|
|
491
|
+
border-bottom: 1px solid ${t(colors.gray[300], colors.gray[700])};
|
|
492
|
+
`,
|
|
493
|
+
seoTabSection: css2`
|
|
494
|
+
padding: 1.5rem;
|
|
495
|
+
background: ${t(colors.gray[100], colors.gray[800])};
|
|
496
|
+
border: 1px solid ${t(colors.gray[300], colors.gray[700])};
|
|
497
|
+
display: flex;
|
|
498
|
+
flex-direction: column;
|
|
499
|
+
gap: 0.5rem;
|
|
500
|
+
margin-bottom: 2rem;
|
|
501
|
+
border-radius: 0.75rem;
|
|
502
|
+
`,
|
|
503
|
+
seoPreviewSection: css2`
|
|
504
|
+
display: flex;
|
|
505
|
+
flex-direction: row;
|
|
506
|
+
gap: 16px;
|
|
507
|
+
margin-bottom: 0;
|
|
508
|
+
justify-content: flex-start;
|
|
509
|
+
align-items: flex-start;
|
|
510
|
+
overflow-x: auto;
|
|
511
|
+
flex-wrap: wrap;
|
|
512
|
+
padding-bottom: 0.5rem;
|
|
513
|
+
`,
|
|
514
|
+
seoPreviewCard: css2`
|
|
515
|
+
border: 1px solid ${t(colors.gray[300], colors.gray[700])};
|
|
516
|
+
border-radius: 8px;
|
|
517
|
+
padding: 12px 10px;
|
|
518
|
+
background: ${t(colors.white, colors.darkGray[900])};
|
|
519
|
+
margin-bottom: 0;
|
|
520
|
+
box-shadow: 0 1px 4px ${t("rgba(0,0,0,0.02)", "rgba(0,0,0,0.04)")};
|
|
521
|
+
display: flex;
|
|
522
|
+
flex-direction: column;
|
|
523
|
+
align-items: flex-start;
|
|
524
|
+
min-width: 200px;
|
|
525
|
+
max-width: 240px;
|
|
526
|
+
font-size: 0.95rem;
|
|
527
|
+
gap: 4px;
|
|
528
|
+
`,
|
|
529
|
+
seoPreviewHeader: css2`
|
|
530
|
+
font-size: 1rem;
|
|
531
|
+
font-weight: 500;
|
|
532
|
+
margin-bottom: 6px;
|
|
533
|
+
color: ${t(colors.purple[500], colors.purple[400])};
|
|
534
|
+
`,
|
|
535
|
+
seoPreviewImage: css2`
|
|
536
|
+
max-width: 100%;
|
|
537
|
+
border-radius: 6px;
|
|
538
|
+
margin-bottom: 6px;
|
|
539
|
+
box-shadow: 0 1px 2px ${t("rgba(0,0,0,0.03)", "rgba(0,0,0,0.06)")};
|
|
540
|
+
height: 160px;
|
|
541
|
+
`,
|
|
542
|
+
seoPreviewTitle: css2`
|
|
543
|
+
font-size: 1rem;
|
|
544
|
+
font-weight: 600;
|
|
545
|
+
margin-bottom: 2px;
|
|
546
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
547
|
+
`,
|
|
548
|
+
seoPreviewDesc: css2`
|
|
549
|
+
color: ${t(colors.gray[700], colors.gray[300])};
|
|
550
|
+
margin-bottom: 2px;
|
|
551
|
+
font-size: 0.95rem;
|
|
552
|
+
`,
|
|
553
|
+
seoPreviewUrl: css2`
|
|
554
|
+
color: ${t(colors.gray[500], colors.gray[500])};
|
|
555
|
+
font-size: 0.9rem;
|
|
556
|
+
margin-bottom: 2px;
|
|
557
|
+
word-break: break-all;
|
|
558
|
+
`,
|
|
559
|
+
seoMissingTagsSection: css2`
|
|
560
|
+
margin-top: 4px;
|
|
561
|
+
font-size: 0.95rem;
|
|
562
|
+
color: ${t(colors.red[400], colors.red[400])};
|
|
563
|
+
`,
|
|
564
|
+
seoMissingTagsList: css2`
|
|
565
|
+
margin: 4px 0 0 0;
|
|
566
|
+
padding: 0;
|
|
567
|
+
list-style: none;
|
|
568
|
+
display: flex;
|
|
569
|
+
flex-wrap: wrap;
|
|
570
|
+
gap: 6px;
|
|
571
|
+
max-width: 240px;
|
|
572
|
+
`,
|
|
573
|
+
seoMissingTag: css2`
|
|
574
|
+
background: ${t(colors.red[100], colors.red[500] + "22")};
|
|
575
|
+
color: ${t(colors.red[700], colors.red[500])};
|
|
576
|
+
border-radius: 4px;
|
|
577
|
+
padding: 1px 6px;
|
|
578
|
+
font-size: 0.9rem;
|
|
579
|
+
font-weight: 500;
|
|
580
|
+
`,
|
|
581
|
+
seoAllTagsFound: css2`
|
|
582
|
+
color: ${t(colors.green[700], colors.green[500])};
|
|
583
|
+
font-weight: 500;
|
|
584
|
+
margin-left: 6px;
|
|
585
|
+
font-size: 0.95rem;
|
|
586
|
+
`,
|
|
587
|
+
devtoolsPanelContainer: (panelLocation, isDetached) => css2`
|
|
588
|
+
direction: ltr;
|
|
589
|
+
position: fixed;
|
|
590
|
+
overflow-y: hidden;
|
|
591
|
+
overflow-x: hidden;
|
|
592
|
+
${panelLocation}: 0;
|
|
593
|
+
right: 0;
|
|
594
|
+
z-index: 99999;
|
|
595
|
+
width: 100%;
|
|
596
|
+
${isDetached ? "" : "max-height: 90%;"}
|
|
597
|
+
border-top: 1px solid ${t(colors.gray[300], colors.gray[700])};
|
|
598
|
+
transform-origin: top;
|
|
599
|
+
`,
|
|
600
|
+
devtoolsPanelContainerVisibility: (isOpen) => {
|
|
601
|
+
return css2`
|
|
602
|
+
visibility: ${isOpen ? "visible" : "hidden"};
|
|
603
|
+
height: ${isOpen ? "auto" : "0"};
|
|
604
|
+
`;
|
|
605
|
+
},
|
|
606
|
+
devtoolsPanelContainerResizing: (isResizing) => {
|
|
607
|
+
if (isResizing()) {
|
|
608
|
+
return css2`
|
|
609
|
+
transition: none;
|
|
610
|
+
`;
|
|
611
|
+
}
|
|
612
|
+
return css2`
|
|
613
|
+
transition: all 0.4s ease;
|
|
614
|
+
`;
|
|
615
|
+
},
|
|
616
|
+
devtoolsPanelContainerAnimation: (isOpen, height) => {
|
|
617
|
+
if (isOpen) {
|
|
618
|
+
return css2`
|
|
619
|
+
pointer-events: auto;
|
|
620
|
+
transform: translateY(0);
|
|
621
|
+
`;
|
|
622
|
+
}
|
|
623
|
+
return css2`
|
|
624
|
+
pointer-events: none;
|
|
625
|
+
transform: translateY(${height}px);
|
|
626
|
+
`;
|
|
627
|
+
},
|
|
628
|
+
devtoolsPanel: css2`
|
|
629
|
+
display: flex;
|
|
630
|
+
font-size: ${fontSize.sm};
|
|
631
|
+
font-family: ${fontFamily.sans};
|
|
632
|
+
background-color: ${t(colors.white, colors.darkGray[700])};
|
|
633
|
+
color: ${t(colors.gray[900], colors.gray[300])};
|
|
634
|
+
width: w-screen;
|
|
635
|
+
flex-direction: row;
|
|
636
|
+
overflow-x: hidden;
|
|
637
|
+
overflow-y: hidden;
|
|
638
|
+
height: 100%;
|
|
639
|
+
`,
|
|
640
|
+
dragHandle: (panelLocation) => css2`
|
|
641
|
+
position: absolute;
|
|
642
|
+
left: 0;
|
|
643
|
+
${panelLocation === "bottom" ? "top" : "bottom"}: 0;
|
|
644
|
+
width: 100%;
|
|
645
|
+
height: 4px;
|
|
646
|
+
cursor: row-resize;
|
|
647
|
+
user-select: none;
|
|
648
|
+
z-index: 100000;
|
|
649
|
+
&:hover {
|
|
650
|
+
background-color: ${t(colors.purple[700], colors.purple[400])};
|
|
651
|
+
}
|
|
652
|
+
`,
|
|
653
|
+
mainCloseBtn: css2`
|
|
654
|
+
background: transparent;
|
|
655
|
+
position: fixed;
|
|
656
|
+
z-index: 99999;
|
|
657
|
+
display: inline-flex;
|
|
658
|
+
width: fit-content;
|
|
659
|
+
cursor: pointer;
|
|
660
|
+
appearance: none;
|
|
661
|
+
border: 0;
|
|
662
|
+
align-items: center;
|
|
663
|
+
padding: 0;
|
|
664
|
+
font-size: ${font.size.xs};
|
|
665
|
+
cursor: pointer;
|
|
666
|
+
transition: all 0.25s ease-out;
|
|
667
|
+
&:hide-until-hover {
|
|
668
|
+
opacity: 0;
|
|
669
|
+
pointer-events: none;
|
|
670
|
+
visibility: hidden;
|
|
671
|
+
}
|
|
672
|
+
&:hide-until-hover:hover {
|
|
673
|
+
opacity: 1;
|
|
674
|
+
pointer-events: auto;
|
|
675
|
+
visibility: visible;
|
|
676
|
+
}
|
|
677
|
+
&:focus-visible {
|
|
678
|
+
outline-offset: 2px;
|
|
679
|
+
border-radius: ${border.radius.full};
|
|
680
|
+
outline: 2px solid ${t(colors.blue[700], colors.blue[800])};
|
|
681
|
+
}
|
|
682
|
+
`,
|
|
683
|
+
mainCloseBtnPosition: (position) => {
|
|
684
|
+
const base = css2`
|
|
685
|
+
${position === "top-left" ? `top: ${size[2]}; left: ${size[2]};` : ""}
|
|
686
|
+
${position === "top-right" ? `top: ${size[2]}; right: ${size[2]};` : ""}
|
|
687
|
+
${position === "middle-left" ? `top: 50%; left: ${size[2]}; transform: translateY(-50%);` : ""}
|
|
688
|
+
${position === "middle-right" ? `top: 50%; right: ${size[2]}; transform: translateY(-50%);` : ""}
|
|
689
|
+
${position === "bottom-left" ? `bottom: ${size[2]}; left: ${size[2]};` : ""}
|
|
690
|
+
${position === "bottom-right" ? `bottom: ${size[2]}; right: ${size[2]};` : ""}
|
|
691
|
+
`;
|
|
692
|
+
return base;
|
|
693
|
+
},
|
|
694
|
+
mainCloseBtnAnimation: (isOpen, hideUntilHover) => {
|
|
695
|
+
if (!isOpen) {
|
|
696
|
+
return hideUntilHover ? css2`
|
|
697
|
+
opacity: 0;
|
|
698
|
+
|
|
699
|
+
&:hover {
|
|
700
|
+
opacity: 1;
|
|
701
|
+
pointer-events: auto;
|
|
702
|
+
visibility: visible;
|
|
703
|
+
}
|
|
704
|
+
` : css2`
|
|
705
|
+
opacity: 1;
|
|
706
|
+
pointer-events: auto;
|
|
707
|
+
visibility: visible;
|
|
708
|
+
`;
|
|
709
|
+
}
|
|
710
|
+
return css2`
|
|
711
|
+
opacity: 0;
|
|
712
|
+
pointer-events: none;
|
|
713
|
+
visibility: hidden;
|
|
714
|
+
`;
|
|
715
|
+
},
|
|
716
|
+
tabContainer: css2`
|
|
717
|
+
display: flex;
|
|
718
|
+
flex-direction: column;
|
|
719
|
+
align-items: center;
|
|
720
|
+
justify-content: flex-start;
|
|
721
|
+
height: 100%;
|
|
722
|
+
background-color: ${t(colors.gray[100], colors.darkGray[800])};
|
|
723
|
+
border-right: 1px solid ${t(colors.gray[300], colors.gray[700])};
|
|
724
|
+
box-shadow: 0 1px 0 ${t(colors.gray[200], colors.gray[700])};
|
|
725
|
+
position: relative;
|
|
726
|
+
width: ${size[10]};
|
|
727
|
+
`,
|
|
728
|
+
tab: css2`
|
|
729
|
+
display: flex;
|
|
730
|
+
align-items: center;
|
|
731
|
+
justify-content: center;
|
|
732
|
+
width: 100%;
|
|
733
|
+
height: ${size[10]};
|
|
734
|
+
cursor: pointer;
|
|
735
|
+
font-size: ${fontSize.sm};
|
|
736
|
+
font-family: ${fontFamily.sans};
|
|
737
|
+
color: ${t(colors.gray[700], colors.gray[300])};
|
|
738
|
+
background-color: transparent;
|
|
739
|
+
border: none;
|
|
740
|
+
transition: all 0.2s ease-in-out;
|
|
741
|
+
border-left: 2px solid transparent;
|
|
742
|
+
&:hover:not(.close):not(.active):not(.detach) {
|
|
743
|
+
background-color: ${t(colors.gray[200], colors.gray[700])};
|
|
744
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
745
|
+
border-left: 2px solid ${t(colors.purple[700], colors.purple[500])};
|
|
746
|
+
}
|
|
747
|
+
&.active {
|
|
748
|
+
background-color: ${t(colors.purple[200], colors.purple[500])};
|
|
749
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
750
|
+
border-left: 2px solid ${t(colors.purple[700], colors.purple[500])};
|
|
751
|
+
}
|
|
752
|
+
&.detach {
|
|
753
|
+
&:hover {
|
|
754
|
+
background-color: ${t(colors.gray[200], colors.gray[700])};
|
|
755
|
+
}
|
|
756
|
+
&:hover {
|
|
757
|
+
color: ${t(colors.green[700], colors.green[500])};
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
&.close {
|
|
761
|
+
margin-top: auto;
|
|
762
|
+
&:hover {
|
|
763
|
+
background-color: ${t(colors.gray[200], colors.gray[700])};
|
|
764
|
+
}
|
|
765
|
+
&:hover {
|
|
766
|
+
color: ${t(colors.red[700], colors.red[500])};
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
&.disabled {
|
|
770
|
+
cursor: not-allowed;
|
|
771
|
+
opacity: 0.2;
|
|
772
|
+
pointer-events: none;
|
|
773
|
+
}
|
|
774
|
+
&.disabled:hover {
|
|
775
|
+
background-color: transparent;
|
|
776
|
+
color: ${colors.gray[300]};
|
|
777
|
+
}
|
|
778
|
+
`,
|
|
779
|
+
tabContent: css2`
|
|
780
|
+
transition: all 0.2s ease-in-out;
|
|
781
|
+
width: 100%;
|
|
782
|
+
height: 100%;
|
|
783
|
+
`,
|
|
784
|
+
pluginsTabPanel: css2`
|
|
785
|
+
display: flex;
|
|
786
|
+
flex-direction: row;
|
|
787
|
+
width: 100%;
|
|
788
|
+
height: 100%;
|
|
789
|
+
overflow: hidden;
|
|
790
|
+
`,
|
|
791
|
+
pluginsTabDraw: (isExpanded) => css2`
|
|
792
|
+
width: ${isExpanded ? size[48] : 0};
|
|
793
|
+
height: 100%;
|
|
794
|
+
background-color: ${t(colors.white, colors.darkGray[800])};
|
|
795
|
+
box-shadow: 0 1px 0 ${colors.gray[700]};
|
|
796
|
+
${isExpanded ? `border-right: 1px solid ${t(colors.gray[300], colors.gray[700])};` : ""}
|
|
797
|
+
`,
|
|
798
|
+
pluginsTabDrawExpanded: css2`
|
|
799
|
+
width: ${size[48]};
|
|
800
|
+
border-right: 1px solid ${t(colors.gray[300], colors.gray[700])};
|
|
801
|
+
`,
|
|
802
|
+
pluginsTabDrawTransition: (mSeconds) => {
|
|
803
|
+
return css2`
|
|
804
|
+
transition: width ${mSecondsToCssSeconds(mSeconds)} ease;
|
|
805
|
+
`;
|
|
806
|
+
},
|
|
807
|
+
pluginsTabSidebar: (isExpanded) => css2`
|
|
808
|
+
width: ${size[48]};
|
|
809
|
+
overflow-y: auto;
|
|
810
|
+
transform: ${isExpanded ? "translateX(0)" : "translateX(-100%)"};
|
|
811
|
+
`,
|
|
812
|
+
pluginsTabSidebarTransition: (mSeconds) => {
|
|
813
|
+
return css2`
|
|
814
|
+
transition: transform ${mSecondsToCssSeconds(mSeconds)} ease;
|
|
815
|
+
`;
|
|
816
|
+
},
|
|
817
|
+
pluginName: css2`
|
|
818
|
+
font-size: ${fontSize.xs};
|
|
819
|
+
font-family: ${fontFamily.sans};
|
|
820
|
+
color: ${t(colors.gray[700], colors.gray[300])};
|
|
821
|
+
padding: ${size[2]};
|
|
822
|
+
cursor: pointer;
|
|
823
|
+
text-align: center;
|
|
824
|
+
transition: all 0.2s ease-in-out;
|
|
825
|
+
&:hover {
|
|
826
|
+
background-color: ${t(colors.gray[200], colors.gray[700])};
|
|
827
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
828
|
+
padding: ${size[2]};
|
|
829
|
+
}
|
|
830
|
+
&.active {
|
|
831
|
+
background-color: ${t(colors.purple[200], colors.purple[500])};
|
|
832
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
833
|
+
}
|
|
834
|
+
`,
|
|
835
|
+
pluginsTabContent: css2`
|
|
836
|
+
width: 100%;
|
|
837
|
+
height: 100%;
|
|
838
|
+
overflow-y: auto;
|
|
839
|
+
`,
|
|
840
|
+
settingsGroup: css2`
|
|
841
|
+
display: flex;
|
|
842
|
+
flex-direction: column;
|
|
843
|
+
gap: 1rem;
|
|
844
|
+
`,
|
|
845
|
+
conditionalSetting: css2`
|
|
846
|
+
margin-left: 1.5rem;
|
|
847
|
+
padding-left: 1rem;
|
|
848
|
+
border-left: 2px solid ${t(colors.purple[600], colors.purple[400])};
|
|
849
|
+
background-color: ${t(colors.gray[100], colors.darkGray[800])};
|
|
850
|
+
padding: 1rem;
|
|
851
|
+
border-radius: 0.5rem;
|
|
852
|
+
margin-top: 0.5rem;
|
|
853
|
+
`,
|
|
854
|
+
settingRow: css2`
|
|
855
|
+
display: grid;
|
|
856
|
+
grid-template-columns: 1fr 1fr;
|
|
857
|
+
gap: 1rem;
|
|
858
|
+
|
|
859
|
+
@media (max-width: 768px) {
|
|
860
|
+
grid-template-columns: 1fr;
|
|
861
|
+
}
|
|
862
|
+
`,
|
|
863
|
+
settingsModifiers: css2`
|
|
864
|
+
display: flex;
|
|
865
|
+
gap: 0.5rem;
|
|
866
|
+
`
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
function useStyles() {
|
|
870
|
+
const { theme } = useTheme();
|
|
871
|
+
const [styles, setStyles] = createSignal(stylesFactory(theme()));
|
|
872
|
+
createEffect(() => {
|
|
873
|
+
setStyles(stylesFactory(theme()));
|
|
874
|
+
});
|
|
875
|
+
return styles;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
// src/components/trigger.tsx
|
|
879
|
+
var _tmpl$ = ['<button type="button" aria-label="Open TanStack Devtools"', ">", "</button>"];
|
|
880
|
+
var Trigger = ({
|
|
881
|
+
isOpen,
|
|
882
|
+
setIsOpen
|
|
883
|
+
}) => {
|
|
884
|
+
const {
|
|
885
|
+
settings
|
|
886
|
+
} = useDevtoolsSettings();
|
|
887
|
+
const styles = useStyles();
|
|
888
|
+
const buttonStyle = createMemo(() => {
|
|
889
|
+
return clsx3(styles().mainCloseBtn, styles().mainCloseBtnPosition(settings().position), styles().mainCloseBtnAnimation(isOpen(), settings().hideUntilHover));
|
|
890
|
+
});
|
|
891
|
+
return ssr(_tmpl$, ssrAttribute("class", escape(buttonStyle(), true), false), escape(createComponent(TanStackLogo, {})));
|
|
892
|
+
};
|
|
893
|
+
var _tmpl$2 = ["<div", ' style="', '"', ">", "</div>"];
|
|
894
|
+
var MainPanel = (props) => {
|
|
895
|
+
const styles = useStyles();
|
|
896
|
+
const {
|
|
897
|
+
height
|
|
898
|
+
} = useHeight();
|
|
899
|
+
const {
|
|
900
|
+
settings
|
|
901
|
+
} = useDevtoolsSettings();
|
|
902
|
+
const pip = usePiPWindow();
|
|
903
|
+
return ssr(_tmpl$2, ssrAttribute("id", escape(TANSTACK_DEVTOOLS, true), false), "height:" + (pip().pipWindow ? "100vh" : escape(height(), true) + "px"), ssrAttribute("class", escape(clsx3(styles().devtoolsPanelContainer(settings().panelLocation, Boolean(pip().pipWindow)), styles().devtoolsPanelContainerAnimation(props.isOpen(), height()), styles().devtoolsPanelContainerVisibility(props.isOpen()), styles().devtoolsPanelContainerResizing(props.isResizing)), true), false), escape(createComponent(DrawClientProvider, {
|
|
904
|
+
animationMs: 400,
|
|
905
|
+
get children() {
|
|
906
|
+
return props.children;
|
|
907
|
+
}
|
|
908
|
+
})));
|
|
909
|
+
};
|
|
910
|
+
var _tmpl$3 = ["<div", ">", "", "</div>"];
|
|
911
|
+
var _tmpl$22 = ["<div", "></div>"];
|
|
912
|
+
var ContentPanel = (props) => {
|
|
913
|
+
const styles = useStyles();
|
|
914
|
+
const {
|
|
915
|
+
settings
|
|
916
|
+
} = useDevtoolsSettings();
|
|
917
|
+
return ssr(_tmpl$3, ssrAttribute("class", escape(styles().devtoolsPanel, true), false), props.handleDragStart ? ssr(_tmpl$22, ssrAttribute("class", escape(styles().dragHandle(settings().panelLocation), true), false)) : escape(null), escape(props.children));
|
|
918
|
+
};
|
|
919
|
+
var _tmpl$4 = ["<div", ">", "", "", "</div>"];
|
|
920
|
+
var _tmpl$23 = ["<div", ">", "</div>"];
|
|
921
|
+
var _tmpl$32 = ["<div", ">", "", "</div>"];
|
|
922
|
+
var _tmpl$42 = ["<div", "><div", ">", "</div>", "Final shortcut is: ", "</div>"];
|
|
923
|
+
var _tmpl$5 = ["<div", "><div", ">", "", "</div></div>"];
|
|
924
|
+
var SettingsTab = () => {
|
|
925
|
+
const {
|
|
926
|
+
setSettings,
|
|
927
|
+
settings
|
|
928
|
+
} = useDevtoolsSettings();
|
|
929
|
+
const styles = useStyles();
|
|
930
|
+
const hotkey = createMemo(() => settings().openHotkey);
|
|
931
|
+
const modifiers = ["Control", "Alt", "Meta", "Shift"];
|
|
932
|
+
const changeHotkey = (newHotkey) => () => {
|
|
933
|
+
if (hotkey().includes(newHotkey)) {
|
|
934
|
+
return setSettings({
|
|
935
|
+
openHotkey: hotkey().filter((key) => key !== newHotkey)
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
const existingModifiers = hotkey().filter((key) => modifiers.includes(key));
|
|
939
|
+
const otherModifiers = hotkey().filter((key) => !modifiers.includes(key));
|
|
940
|
+
setSettings({
|
|
941
|
+
openHotkey: [...existingModifiers, newHotkey, ...otherModifiers]
|
|
942
|
+
});
|
|
943
|
+
};
|
|
944
|
+
return createComponent(MainPanel$1, {
|
|
945
|
+
withPadding: true,
|
|
946
|
+
get children() {
|
|
947
|
+
return [createComponent(Section, {
|
|
948
|
+
get children() {
|
|
949
|
+
return [createComponent(SectionTitle, {
|
|
950
|
+
get children() {
|
|
951
|
+
return [createComponent(SectionIcon, {
|
|
952
|
+
get children() {
|
|
953
|
+
return createComponent(SettingsCog, {});
|
|
954
|
+
}
|
|
955
|
+
}), "General"];
|
|
956
|
+
}
|
|
957
|
+
}), createComponent(SectionDescription, {
|
|
958
|
+
children: "Configure general behavior of the devtools panel."
|
|
959
|
+
}), ssr(_tmpl$4, ssrAttribute("class", escape(styles().settingsGroup, true), false), escape(createComponent(Checkbox, {
|
|
960
|
+
label: "Default open",
|
|
961
|
+
description: "Automatically open the devtools panel when the page loads",
|
|
962
|
+
onChange: () => setSettings({
|
|
963
|
+
defaultOpen: !settings().defaultOpen
|
|
964
|
+
}),
|
|
965
|
+
get checked() {
|
|
966
|
+
return settings().defaultOpen;
|
|
967
|
+
}
|
|
968
|
+
})), escape(createComponent(Checkbox, {
|
|
969
|
+
label: "Hide trigger until hovered",
|
|
970
|
+
description: "Keep the devtools trigger button hidden until you hover over its area",
|
|
971
|
+
onChange: () => setSettings({
|
|
972
|
+
hideUntilHover: !settings().hideUntilHover
|
|
973
|
+
}),
|
|
974
|
+
get checked() {
|
|
975
|
+
return settings().hideUntilHover;
|
|
976
|
+
}
|
|
977
|
+
})), escape(createComponent(Select, {
|
|
978
|
+
label: "Theme",
|
|
979
|
+
description: "Choose the theme for the devtools panel",
|
|
980
|
+
get value() {
|
|
981
|
+
return settings().theme;
|
|
982
|
+
},
|
|
983
|
+
options: [{
|
|
984
|
+
label: "Dark",
|
|
985
|
+
value: "dark"
|
|
986
|
+
}, {
|
|
987
|
+
label: "Light",
|
|
988
|
+
value: "light"
|
|
989
|
+
}],
|
|
990
|
+
onChange: (value) => setSettings({
|
|
991
|
+
theme: value
|
|
992
|
+
})
|
|
993
|
+
})))];
|
|
994
|
+
}
|
|
995
|
+
}), createComponent(Section, {
|
|
996
|
+
get children() {
|
|
997
|
+
return [createComponent(SectionTitle, {
|
|
998
|
+
get children() {
|
|
999
|
+
return [createComponent(SectionIcon, {
|
|
1000
|
+
get children() {
|
|
1001
|
+
return createComponent(Link, {});
|
|
1002
|
+
}
|
|
1003
|
+
}), "URL Configuration"];
|
|
1004
|
+
}
|
|
1005
|
+
}), createComponent(SectionDescription, {
|
|
1006
|
+
children: "Control when devtools are available based on URL parameters."
|
|
1007
|
+
}), ssr(_tmpl$32, ssrAttribute("class", escape(styles().settingsGroup, true), false), escape(createComponent(Checkbox, {
|
|
1008
|
+
label: "Require URL Flag",
|
|
1009
|
+
description: "Only show devtools when a specific URL parameter is present",
|
|
1010
|
+
get checked() {
|
|
1011
|
+
return settings().requireUrlFlag;
|
|
1012
|
+
},
|
|
1013
|
+
onChange: (checked) => setSettings({
|
|
1014
|
+
requireUrlFlag: checked
|
|
1015
|
+
})
|
|
1016
|
+
})), escape(createComponent(Show, {
|
|
1017
|
+
get when() {
|
|
1018
|
+
return settings().requireUrlFlag;
|
|
1019
|
+
},
|
|
1020
|
+
get children() {
|
|
1021
|
+
return ssr(_tmpl$23, ssrAttribute("class", escape(styles().conditionalSetting, true), false), escape(createComponent(Input, {
|
|
1022
|
+
label: "URL flag",
|
|
1023
|
+
description: "Enter the URL parameter name (e.g., 'debug' for ?debug=true)",
|
|
1024
|
+
placeholder: "debug",
|
|
1025
|
+
get value() {
|
|
1026
|
+
return settings().urlFlag;
|
|
1027
|
+
},
|
|
1028
|
+
onChange: (e) => setSettings({
|
|
1029
|
+
urlFlag: e
|
|
1030
|
+
})
|
|
1031
|
+
})));
|
|
1032
|
+
}
|
|
1033
|
+
})))];
|
|
1034
|
+
}
|
|
1035
|
+
}), createComponent(Section, {
|
|
1036
|
+
get children() {
|
|
1037
|
+
return [createComponent(SectionTitle, {
|
|
1038
|
+
get children() {
|
|
1039
|
+
return [createComponent(SectionIcon, {
|
|
1040
|
+
get children() {
|
|
1041
|
+
return createComponent(Keyboard, {});
|
|
1042
|
+
}
|
|
1043
|
+
}), "Keyboard"];
|
|
1044
|
+
}
|
|
1045
|
+
}), createComponent(SectionDescription, {
|
|
1046
|
+
children: "Customize keyboard shortcuts for quick access."
|
|
1047
|
+
}), ssr(_tmpl$42, ssrAttribute("class", escape(styles().settingsGroup, true), false), ssrAttribute("class", escape(styles().settingsModifiers, true), false), escape(createComponent(Show, {
|
|
1048
|
+
keyed: true,
|
|
1049
|
+
get when() {
|
|
1050
|
+
return hotkey();
|
|
1051
|
+
},
|
|
1052
|
+
get children() {
|
|
1053
|
+
return [createComponent(Button, {
|
|
1054
|
+
variant: "success",
|
|
1055
|
+
get onclick() {
|
|
1056
|
+
return changeHotkey("Shift");
|
|
1057
|
+
},
|
|
1058
|
+
get outline() {
|
|
1059
|
+
return !hotkey().includes("Shift");
|
|
1060
|
+
},
|
|
1061
|
+
children: "Shift"
|
|
1062
|
+
}), createComponent(Button, {
|
|
1063
|
+
variant: "success",
|
|
1064
|
+
get onclick() {
|
|
1065
|
+
return changeHotkey("Alt");
|
|
1066
|
+
},
|
|
1067
|
+
get outline() {
|
|
1068
|
+
return !hotkey().includes("Alt");
|
|
1069
|
+
},
|
|
1070
|
+
children: "Alt"
|
|
1071
|
+
}), createComponent(Button, {
|
|
1072
|
+
variant: "success",
|
|
1073
|
+
get onclick() {
|
|
1074
|
+
return changeHotkey("Meta");
|
|
1075
|
+
},
|
|
1076
|
+
get outline() {
|
|
1077
|
+
return !hotkey().includes("Meta");
|
|
1078
|
+
},
|
|
1079
|
+
children: "Meta"
|
|
1080
|
+
}), createComponent(Button, {
|
|
1081
|
+
variant: "success",
|
|
1082
|
+
get onclick() {
|
|
1083
|
+
return changeHotkey("Control");
|
|
1084
|
+
},
|
|
1085
|
+
get outline() {
|
|
1086
|
+
return !hotkey().includes("Control");
|
|
1087
|
+
},
|
|
1088
|
+
children: "Control"
|
|
1089
|
+
})];
|
|
1090
|
+
}
|
|
1091
|
+
})), escape(createComponent(Input, {
|
|
1092
|
+
label: "Hotkey to open/close devtools",
|
|
1093
|
+
description: "Use '+' to combine keys (e.g., 'a+b' or 'd'). This will be used with the enabled modifiers from above",
|
|
1094
|
+
placeholder: "a",
|
|
1095
|
+
get value() {
|
|
1096
|
+
return hotkey().filter((key) => !["Shift", "Meta", "Alt", "Ctrl"].includes(key)).join("+");
|
|
1097
|
+
},
|
|
1098
|
+
onChange: (e) => {
|
|
1099
|
+
const makeModifierArray = (key) => {
|
|
1100
|
+
if (key.length === 1) return [uppercaseFirstLetter(key)];
|
|
1101
|
+
const modifiers3 = [];
|
|
1102
|
+
for (const character of key) {
|
|
1103
|
+
const newLetter = uppercaseFirstLetter(character);
|
|
1104
|
+
if (!modifiers3.includes(newLetter)) modifiers3.push(newLetter);
|
|
1105
|
+
}
|
|
1106
|
+
return modifiers3;
|
|
1107
|
+
};
|
|
1108
|
+
const modifiers2 = e.split("+").flatMap((key) => makeModifierArray(key)).filter(Boolean);
|
|
1109
|
+
return setSettings({
|
|
1110
|
+
openHotkey: [...hotkey().filter((key) => ["Shift", "Meta", "Alt", "Ctrl"].includes(key)), ...modifiers2]
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
})), escape(hotkey().join(" + ")))];
|
|
1114
|
+
}
|
|
1115
|
+
}), createComponent(Section, {
|
|
1116
|
+
get children() {
|
|
1117
|
+
return [createComponent(SectionTitle, {
|
|
1118
|
+
get children() {
|
|
1119
|
+
return [createComponent(SectionIcon, {
|
|
1120
|
+
get children() {
|
|
1121
|
+
return createComponent(GeoTag, {});
|
|
1122
|
+
}
|
|
1123
|
+
}), "Position"];
|
|
1124
|
+
}
|
|
1125
|
+
}), createComponent(SectionDescription, {
|
|
1126
|
+
children: "Adjust the position of the trigger button and devtools panel."
|
|
1127
|
+
}), ssr(_tmpl$5, ssrAttribute("class", escape(styles().settingsGroup, true), false), ssrAttribute("class", escape(styles().settingRow, true), false), escape(createComponent(Select, {
|
|
1128
|
+
label: "Trigger Position",
|
|
1129
|
+
options: [{
|
|
1130
|
+
label: "Bottom Right",
|
|
1131
|
+
value: "bottom-right"
|
|
1132
|
+
}, {
|
|
1133
|
+
label: "Bottom Left",
|
|
1134
|
+
value: "bottom-left"
|
|
1135
|
+
}, {
|
|
1136
|
+
label: "Top Right",
|
|
1137
|
+
value: "top-right"
|
|
1138
|
+
}, {
|
|
1139
|
+
label: "Top Left",
|
|
1140
|
+
value: "top-left"
|
|
1141
|
+
}, {
|
|
1142
|
+
label: "Middle Right",
|
|
1143
|
+
value: "middle-right"
|
|
1144
|
+
}, {
|
|
1145
|
+
label: "Middle Left",
|
|
1146
|
+
value: "middle-left"
|
|
1147
|
+
}],
|
|
1148
|
+
get value() {
|
|
1149
|
+
return settings().position;
|
|
1150
|
+
},
|
|
1151
|
+
onChange: (value) => setSettings({
|
|
1152
|
+
position: value
|
|
1153
|
+
})
|
|
1154
|
+
})), escape(createComponent(Select, {
|
|
1155
|
+
label: "Panel Position",
|
|
1156
|
+
get value() {
|
|
1157
|
+
return settings().panelLocation;
|
|
1158
|
+
},
|
|
1159
|
+
options: [{
|
|
1160
|
+
label: "Top",
|
|
1161
|
+
value: "top"
|
|
1162
|
+
}, {
|
|
1163
|
+
label: "Bottom",
|
|
1164
|
+
value: "bottom"
|
|
1165
|
+
}],
|
|
1166
|
+
onChange: (value) => setSettings({
|
|
1167
|
+
panelLocation: value
|
|
1168
|
+
})
|
|
1169
|
+
})))];
|
|
1170
|
+
}
|
|
1171
|
+
})];
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
};
|
|
1175
|
+
var _tmpl$6 = ["<div", "><div", "><div", ">", "</div></div><div", "></div></div>"];
|
|
1176
|
+
var _tmpl$24 = ["<div", "><h3", "></h3></div>"];
|
|
1177
|
+
var PluginsTab = () => {
|
|
1178
|
+
const {
|
|
1179
|
+
plugins,
|
|
1180
|
+
activePlugin,
|
|
1181
|
+
setActivePlugin
|
|
1182
|
+
} = usePlugins();
|
|
1183
|
+
const {
|
|
1184
|
+
expanded,
|
|
1185
|
+
hoverUtils,
|
|
1186
|
+
animationMs
|
|
1187
|
+
} = useDrawContext();
|
|
1188
|
+
useTheme();
|
|
1189
|
+
createEffect(() => {
|
|
1190
|
+
plugins()?.find((plugin) => plugin.id === activePlugin());
|
|
1191
|
+
});
|
|
1192
|
+
const styles = useStyles();
|
|
1193
|
+
return ssr(_tmpl$6, ssrAttribute("class", escape(styles().pluginsTabPanel, true), false), ssrAttribute("class", escape(clsx3(styles().pluginsTabDraw(expanded()), {
|
|
1194
|
+
[styles().pluginsTabDraw(expanded())]: expanded()
|
|
1195
|
+
}, styles().pluginsTabDrawTransition(animationMs)), true), false), ssrAttribute("class", escape(clsx3(styles().pluginsTabSidebar(expanded()), styles().pluginsTabSidebarTransition(animationMs)), true), false), escape(createComponent(For, {
|
|
1196
|
+
get each() {
|
|
1197
|
+
return plugins();
|
|
1198
|
+
},
|
|
1199
|
+
children: (plugin) => {
|
|
1200
|
+
createEffect(() => {
|
|
1201
|
+
});
|
|
1202
|
+
return ssr(_tmpl$24, ssrAttribute("class", escape(clsx3(styles().pluginName, {
|
|
1203
|
+
active: activePlugin() === plugin.id
|
|
1204
|
+
}), true), false), ssrAttribute("id", escape(PLUGIN_TITLE_CONTAINER_ID, true), false));
|
|
1205
|
+
}
|
|
1206
|
+
})), ssrAttribute("id", escape(PLUGIN_CONTAINER_ID, true), false) + ssrAttribute("class", escape(styles().pluginsTabContent, true), false));
|
|
1207
|
+
};
|
|
1208
|
+
function useHeadChanges(onChange, opts = {}) {
|
|
1209
|
+
const {
|
|
1210
|
+
attributes = true,
|
|
1211
|
+
childList = true,
|
|
1212
|
+
subtree = true,
|
|
1213
|
+
observeTitle = true
|
|
1214
|
+
} = opts;
|
|
1215
|
+
onMount(() => {
|
|
1216
|
+
const headObserver = new MutationObserver((mutations) => {
|
|
1217
|
+
for (const m of mutations) {
|
|
1218
|
+
if (m.type === "childList") {
|
|
1219
|
+
m.addedNodes.forEach((node) => onChange({ kind: "added", node }, m));
|
|
1220
|
+
m.removedNodes.forEach(
|
|
1221
|
+
(node) => onChange({ kind: "removed", node }, m)
|
|
1222
|
+
);
|
|
1223
|
+
} else if (m.type === "attributes") {
|
|
1224
|
+
const el = m.target;
|
|
1225
|
+
onChange(
|
|
1226
|
+
{
|
|
1227
|
+
kind: "attr",
|
|
1228
|
+
target: el,
|
|
1229
|
+
name: m.attributeName,
|
|
1230
|
+
oldValue: m.oldValue ?? null
|
|
1231
|
+
},
|
|
1232
|
+
m
|
|
1233
|
+
);
|
|
1234
|
+
} else {
|
|
1235
|
+
const isInTitle = m.target.parentNode && m.target.parentNode.tagName.toLowerCase() === "title";
|
|
1236
|
+
if (isInTitle) onChange({ kind: "title", title: document.title }, m);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
headObserver.observe(document.head, {
|
|
1241
|
+
childList,
|
|
1242
|
+
attributes,
|
|
1243
|
+
subtree,
|
|
1244
|
+
attributeOldValue: attributes,
|
|
1245
|
+
characterData: true,
|
|
1246
|
+
// helps catch <title> text node edits
|
|
1247
|
+
characterDataOldValue: false
|
|
1248
|
+
});
|
|
1249
|
+
let titleObserver;
|
|
1250
|
+
if (observeTitle) {
|
|
1251
|
+
const titleEl = document.head.querySelector("title") || // create a <title> if missing so future changes are observable
|
|
1252
|
+
document.head.appendChild(document.createElement("title"));
|
|
1253
|
+
titleObserver = new MutationObserver(() => {
|
|
1254
|
+
onChange({ kind: "title", title: document.title });
|
|
1255
|
+
});
|
|
1256
|
+
titleObserver.observe(titleEl, {
|
|
1257
|
+
childList: true,
|
|
1258
|
+
characterData: true,
|
|
1259
|
+
subtree: true
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
onCleanup(() => {
|
|
1263
|
+
headObserver.disconnect();
|
|
1264
|
+
titleObserver?.disconnect();
|
|
1265
|
+
});
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
// src/tabs/seo-tab.tsx
|
|
1270
|
+
var _tmpl$7 = ["<div", ' style="', '"><div', ' style="', '">', " Preview</div>", "<div", ">", "</div><div", ">", "</div><div", ">", "</div></div>"];
|
|
1271
|
+
var _tmpl$25 = ["<img", ' alt="Preview"', ">"];
|
|
1272
|
+
var _tmpl$33 = ["<div", ' style="', '">No Image</div>'];
|
|
1273
|
+
var _tmpl$43 = ["<div", ">", "</div>"];
|
|
1274
|
+
var _tmpl$52 = ["<div>", "", "</div>"];
|
|
1275
|
+
var _tmpl$62 = ["<div", "><strong>Missing tags for ", ":</strong><ul", ">", "</ul></div>"];
|
|
1276
|
+
var _tmpl$72 = ["<li", ">", "</li>"];
|
|
1277
|
+
var SOCIALS = [
|
|
1278
|
+
{
|
|
1279
|
+
network: "Facebook",
|
|
1280
|
+
tags: [{
|
|
1281
|
+
key: "og:title",
|
|
1282
|
+
prop: "title"
|
|
1283
|
+
}, {
|
|
1284
|
+
key: "og:description",
|
|
1285
|
+
prop: "description"
|
|
1286
|
+
}, {
|
|
1287
|
+
key: "og:image",
|
|
1288
|
+
prop: "image"
|
|
1289
|
+
}, {
|
|
1290
|
+
key: "og:url",
|
|
1291
|
+
prop: "url"
|
|
1292
|
+
}],
|
|
1293
|
+
color: "#4267B2"
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
network: "X/Twitter",
|
|
1297
|
+
tags: [{
|
|
1298
|
+
key: "twitter:title",
|
|
1299
|
+
prop: "title"
|
|
1300
|
+
}, {
|
|
1301
|
+
key: "twitter:description",
|
|
1302
|
+
prop: "description"
|
|
1303
|
+
}, {
|
|
1304
|
+
key: "twitter:image",
|
|
1305
|
+
prop: "image"
|
|
1306
|
+
}, {
|
|
1307
|
+
key: "twitter:url",
|
|
1308
|
+
prop: "url"
|
|
1309
|
+
}],
|
|
1310
|
+
color: "#1DA1F2"
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
network: "LinkedIn",
|
|
1314
|
+
tags: [{
|
|
1315
|
+
key: "og:title",
|
|
1316
|
+
prop: "title"
|
|
1317
|
+
}, {
|
|
1318
|
+
key: "og:description",
|
|
1319
|
+
prop: "description"
|
|
1320
|
+
}, {
|
|
1321
|
+
key: "og:image",
|
|
1322
|
+
prop: "image"
|
|
1323
|
+
}, {
|
|
1324
|
+
key: "og:url",
|
|
1325
|
+
prop: "url"
|
|
1326
|
+
}],
|
|
1327
|
+
color: "#0077B5"
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
network: "Discord",
|
|
1331
|
+
tags: [{
|
|
1332
|
+
key: "og:title",
|
|
1333
|
+
prop: "title"
|
|
1334
|
+
}, {
|
|
1335
|
+
key: "og:description",
|
|
1336
|
+
prop: "description"
|
|
1337
|
+
}, {
|
|
1338
|
+
key: "og:image",
|
|
1339
|
+
prop: "image"
|
|
1340
|
+
}, {
|
|
1341
|
+
key: "og:url",
|
|
1342
|
+
prop: "url"
|
|
1343
|
+
}],
|
|
1344
|
+
color: "#5865F2"
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
network: "Slack",
|
|
1348
|
+
tags: [{
|
|
1349
|
+
key: "og:title",
|
|
1350
|
+
prop: "title"
|
|
1351
|
+
}, {
|
|
1352
|
+
key: "og:description",
|
|
1353
|
+
prop: "description"
|
|
1354
|
+
}, {
|
|
1355
|
+
key: "og:image",
|
|
1356
|
+
prop: "image"
|
|
1357
|
+
}, {
|
|
1358
|
+
key: "og:url",
|
|
1359
|
+
prop: "url"
|
|
1360
|
+
}],
|
|
1361
|
+
color: "#4A154B"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
network: "Mastodon",
|
|
1365
|
+
tags: [{
|
|
1366
|
+
key: "og:title",
|
|
1367
|
+
prop: "title"
|
|
1368
|
+
}, {
|
|
1369
|
+
key: "og:description",
|
|
1370
|
+
prop: "description"
|
|
1371
|
+
}, {
|
|
1372
|
+
key: "og:image",
|
|
1373
|
+
prop: "image"
|
|
1374
|
+
}, {
|
|
1375
|
+
key: "og:url",
|
|
1376
|
+
prop: "url"
|
|
1377
|
+
}],
|
|
1378
|
+
color: "#6364FF"
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
network: "Bluesky",
|
|
1382
|
+
tags: [{
|
|
1383
|
+
key: "og:title",
|
|
1384
|
+
prop: "title"
|
|
1385
|
+
}, {
|
|
1386
|
+
key: "og:description",
|
|
1387
|
+
prop: "description"
|
|
1388
|
+
}, {
|
|
1389
|
+
key: "og:image",
|
|
1390
|
+
prop: "image"
|
|
1391
|
+
}, {
|
|
1392
|
+
key: "og:url",
|
|
1393
|
+
prop: "url"
|
|
1394
|
+
}],
|
|
1395
|
+
color: "#1185FE"
|
|
1396
|
+
}
|
|
1397
|
+
// Add more networks as needed
|
|
1398
|
+
];
|
|
1399
|
+
function SocialPreview(props) {
|
|
1400
|
+
const styles = useStyles();
|
|
1401
|
+
return ssr(_tmpl$7, ssrAttribute("class", escape(styles().seoPreviewCard, true), false), "border-color:" + escape(props.color, true), ssrAttribute("class", escape(styles().seoPreviewHeader, true), false), "color:" + escape(props.color, true), escape(props.network), props.meta.image ? ssr(_tmpl$25, ssrAttribute("src", escape(props.meta.image, true), false), ssrAttribute("class", escape(styles().seoPreviewImage, true), false)) : ssr(_tmpl$33, ssrAttribute("class", escape(styles().seoPreviewImage, true), false), "background:#222;color:#888;display:flex;align-items:center;justify-content:center;min-height:80px;width:100%"), ssrAttribute("class", escape(styles().seoPreviewTitle, true), false), escape(props.meta.title) || "No Title", ssrAttribute("class", escape(styles().seoPreviewDesc, true), false), escape(props.meta.description) || "No Description", ssrAttribute("class", escape(styles().seoPreviewUrl, true), false), escape(props.meta.url) || escape(window.location.href));
|
|
1402
|
+
}
|
|
1403
|
+
var SeoTab = () => {
|
|
1404
|
+
const [reports, setReports] = createSignal(analyzeHead());
|
|
1405
|
+
const styles = useStyles();
|
|
1406
|
+
function analyzeHead() {
|
|
1407
|
+
const metaTags = Array.from(document.head.querySelectorAll("meta"));
|
|
1408
|
+
const reports2 = [];
|
|
1409
|
+
for (const social of SOCIALS) {
|
|
1410
|
+
const found = {};
|
|
1411
|
+
const missing = [];
|
|
1412
|
+
for (const tag of social.tags) {
|
|
1413
|
+
const meta = metaTags.find((m) => (tag.key.includes("twitter:") ? false : m.getAttribute("property") === tag.key) || m.getAttribute("name") === tag.key);
|
|
1414
|
+
if (meta && meta.getAttribute("content")) {
|
|
1415
|
+
found[tag.prop] = meta.getAttribute("content") || void 0;
|
|
1416
|
+
} else {
|
|
1417
|
+
missing.push(tag.key);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
reports2.push({
|
|
1421
|
+
network: social.network,
|
|
1422
|
+
found,
|
|
1423
|
+
missing
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
return reports2;
|
|
1427
|
+
}
|
|
1428
|
+
useHeadChanges(() => {
|
|
1429
|
+
setReports(analyzeHead());
|
|
1430
|
+
});
|
|
1431
|
+
return createComponent(MainPanel$1, {
|
|
1432
|
+
withPadding: true,
|
|
1433
|
+
get children() {
|
|
1434
|
+
return createComponent(Section, {
|
|
1435
|
+
get children() {
|
|
1436
|
+
return [createComponent(SectionTitle, {
|
|
1437
|
+
get children() {
|
|
1438
|
+
return [createComponent(SectionIcon, {
|
|
1439
|
+
get children() {
|
|
1440
|
+
return createComponent(SocialBubble, {});
|
|
1441
|
+
}
|
|
1442
|
+
}), "Social previews"];
|
|
1443
|
+
}
|
|
1444
|
+
}), createComponent(SectionDescription, {
|
|
1445
|
+
children: "See how your current page will look when shared on popular social networks. The tool checks for essential meta tags and highlights any that are missing."
|
|
1446
|
+
}), ssr(_tmpl$43, ssrAttribute("class", escape(styles().seoPreviewSection, true), false), escape(createComponent(For, {
|
|
1447
|
+
get each() {
|
|
1448
|
+
return reports();
|
|
1449
|
+
},
|
|
1450
|
+
children: (report, i) => {
|
|
1451
|
+
const social = SOCIALS[i()];
|
|
1452
|
+
return ssr(_tmpl$52, escape(createComponent(SocialPreview, {
|
|
1453
|
+
get meta() {
|
|
1454
|
+
return report.found;
|
|
1455
|
+
},
|
|
1456
|
+
get color() {
|
|
1457
|
+
return social.color;
|
|
1458
|
+
},
|
|
1459
|
+
get network() {
|
|
1460
|
+
return social.network;
|
|
1461
|
+
}
|
|
1462
|
+
})), report.missing.length > 0 ? escape(ssr(_tmpl$62, ssrAttribute("class", escape(styles().seoMissingTagsSection, true), false), escape(social?.network), ssrAttribute("class", escape(styles().seoMissingTagsList, true), false), escape(createComponent(For, {
|
|
1463
|
+
get each() {
|
|
1464
|
+
return report.missing;
|
|
1465
|
+
},
|
|
1466
|
+
children: (tag) => ssr(_tmpl$72, ssrAttribute("class", escape(styles().seoMissingTag, true), false), escape(tag))
|
|
1467
|
+
})))) : escape(null));
|
|
1468
|
+
}
|
|
1469
|
+
})))];
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
});
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
// src/tabs/index.tsx
|
|
1477
|
+
var tabs = [{
|
|
1478
|
+
name: "Plugins",
|
|
1479
|
+
id: "plugins",
|
|
1480
|
+
component: () => createComponent(PluginsTab, {}),
|
|
1481
|
+
icon: () => createComponent(List, {})
|
|
1482
|
+
}, {
|
|
1483
|
+
name: "SEO",
|
|
1484
|
+
id: "seo",
|
|
1485
|
+
component: () => createComponent(SeoTab, {}),
|
|
1486
|
+
icon: () => createComponent(PageSearch, {})
|
|
1487
|
+
}, {
|
|
1488
|
+
name: "Settings",
|
|
1489
|
+
id: "settings",
|
|
1490
|
+
component: () => createComponent(SettingsTab, {}),
|
|
1491
|
+
icon: () => createComponent(Cogs, {})
|
|
1492
|
+
}];
|
|
1493
|
+
|
|
1494
|
+
// src/components/tabs.tsx
|
|
1495
|
+
var _tmpl$8 = ["<div", ">", "", "</div>"];
|
|
1496
|
+
var _tmpl$26 = ['<button type="button"', ">", "</button>"];
|
|
1497
|
+
var _tmpl$34 = ['<div style="', '"><button type="button"', ">", '</button><button type="button"', ">", "</button></div>"];
|
|
1498
|
+
var Tabs = (props) => {
|
|
1499
|
+
const styles = useStyles();
|
|
1500
|
+
const {
|
|
1501
|
+
state,
|
|
1502
|
+
setState
|
|
1503
|
+
} = useDevtoolsState();
|
|
1504
|
+
const pipWindow = usePiPWindow();
|
|
1505
|
+
const {
|
|
1506
|
+
hoverUtils
|
|
1507
|
+
} = useDrawContext();
|
|
1508
|
+
return ssr(_tmpl$8, ssrAttribute("class", escape(styles().tabContainer, true), false), escape(createComponent(For, {
|
|
1509
|
+
each: tabs,
|
|
1510
|
+
children: (tab) => ssr(_tmpl$26, ssrAttribute("class", escape(clsx3(styles().tab, {
|
|
1511
|
+
active: state().activeTab === tab.id
|
|
1512
|
+
}), true), false), escape(tab.icon()))
|
|
1513
|
+
})), pipWindow().pipWindow !== null ? escape(null) : ssr(_tmpl$34, "margin-top:auto", ssrAttribute("class", escape(clsx3(styles().tab, "detach"), true), false), escape(createComponent(PiP, {})), ssrAttribute("class", escape(clsx3(styles().tab, "close"), true), false), escape(createComponent(X, {}))));
|
|
1514
|
+
};
|
|
1515
|
+
var _tmpl$9 = ["<div", ">", "</div>"];
|
|
1516
|
+
var TabContent = () => {
|
|
1517
|
+
const {
|
|
1518
|
+
state
|
|
1519
|
+
} = useDevtoolsState();
|
|
1520
|
+
const styles = useStyles();
|
|
1521
|
+
const component = createMemo(() => tabs.find((t) => t.id === state().activeTab)?.component || null);
|
|
1522
|
+
return ssr(_tmpl$9, ssrAttribute("class", escape(styles().tabContent, true), false), escape(component()?.()));
|
|
1523
|
+
};
|
|
1524
|
+
|
|
1525
|
+
// src/devtools.tsx
|
|
1526
|
+
var _tmpl$10 = ["<div", ">", "</div>"];
|
|
1527
|
+
function DevTools() {
|
|
1528
|
+
const {
|
|
1529
|
+
settings
|
|
1530
|
+
} = useDevtoolsSettings();
|
|
1531
|
+
const {
|
|
1532
|
+
setHeight
|
|
1533
|
+
} = useHeight();
|
|
1534
|
+
const {
|
|
1535
|
+
persistOpen,
|
|
1536
|
+
setPersistOpen
|
|
1537
|
+
} = usePersistOpen();
|
|
1538
|
+
const [rootEl, setRootEl] = createSignal();
|
|
1539
|
+
const [isOpen, setIsOpen] = createSignal(settings().defaultOpen || persistOpen());
|
|
1540
|
+
const pip = usePiPWindow();
|
|
1541
|
+
let panelRef = void 0;
|
|
1542
|
+
const [isResizing, setIsResizing] = createSignal(false);
|
|
1543
|
+
const toggleOpen = () => {
|
|
1544
|
+
if (pip().pipWindow) {
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
const open = isOpen();
|
|
1548
|
+
setIsOpen(!open);
|
|
1549
|
+
setPersistOpen(!open);
|
|
1550
|
+
};
|
|
1551
|
+
const handleDragStart = (panelElement, startEvent) => {
|
|
1552
|
+
if (startEvent.button !== 0) return;
|
|
1553
|
+
return;
|
|
1554
|
+
};
|
|
1555
|
+
createEffect(() => {
|
|
1556
|
+
if (isOpen()) {
|
|
1557
|
+
const previousValue = rootEl()?.parentElement?.style.paddingBottom;
|
|
1558
|
+
const run = () => {
|
|
1559
|
+
return;
|
|
1560
|
+
};
|
|
1561
|
+
if (typeof window !== "undefined") {
|
|
1562
|
+
(pip().pipWindow ?? window).addEventListener("resize", run);
|
|
1563
|
+
return () => {
|
|
1564
|
+
(pip().pipWindow ?? window).removeEventListener("resize", run);
|
|
1565
|
+
if (rootEl()?.parentElement && typeof previousValue === "string") {
|
|
1566
|
+
setRootEl((prev) => {
|
|
1567
|
+
return prev;
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
} else {
|
|
1573
|
+
if (rootEl()?.parentElement) {
|
|
1574
|
+
setRootEl((prev) => {
|
|
1575
|
+
if (prev?.parentElement) {
|
|
1576
|
+
prev.parentElement.removeAttribute("style");
|
|
1577
|
+
}
|
|
1578
|
+
return prev;
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
return;
|
|
1583
|
+
});
|
|
1584
|
+
createEffect(() => {
|
|
1585
|
+
window.addEventListener("keydown", (e) => {
|
|
1586
|
+
if (e.key === "Escape" && isOpen()) {
|
|
1587
|
+
toggleOpen();
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
});
|
|
1591
|
+
useDisableTabbing(isOpen);
|
|
1592
|
+
createEffect(() => {
|
|
1593
|
+
if (rootEl()) {
|
|
1594
|
+
const el = rootEl();
|
|
1595
|
+
const fontSize = getComputedStyle(el).fontSize;
|
|
1596
|
+
el?.style.setProperty("--tsrd-font-size", fontSize);
|
|
1597
|
+
}
|
|
1598
|
+
});
|
|
1599
|
+
createEffect(() => {
|
|
1600
|
+
const modifiers = settings().openHotkey.filter((key) => keyboardModifiers.includes(key));
|
|
1601
|
+
const nonModifiers = settings().openHotkey.filter((key) => !keyboardModifiers.includes(key));
|
|
1602
|
+
const allModifierCombinations = getAllPermutations(modifiers);
|
|
1603
|
+
for (const combination of allModifierCombinations) {
|
|
1604
|
+
const permutation = [...combination, ...nonModifiers];
|
|
1605
|
+
createShortcut(permutation, () => {
|
|
1606
|
+
toggleOpen();
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
createEffect(() => {
|
|
1611
|
+
const openSourceHandler = (e) => {
|
|
1612
|
+
const isShiftHeld = e.shiftKey;
|
|
1613
|
+
const isCtrlHeld = e.ctrlKey || e.metaKey;
|
|
1614
|
+
if (!isShiftHeld || !isCtrlHeld) return;
|
|
1615
|
+
if (e.target instanceof HTMLElement) {
|
|
1616
|
+
const dataSource = e.target.getAttribute("data-tsd-source");
|
|
1617
|
+
window.getSelection()?.removeAllRanges();
|
|
1618
|
+
if (dataSource) {
|
|
1619
|
+
e.preventDefault();
|
|
1620
|
+
e.stopPropagation();
|
|
1621
|
+
fetch(`__TSD_HOST__://localhost:__TSD_PORT__/__tsd/open-source?source=${encodeURIComponent(dataSource)}`).catch(() => {
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
window.addEventListener("click", openSourceHandler);
|
|
1627
|
+
onCleanup(() => {
|
|
1628
|
+
window.removeEventListener("click", openSourceHandler);
|
|
1629
|
+
});
|
|
1630
|
+
});
|
|
1631
|
+
const {
|
|
1632
|
+
theme
|
|
1633
|
+
} = useTheme();
|
|
1634
|
+
return createComponent(ThemeContextProvider, {
|
|
1635
|
+
get theme() {
|
|
1636
|
+
return theme();
|
|
1637
|
+
},
|
|
1638
|
+
get children() {
|
|
1639
|
+
return createComponent(Portal, {
|
|
1640
|
+
get mount() {
|
|
1641
|
+
return (pip().pipWindow ?? window).document.body;
|
|
1642
|
+
},
|
|
1643
|
+
get children() {
|
|
1644
|
+
return ssr(_tmpl$10, ssrAttribute("data-testid", escape(TANSTACK_DEVTOOLS, true), false), escape(createComponent(Show, {
|
|
1645
|
+
get when() {
|
|
1646
|
+
return pip().pipWindow !== null ? true : settings().requireUrlFlag ? window.location.search.includes(settings().urlFlag) : true;
|
|
1647
|
+
},
|
|
1648
|
+
get children() {
|
|
1649
|
+
return [createComponent(Trigger, {
|
|
1650
|
+
isOpen,
|
|
1651
|
+
setIsOpen: toggleOpen
|
|
1652
|
+
}), createComponent(MainPanel, {
|
|
1653
|
+
isResizing,
|
|
1654
|
+
isOpen,
|
|
1655
|
+
get children() {
|
|
1656
|
+
return createComponent(ContentPanel, {
|
|
1657
|
+
handleDragStart: (e) => handleDragStart(panelRef, e),
|
|
1658
|
+
get children() {
|
|
1659
|
+
return [createComponent(Tabs, {
|
|
1660
|
+
toggleOpen
|
|
1661
|
+
}), createComponent(TabContent, {})];
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
})];
|
|
1666
|
+
}
|
|
1667
|
+
})));
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
export { DevTools as default };
|