@tanstack/devtools 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk/{G64KXXVZ.js → YGJWPK3G.js} +57 -55
- package/dist/dev.js +3 -3
- package/dist/devtools/{F57NNUQX.js → CMWGZDSU.js} +159 -105
- package/dist/devtools/{OLELRPKB.js → LWN3DL7E.js} +191 -129
- package/dist/index.d.ts +9 -2
- package/dist/index.js +3 -3
- package/dist/server.js +2 -2
- package/package.json +2 -2
- package/src/components/source-inspector.tsx +6 -5
- package/src/context/devtools-context.tsx +2 -0
- package/src/context/devtools-store.ts +10 -2
- package/src/context/use-devtools-context.ts +8 -0
- package/src/devtools.tsx +5 -14
- package/src/styles/use-styles.ts +5 -0
- package/src/tabs/hotkey-config.tsx +97 -0
- package/src/tabs/settings-tab.tsx +23 -86
- package/src/utils/hotkey.test.ts +109 -0
- package/src/utils/hotkey.ts +66 -0
|
@@ -6,33 +6,6 @@ import { createStore } from 'solid-js/store';
|
|
|
6
6
|
var PLUGIN_CONTAINER_ID = "plugin-container";
|
|
7
7
|
var PLUGIN_TITLE_CONTAINER_ID = "plugin-title-container";
|
|
8
8
|
|
|
9
|
-
// src/utils/sanitize.ts
|
|
10
|
-
var tryParseJson = (json) => {
|
|
11
|
-
if (!json) return void 0;
|
|
12
|
-
try {
|
|
13
|
-
return JSON.parse(json);
|
|
14
|
-
} catch (_e) {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
var uppercaseFirstLetter = (value) => value.charAt(0).toUpperCase() + value.slice(1);
|
|
19
|
-
var getAllPermutations = (arr) => {
|
|
20
|
-
const res = [];
|
|
21
|
-
function permutate(arr2, start) {
|
|
22
|
-
if (start === arr2.length - 1) {
|
|
23
|
-
res.push([...arr2]);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
for (let i = start; i < arr2.length; i++) {
|
|
27
|
-
[arr2[start], arr2[i]] = [arr2[i], arr2[start]];
|
|
28
|
-
permutate(arr2, start + 1);
|
|
29
|
-
[arr2[start], arr2[i]] = [arr2[i], arr2[start]];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
permutate(arr, 0);
|
|
33
|
-
return res;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
9
|
// src/utils/storage.ts
|
|
37
10
|
var getStorageItem = (key) => localStorage.getItem(key);
|
|
38
11
|
var setStorageItem = (key, value) => {
|
|
@@ -45,34 +18,6 @@ var setStorageItem = (key, value) => {
|
|
|
45
18
|
var TANSTACK_DEVTOOLS = "tanstack_devtools";
|
|
46
19
|
var TANSTACK_DEVTOOLS_STATE = "tanstack_devtools_state";
|
|
47
20
|
var TANSTACK_DEVTOOLS_SETTINGS = "tanstack_devtools_settings";
|
|
48
|
-
|
|
49
|
-
// src/context/devtools-store.ts
|
|
50
|
-
var keyboardModifiers = [
|
|
51
|
-
"Alt",
|
|
52
|
-
"Control",
|
|
53
|
-
"Meta",
|
|
54
|
-
"Shift"
|
|
55
|
-
];
|
|
56
|
-
var initialState = {
|
|
57
|
-
settings: {
|
|
58
|
-
defaultOpen: false,
|
|
59
|
-
hideUntilHover: false,
|
|
60
|
-
position: "bottom-right",
|
|
61
|
-
panelLocation: "bottom",
|
|
62
|
-
openHotkey: ["Shift", "A"],
|
|
63
|
-
requireUrlFlag: false,
|
|
64
|
-
urlFlag: "tanstack-devtools",
|
|
65
|
-
theme: typeof window !== "undefined" && typeof window.matchMedia !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light",
|
|
66
|
-
triggerHidden: false,
|
|
67
|
-
customTrigger: void 0
|
|
68
|
-
},
|
|
69
|
-
state: {
|
|
70
|
-
activeTab: "plugins",
|
|
71
|
-
height: 400,
|
|
72
|
-
activePlugins: [],
|
|
73
|
-
persistOpen: false
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
21
|
var PiPContext = createContext(void 0);
|
|
77
22
|
var PiPProvider = (props) => {
|
|
78
23
|
const [pipWindow, setPipWindow] = createSignal(null);
|
|
@@ -186,6 +131,63 @@ var usePiPWindow = () => {
|
|
|
186
131
|
// src/utils/constants.ts
|
|
187
132
|
var MAX_ACTIVE_PLUGINS = 3;
|
|
188
133
|
|
|
134
|
+
// src/utils/sanitize.ts
|
|
135
|
+
var tryParseJson = (json) => {
|
|
136
|
+
if (!json) return void 0;
|
|
137
|
+
try {
|
|
138
|
+
return JSON.parse(json);
|
|
139
|
+
} catch (_e) {
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
var uppercaseFirstLetter = (value) => value.charAt(0).toUpperCase() + value.slice(1);
|
|
144
|
+
var getAllPermutations = (arr) => {
|
|
145
|
+
const res = [];
|
|
146
|
+
function permutate(arr2, start) {
|
|
147
|
+
if (start === arr2.length - 1) {
|
|
148
|
+
res.push([...arr2]);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
for (let i = start; i < arr2.length; i++) {
|
|
152
|
+
[arr2[start], arr2[i]] = [arr2[i], arr2[start]];
|
|
153
|
+
permutate(arr2, start + 1);
|
|
154
|
+
[arr2[start], arr2[i]] = [arr2[i], arr2[start]];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
permutate(arr, 0);
|
|
158
|
+
return res;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// src/context/devtools-store.ts
|
|
162
|
+
var keyboardModifiers = [
|
|
163
|
+
"Alt",
|
|
164
|
+
"Control",
|
|
165
|
+
"Meta",
|
|
166
|
+
"Shift",
|
|
167
|
+
"CtrlOrMeta"
|
|
168
|
+
];
|
|
169
|
+
var initialState = {
|
|
170
|
+
settings: {
|
|
171
|
+
defaultOpen: false,
|
|
172
|
+
hideUntilHover: false,
|
|
173
|
+
position: "bottom-right",
|
|
174
|
+
panelLocation: "bottom",
|
|
175
|
+
openHotkey: ["Shift", "A"],
|
|
176
|
+
inspectHotkey: ["Shift", "CtrlOrMeta"],
|
|
177
|
+
requireUrlFlag: false,
|
|
178
|
+
urlFlag: "tanstack-devtools",
|
|
179
|
+
theme: typeof window !== "undefined" && typeof window.matchMedia !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light",
|
|
180
|
+
triggerHidden: false,
|
|
181
|
+
customTrigger: void 0
|
|
182
|
+
},
|
|
183
|
+
state: {
|
|
184
|
+
activeTab: "plugins",
|
|
185
|
+
height: 400,
|
|
186
|
+
activePlugins: [],
|
|
187
|
+
persistOpen: false
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
189
191
|
// src/utils/get-default-active-plugins.ts
|
|
190
192
|
function getDefaultActivePlugins(plugins) {
|
|
191
193
|
if (plugins.length === 0) {
|
package/dist/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { initialState, DevtoolsProvider, PiPProvider } from './chunk/
|
|
2
|
-
export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './chunk/
|
|
1
|
+
import { initialState, DevtoolsProvider, PiPProvider } from './chunk/YGJWPK3G.js';
|
|
2
|
+
export { PLUGIN_CONTAINER_ID, PLUGIN_TITLE_CONTAINER_ID } from './chunk/YGJWPK3G.js';
|
|
3
3
|
import { render, createComponent, Portal } from 'solid-js/web';
|
|
4
4
|
import { lazy } from 'solid-js';
|
|
5
5
|
import { ClientEventBus } from '@tanstack/devtools-event-bus/client';
|
|
@@ -30,7 +30,7 @@ var TanStackDevtoolsCore = class {
|
|
|
30
30
|
const mountTo = el;
|
|
31
31
|
const dispose = render(() => {
|
|
32
32
|
const _self$ = this;
|
|
33
|
-
this.#Component = lazy(() => import('./devtools/
|
|
33
|
+
this.#Component = lazy(() => import('./devtools/LWN3DL7E.js'));
|
|
34
34
|
const Devtools = this.#Component;
|
|
35
35
|
this.#eventBus = new ClientEventBus(this.#eventBusConfig);
|
|
36
36
|
this.#eventBus.start();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { usePiPWindow, keyboardModifiers, getAllPermutations,
|
|
1
|
+
import { usePiPWindow, TANSTACK_DEVTOOLS, keyboardModifiers, getAllPermutations, DevtoolsContext, PLUGIN_TITLE_CONTAINER_ID, PLUGIN_CONTAINER_ID, MAX_ACTIVE_PLUGINS, uppercaseFirstLetter } from '../chunk/YGJWPK3G.js';
|
|
2
2
|
import { createComponent, Portal, ssr, ssrAttribute, escape, ssrStyle } from 'solid-js/web';
|
|
3
3
|
import { createContext, createSignal, createEffect, onCleanup, Show, createMemo, For, useContext, onMount } from 'solid-js';
|
|
4
4
|
import { createShortcut, useKeyDownList } from '@solid-primitives/keyboard';
|
|
@@ -93,6 +93,12 @@ var usePlugins = () => {
|
|
|
93
93
|
const toggleActivePlugins = (pluginId) => {
|
|
94
94
|
setStore((prev) => {
|
|
95
95
|
const isActive = prev.state.activePlugins.includes(pluginId);
|
|
96
|
+
const currentPlugin = store.plugins?.find(
|
|
97
|
+
(plugin) => plugin.id === pluginId
|
|
98
|
+
);
|
|
99
|
+
if (currentPlugin?.destroy && isActive) {
|
|
100
|
+
currentPlugin.destroy(pluginId);
|
|
101
|
+
}
|
|
96
102
|
const updatedPlugins = isActive ? prev.state.activePlugins.filter((id) => id !== pluginId) : [...prev.state.activePlugins, pluginId];
|
|
97
103
|
if (updatedPlugins.length > MAX_ACTIVE_PLUGINS) return prev;
|
|
98
104
|
return {
|
|
@@ -168,6 +174,46 @@ var useDisableTabbing = (isOpen) => {
|
|
|
168
174
|
});
|
|
169
175
|
};
|
|
170
176
|
|
|
177
|
+
// src/utils/hotkey.ts
|
|
178
|
+
var normalizeHotkey = (keys) => {
|
|
179
|
+
if (!keys.includes("CtrlOrMeta")) {
|
|
180
|
+
return [keys];
|
|
181
|
+
}
|
|
182
|
+
return [
|
|
183
|
+
keys.map((key) => key === "CtrlOrMeta" ? "Control" : key),
|
|
184
|
+
keys.map((key) => key === "CtrlOrMeta" ? "Meta" : key)
|
|
185
|
+
];
|
|
186
|
+
};
|
|
187
|
+
var getHotkeyPermutations = (hotkey) => {
|
|
188
|
+
const normalizedHotkeys = normalizeHotkey(hotkey);
|
|
189
|
+
return normalizedHotkeys.flatMap((normalizedHotkey) => {
|
|
190
|
+
const modifiers = normalizedHotkey.filter(
|
|
191
|
+
(key) => keyboardModifiers.includes(key)
|
|
192
|
+
);
|
|
193
|
+
const nonModifiers = normalizedHotkey.filter(
|
|
194
|
+
(key) => !keyboardModifiers.includes(key)
|
|
195
|
+
);
|
|
196
|
+
if (modifiers.length === 0) {
|
|
197
|
+
return [nonModifiers];
|
|
198
|
+
}
|
|
199
|
+
const allModifierCombinations = getAllPermutations(modifiers);
|
|
200
|
+
return allModifierCombinations.map((combo) => [...combo, ...nonModifiers]);
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
var isHotkeyCombinationPressed = (keys, hotkey) => {
|
|
204
|
+
const permutations = getHotkeyPermutations(hotkey);
|
|
205
|
+
const pressedKeys = keys.map((key) => key.toUpperCase());
|
|
206
|
+
return permutations.some(
|
|
207
|
+
(combo) => (
|
|
208
|
+
// every key in the combo must be pressed
|
|
209
|
+
combo.every((key) => pressedKeys.includes(String(key).toUpperCase())) && // and no extra keys beyond the combo
|
|
210
|
+
pressedKeys.every(
|
|
211
|
+
(key) => combo.map((k) => String(k).toUpperCase()).includes(key)
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
|
|
171
217
|
// src/styles/tokens.ts
|
|
172
218
|
var tokens = {
|
|
173
219
|
colors: {
|
|
@@ -898,6 +944,11 @@ var stylesFactory = (theme) => {
|
|
|
898
944
|
display: flex;
|
|
899
945
|
gap: 0.5rem;
|
|
900
946
|
`,
|
|
947
|
+
settingsStack: css2`
|
|
948
|
+
display: flex;
|
|
949
|
+
flex-direction: column;
|
|
950
|
+
gap: 1rem;
|
|
951
|
+
`,
|
|
901
952
|
// No Plugins Fallback Styles
|
|
902
953
|
noPluginsFallback: css2`
|
|
903
954
|
display: flex;
|
|
@@ -1864,31 +1915,84 @@ var ContentPanel = (props) => {
|
|
|
1864
1915
|
} = useDevtoolsSettings();
|
|
1865
1916
|
return ssr(_tmpl$5, 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));
|
|
1866
1917
|
};
|
|
1867
|
-
var _tmpl$6 = ["<div", ">", "", "", "", "</div>"];
|
|
1918
|
+
var _tmpl$6 = ["<div", '><h4 style="', '">', "</h4><div", ">", "</div>", "Final shortcut is: ", "</div>"];
|
|
1919
|
+
var MODIFIER_DISPLAY_NAMES = {
|
|
1920
|
+
Shift: "Shift",
|
|
1921
|
+
Alt: "Alt",
|
|
1922
|
+
Meta: "Meta",
|
|
1923
|
+
Control: "Control",
|
|
1924
|
+
CtrlOrMeta: "Ctrl Or Meta"
|
|
1925
|
+
};
|
|
1926
|
+
var HotkeyConfig = (props) => {
|
|
1927
|
+
const styles = useStyles();
|
|
1928
|
+
const toggleModifier = (modifier) => {
|
|
1929
|
+
if (props.hotkey.includes(modifier)) {
|
|
1930
|
+
props.onHotkeyChange(props.hotkey.filter((key) => key !== modifier));
|
|
1931
|
+
} else {
|
|
1932
|
+
const existingModifiers = props.hotkey.filter((key) => props.modifiers.includes(key));
|
|
1933
|
+
const otherKeys = props.hotkey.filter((key) => !props.modifiers.includes(key));
|
|
1934
|
+
props.onHotkeyChange([...existingModifiers, modifier, ...otherKeys]);
|
|
1935
|
+
}
|
|
1936
|
+
};
|
|
1937
|
+
const getNonModifierValue = () => {
|
|
1938
|
+
return props.hotkey.filter((key) => !props.modifiers.includes(key)).join("+");
|
|
1939
|
+
};
|
|
1940
|
+
const handleKeyInput = (input) => {
|
|
1941
|
+
const makeModifierArray = (key) => {
|
|
1942
|
+
if (key.length === 1) return [uppercaseFirstLetter(key)];
|
|
1943
|
+
const modifiersArray = [];
|
|
1944
|
+
for (const character of key) {
|
|
1945
|
+
const newLetter = uppercaseFirstLetter(character);
|
|
1946
|
+
if (!modifiersArray.includes(newLetter)) modifiersArray.push(newLetter);
|
|
1947
|
+
}
|
|
1948
|
+
return modifiersArray;
|
|
1949
|
+
};
|
|
1950
|
+
const hotkeyModifiers = props.hotkey.filter((key) => props.modifiers.includes(key));
|
|
1951
|
+
const newKeys = input.split("+").flatMap((key) => makeModifierArray(key)).filter(Boolean);
|
|
1952
|
+
props.onHotkeyChange([...hotkeyModifiers, ...newKeys]);
|
|
1953
|
+
};
|
|
1954
|
+
const getDisplayHotkey = () => {
|
|
1955
|
+
return props.hotkey.join(" + ");
|
|
1956
|
+
};
|
|
1957
|
+
return ssr(_tmpl$6, ssrAttribute("class", escape(styles().settingsGroup, true), false), "margin:0", escape(props.description), ssrAttribute("class", escape(styles().settingsModifiers, true), false), escape(createComponent(Show, {
|
|
1958
|
+
keyed: true,
|
|
1959
|
+
get when() {
|
|
1960
|
+
return props.hotkey;
|
|
1961
|
+
},
|
|
1962
|
+
get children() {
|
|
1963
|
+
return props.modifiers.map((modifier) => createComponent(Button, {
|
|
1964
|
+
variant: "success",
|
|
1965
|
+
onclick: () => toggleModifier(modifier),
|
|
1966
|
+
get outline() {
|
|
1967
|
+
return !props.hotkey.includes(modifier);
|
|
1968
|
+
},
|
|
1969
|
+
get children() {
|
|
1970
|
+
return MODIFIER_DISPLAY_NAMES[modifier] || modifier;
|
|
1971
|
+
}
|
|
1972
|
+
}));
|
|
1973
|
+
}
|
|
1974
|
+
})), escape(createComponent(Input, {
|
|
1975
|
+
description: "Use '+' to combine keys (e.g., 'a+b' or 'd'). This will be used with the enabled modifiers from above",
|
|
1976
|
+
placeholder: "a",
|
|
1977
|
+
get value() {
|
|
1978
|
+
return getNonModifierValue();
|
|
1979
|
+
},
|
|
1980
|
+
onChange: handleKeyInput
|
|
1981
|
+
})), escape(getDisplayHotkey()));
|
|
1982
|
+
};
|
|
1983
|
+
|
|
1984
|
+
// src/tabs/settings-tab.tsx
|
|
1985
|
+
var _tmpl$7 = ["<div", ">", "", "", "", "</div>"];
|
|
1868
1986
|
var _tmpl$23 = ["<div", ">", "</div>"];
|
|
1869
1987
|
var _tmpl$32 = ["<div", ">", "", "</div>"];
|
|
1870
|
-
var _tmpl$42 = ["<div", "><div", ">", "
|
|
1871
|
-
var _tmpl$52 = ["<div", "><div", ">", "", "</div></div>"];
|
|
1988
|
+
var _tmpl$42 = ["<div", "><div", ">", "", "</div></div>"];
|
|
1872
1989
|
var SettingsTab = () => {
|
|
1873
1990
|
const {
|
|
1874
1991
|
setSettings,
|
|
1875
1992
|
settings
|
|
1876
1993
|
} = useDevtoolsSettings();
|
|
1877
1994
|
const styles = useStyles();
|
|
1878
|
-
const
|
|
1879
|
-
const modifiers = ["Control", "Alt", "Meta", "Shift"];
|
|
1880
|
-
const changeHotkey = (newHotkey) => () => {
|
|
1881
|
-
if (hotkey().includes(newHotkey)) {
|
|
1882
|
-
return setSettings({
|
|
1883
|
-
openHotkey: hotkey().filter((key) => key !== newHotkey)
|
|
1884
|
-
});
|
|
1885
|
-
}
|
|
1886
|
-
const existingModifiers = hotkey().filter((key) => modifiers.includes(key));
|
|
1887
|
-
const otherModifiers = hotkey().filter((key) => !modifiers.includes(key));
|
|
1888
|
-
setSettings({
|
|
1889
|
-
openHotkey: [...existingModifiers, newHotkey, ...otherModifiers]
|
|
1890
|
-
});
|
|
1891
|
-
};
|
|
1995
|
+
const modifiers = ["CtrlOrMeta", "Alt", "Shift"];
|
|
1892
1996
|
return createComponent(MainPanel$1, {
|
|
1893
1997
|
withPadding: true,
|
|
1894
1998
|
get children() {
|
|
@@ -1904,7 +2008,7 @@ var SettingsTab = () => {
|
|
|
1904
2008
|
}
|
|
1905
2009
|
}), createComponent(SectionDescription, {
|
|
1906
2010
|
children: "Configure general behavior of the devtools panel."
|
|
1907
|
-
}), ssr(_tmpl$
|
|
2011
|
+
}), ssr(_tmpl$7, ssrAttribute("class", escape(styles().settingsGroup, true), false), escape(createComponent(Checkbox, {
|
|
1908
2012
|
label: "Default open",
|
|
1909
2013
|
description: "Automatically open the devtools panel when the page loads",
|
|
1910
2014
|
onChange: () => setSettings({
|
|
@@ -2001,73 +2105,27 @@ var SettingsTab = () => {
|
|
|
2001
2105
|
}
|
|
2002
2106
|
}), createComponent(SectionDescription, {
|
|
2003
2107
|
children: "Customize keyboard shortcuts for quick access."
|
|
2004
|
-
}), ssr(_tmpl$
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2108
|
+
}), ssr(_tmpl$32, ssrAttribute("class", escape(styles().settingsStack, true), false), escape(createComponent(HotkeyConfig, {
|
|
2109
|
+
title: "Open/Close Devtools",
|
|
2110
|
+
description: "Hotkey to open/close devtools",
|
|
2111
|
+
get hotkey() {
|
|
2112
|
+
return settings().openHotkey;
|
|
2008
2113
|
},
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
children: "Shift"
|
|
2019
|
-
}), createComponent(Button, {
|
|
2020
|
-
variant: "success",
|
|
2021
|
-
get onclick() {
|
|
2022
|
-
return changeHotkey("Alt");
|
|
2023
|
-
},
|
|
2024
|
-
get outline() {
|
|
2025
|
-
return !hotkey().includes("Alt");
|
|
2026
|
-
},
|
|
2027
|
-
children: "Alt"
|
|
2028
|
-
}), createComponent(Button, {
|
|
2029
|
-
variant: "success",
|
|
2030
|
-
get onclick() {
|
|
2031
|
-
return changeHotkey("Meta");
|
|
2032
|
-
},
|
|
2033
|
-
get outline() {
|
|
2034
|
-
return !hotkey().includes("Meta");
|
|
2035
|
-
},
|
|
2036
|
-
children: "Meta"
|
|
2037
|
-
}), createComponent(Button, {
|
|
2038
|
-
variant: "success",
|
|
2039
|
-
get onclick() {
|
|
2040
|
-
return changeHotkey("Control");
|
|
2041
|
-
},
|
|
2042
|
-
get outline() {
|
|
2043
|
-
return !hotkey().includes("Control");
|
|
2044
|
-
},
|
|
2045
|
-
children: "Control"
|
|
2046
|
-
})];
|
|
2047
|
-
}
|
|
2048
|
-
})), escape(createComponent(Input, {
|
|
2049
|
-
label: "Hotkey to open/close devtools",
|
|
2050
|
-
description: "Use '+' to combine keys (e.g., 'a+b' or 'd'). This will be used with the enabled modifiers from above",
|
|
2051
|
-
placeholder: "a",
|
|
2052
|
-
get value() {
|
|
2053
|
-
return hotkey().filter((key) => !["Shift", "Meta", "Alt", "Ctrl"].includes(key)).join("+");
|
|
2114
|
+
modifiers,
|
|
2115
|
+
onHotkeyChange: (hotkey) => setSettings({
|
|
2116
|
+
openHotkey: hotkey
|
|
2117
|
+
})
|
|
2118
|
+
})), escape(createComponent(HotkeyConfig, {
|
|
2119
|
+
title: "Source Inspector",
|
|
2120
|
+
description: "Hotkey to open source inspector",
|
|
2121
|
+
get hotkey() {
|
|
2122
|
+
return settings().inspectHotkey;
|
|
2054
2123
|
},
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
const newLetter = uppercaseFirstLetter(character);
|
|
2061
|
-
if (!modifiers3.includes(newLetter)) modifiers3.push(newLetter);
|
|
2062
|
-
}
|
|
2063
|
-
return modifiers3;
|
|
2064
|
-
};
|
|
2065
|
-
const modifiers2 = e.split("+").flatMap((key) => makeModifierArray(key)).filter(Boolean);
|
|
2066
|
-
return setSettings({
|
|
2067
|
-
openHotkey: [...hotkey().filter((key) => ["Shift", "Meta", "Alt", "Ctrl"].includes(key)), ...modifiers2]
|
|
2068
|
-
});
|
|
2069
|
-
}
|
|
2070
|
-
})), escape(hotkey().join(" + ")))];
|
|
2124
|
+
modifiers,
|
|
2125
|
+
onHotkeyChange: (hotkey) => setSettings({
|
|
2126
|
+
inspectHotkey: hotkey
|
|
2127
|
+
})
|
|
2128
|
+
})))];
|
|
2071
2129
|
}
|
|
2072
2130
|
}), createComponent(Section, {
|
|
2073
2131
|
get children() {
|
|
@@ -2081,7 +2139,7 @@ var SettingsTab = () => {
|
|
|
2081
2139
|
}
|
|
2082
2140
|
}), createComponent(SectionDescription, {
|
|
2083
2141
|
children: "Adjust the position of the trigger button and devtools panel."
|
|
2084
|
-
}), ssr(_tmpl$
|
|
2142
|
+
}), ssr(_tmpl$42, ssrAttribute("class", escape(styles().settingsGroup, true), false), ssrAttribute("class", escape(styles().settingRow, true), false), escape(createComponent(Select, {
|
|
2085
2143
|
label: "Trigger Position",
|
|
2086
2144
|
options: [{
|
|
2087
2145
|
label: "Bottom Right",
|
|
@@ -2206,14 +2264,14 @@ var getBadgeText = (card) => {
|
|
|
2206
2264
|
};
|
|
2207
2265
|
|
|
2208
2266
|
// src/tabs/marketplace/plugin-card.tsx
|
|
2209
|
-
var _tmpl$
|
|
2267
|
+
var _tmpl$8 = ["<div", ">New</div>"];
|
|
2210
2268
|
var _tmpl$24 = ["<img", ">"];
|
|
2211
2269
|
var _tmpl$33 = ["<span", ">\u2713 v", " \u2022 Min v", "</span>"];
|
|
2212
2270
|
var _tmpl$43 = ["<p", ">", "</p>"];
|
|
2213
|
-
var _tmpl$
|
|
2271
|
+
var _tmpl$52 = ["<a", ' target="_blank" rel="noopener noreferrer"', ">Documentation ", "</a>"];
|
|
2214
2272
|
var _tmpl$62 = ["<div", ">", "</div>"];
|
|
2215
2273
|
var _tmpl$72 = ['<div class="', '" style="', '">', "<span", ">", '</span><div class="', '">', "</div><div", "><h3", ">", "</h3><p", ">", "</p><p", ">", "</p>", "", "", "</div>", "</div>"];
|
|
2216
|
-
var _tmpl$
|
|
2274
|
+
var _tmpl$82 = ["<span", ">\u26A0\uFE0F v", " \u2022 Requires v", "+</span>"];
|
|
2217
2275
|
var _tmpl$9 = ["<span", ">", "</span>"];
|
|
2218
2276
|
var _tmpl$0 = ["<div", "></div>"];
|
|
2219
2277
|
var _tmpl$1 = ["<span", ">Installing...</span>"];
|
|
@@ -2229,7 +2287,7 @@ var PluginCardComponent = (props) => {
|
|
|
2229
2287
|
return card.metadata?.isNew;
|
|
2230
2288
|
},
|
|
2231
2289
|
get children() {
|
|
2232
|
-
return ssr(_tmpl$
|
|
2290
|
+
return ssr(_tmpl$8, ssrAttribute("class", escape(styles().pluginMarketplaceNewBanner, true), false));
|
|
2233
2291
|
}
|
|
2234
2292
|
})), ssrAttribute("class", escape(getBadgeClass(card, styles), true), false), escape(getBadgeText(card)), `${escape(styles().pluginMarketplaceCardIcon, true) || ""} ${!!card.metadata?.logoUrl ? "custom-logo" : ""}`, escape(createComponent(Show, {
|
|
2235
2293
|
get when() {
|
|
@@ -2251,7 +2309,7 @@ var PluginCardComponent = (props) => {
|
|
|
2251
2309
|
return card.versionInfo?.satisfied;
|
|
2252
2310
|
},
|
|
2253
2311
|
get fallback() {
|
|
2254
|
-
return ssr(_tmpl$
|
|
2312
|
+
return ssr(_tmpl$82, ssrAttribute("class", escape(styles().pluginMarketplaceCardVersionUnsatisfied, true), false), escape(card.versionInfo?.current), escape(card.versionInfo?.required));
|
|
2255
2313
|
},
|
|
2256
2314
|
get children() {
|
|
2257
2315
|
return ssr(_tmpl$33, ssrAttribute("class", escape(styles().pluginMarketplaceCardVersionSatisfied, true), false), escape(card.versionInfo?.current), escape(card.versionInfo?.required));
|
|
@@ -2263,7 +2321,7 @@ var PluginCardComponent = (props) => {
|
|
|
2263
2321
|
return card.metadata?.docsUrl;
|
|
2264
2322
|
},
|
|
2265
2323
|
get children() {
|
|
2266
|
-
return ssr(_tmpl$
|
|
2324
|
+
return ssr(_tmpl$52, ssrAttribute("href", escape(card.metadata?.docsUrl, true), false), ssrAttribute("class", escape(styles().pluginMarketplaceCardDocsLink, true), false), escape(createComponent(ExternalLinkIcon, {})));
|
|
2267
2325
|
}
|
|
2268
2326
|
})), escape(createComponent(Show, {
|
|
2269
2327
|
get when() {
|
|
@@ -2330,12 +2388,12 @@ var _tmpl$12 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill
|
|
|
2330
2388
|
var _tmpl$25 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="20" height="16" rx="2"></rect><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"></path></svg>';
|
|
2331
2389
|
var _tmpl$34 = ["<div", "><div", "><h4", "><span", ">", "</span>Want to be featured here?</h4><p", `>If you've built a plugin for TanStack Devtools and would like to showcase it in the featured section, we'd love to hear from you! Reach out to us to discuss partnership opportunities.</p><a href="mailto:partners+devtools@tanstack.com?subject=Featured%20Plugin%20Partnership%20Inquiry"`, "><span", ">", "</span>Contact Us</a></div></div>"];
|
|
2332
2390
|
var _tmpl$44 = ["<div", ">", "</div>"];
|
|
2333
|
-
var _tmpl$
|
|
2391
|
+
var _tmpl$53 = ["<div", "><div", "><div", '><div class="', '">', "</div><h3", ">", "</h3></div></div>", "</div>"];
|
|
2334
2392
|
var StarIcon = () => ssr(_tmpl$12);
|
|
2335
2393
|
var MailIcon = () => ssr(_tmpl$25);
|
|
2336
2394
|
var PluginSectionComponent = (props) => {
|
|
2337
2395
|
const styles = useStyles();
|
|
2338
|
-
return ssr(_tmpl$
|
|
2396
|
+
return ssr(_tmpl$53, ssrAttribute("class", escape(styles().pluginMarketplaceSection, true), false), ssrAttribute("class", escape(styles().pluginMarketplaceSectionHeader, true), false), ssrAttribute("class", escape(styles().pluginMarketplaceSectionHeaderLeft, true), false), `${escape(styles().pluginMarketplaceSectionChevron, true) || ""} ${props.isCollapsed() ? escape(escape(styles().pluginMarketplaceSectionChevronCollapsed, true), true) : ""}`, escape(createComponent(ChevronDownIcon, {})), ssrAttribute("class", escape(styles().pluginMarketplaceSectionTitle, true), false), escape(props.section.displayName), escape(createComponent(Show, {
|
|
2339
2397
|
get when() {
|
|
2340
2398
|
return !props.isCollapsed();
|
|
2341
2399
|
},
|
|
@@ -3175,7 +3233,7 @@ var _tmpl$18 = ["<div", ' style="', '"><div', ' style="', '">', " Preview</div>"
|
|
|
3175
3233
|
var _tmpl$29 = ["<img", ' alt="Preview"', ">"];
|
|
3176
3234
|
var _tmpl$36 = ["<div", ' style="', '">No Image</div>'];
|
|
3177
3235
|
var _tmpl$45 = ["<div", ">", "</div>"];
|
|
3178
|
-
var _tmpl$
|
|
3236
|
+
var _tmpl$54 = ["<div>", "", "</div>"];
|
|
3179
3237
|
var _tmpl$63 = ["<div", "><strong>Missing tags for ", ":</strong><ul", ">", "</ul></div>"];
|
|
3180
3238
|
var _tmpl$73 = ["<li", ">", "</li>"];
|
|
3181
3239
|
var SOCIALS = [
|
|
@@ -3353,7 +3411,7 @@ var SeoTab = () => {
|
|
|
3353
3411
|
},
|
|
3354
3412
|
children: (report, i) => {
|
|
3355
3413
|
const social = SOCIALS[i()];
|
|
3356
|
-
return ssr(_tmpl$
|
|
3414
|
+
return ssr(_tmpl$54, escape(createComponent(SocialPreview, {
|
|
3357
3415
|
get meta() {
|
|
3358
3416
|
return report.found;
|
|
3359
3417
|
},
|
|
@@ -3428,6 +3486,9 @@ var TabContent = () => {
|
|
|
3428
3486
|
var _tmpl$21 = ['<div style="', '">', "</div>"];
|
|
3429
3487
|
var _tmpl$211 = ['<div style="', '"></div>'];
|
|
3430
3488
|
var SourceInspector = () => {
|
|
3489
|
+
const {
|
|
3490
|
+
settings
|
|
3491
|
+
} = useDevtoolsSettings();
|
|
3431
3492
|
const highlightStateInit = () => ({
|
|
3432
3493
|
element: null,
|
|
3433
3494
|
bounding: {
|
|
@@ -3456,11 +3517,7 @@ var SourceInspector = () => {
|
|
|
3456
3517
|
});
|
|
3457
3518
|
const downList = useKeyDownList();
|
|
3458
3519
|
const isHighlightingKeysHeld = createMemo(() => {
|
|
3459
|
-
|
|
3460
|
-
const isShiftHeld = keys.includes("SHIFT");
|
|
3461
|
-
const isCtrlHeld = keys.includes("CONTROL");
|
|
3462
|
-
const isMetaHeld = keys.includes("META");
|
|
3463
|
-
return isShiftHeld && (isCtrlHeld || isMetaHeld);
|
|
3520
|
+
return isHotkeyCombinationPressed(downList(), settings().inspectHotkey);
|
|
3464
3521
|
});
|
|
3465
3522
|
createEffect(() => {
|
|
3466
3523
|
if (!isHighlightingKeysHeld()) {
|
|
@@ -3657,11 +3714,8 @@ function DevTools() {
|
|
|
3657
3714
|
}
|
|
3658
3715
|
});
|
|
3659
3716
|
createEffect(() => {
|
|
3660
|
-
const
|
|
3661
|
-
const
|
|
3662
|
-
const allModifierCombinations = getAllPermutations(modifiers);
|
|
3663
|
-
for (const combination of allModifierCombinations) {
|
|
3664
|
-
const permutation = [...combination, ...nonModifiers];
|
|
3717
|
+
const permutations = getHotkeyPermutations(settings().openHotkey);
|
|
3718
|
+
for (const permutation of permutations) {
|
|
3665
3719
|
createShortcut(permutation, () => {
|
|
3666
3720
|
toggleOpen();
|
|
3667
3721
|
});
|