@tanstack/devtools 0.8.2 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk/{G64KXXVZ.js → YGJWPK3G.js} +57 -55
- package/dist/dev.js +3 -3
- package/dist/devtools/{I7ZVYS6Q.js → CMWGZDSU.js} +153 -105
- package/dist/devtools/{GGWR254Q.js → LWN3DL7E.js} +185 -129
- package/dist/index.d.ts +8 -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-store.ts +10 -2
- 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';
|
|
@@ -174,6 +174,46 @@ var useDisableTabbing = (isOpen) => {
|
|
|
174
174
|
});
|
|
175
175
|
};
|
|
176
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
|
+
|
|
177
217
|
// src/styles/tokens.ts
|
|
178
218
|
var tokens = {
|
|
179
219
|
colors: {
|
|
@@ -904,6 +944,11 @@ var stylesFactory = (theme) => {
|
|
|
904
944
|
display: flex;
|
|
905
945
|
gap: 0.5rem;
|
|
906
946
|
`,
|
|
947
|
+
settingsStack: css2`
|
|
948
|
+
display: flex;
|
|
949
|
+
flex-direction: column;
|
|
950
|
+
gap: 1rem;
|
|
951
|
+
`,
|
|
907
952
|
// No Plugins Fallback Styles
|
|
908
953
|
noPluginsFallback: css2`
|
|
909
954
|
display: flex;
|
|
@@ -1870,31 +1915,84 @@ var ContentPanel = (props) => {
|
|
|
1870
1915
|
} = useDevtoolsSettings();
|
|
1871
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));
|
|
1872
1917
|
};
|
|
1873
|
-
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>"];
|
|
1874
1986
|
var _tmpl$23 = ["<div", ">", "</div>"];
|
|
1875
1987
|
var _tmpl$32 = ["<div", ">", "", "</div>"];
|
|
1876
|
-
var _tmpl$42 = ["<div", "><div", ">", "
|
|
1877
|
-
var _tmpl$52 = ["<div", "><div", ">", "", "</div></div>"];
|
|
1988
|
+
var _tmpl$42 = ["<div", "><div", ">", "", "</div></div>"];
|
|
1878
1989
|
var SettingsTab = () => {
|
|
1879
1990
|
const {
|
|
1880
1991
|
setSettings,
|
|
1881
1992
|
settings
|
|
1882
1993
|
} = useDevtoolsSettings();
|
|
1883
1994
|
const styles = useStyles();
|
|
1884
|
-
const
|
|
1885
|
-
const modifiers = ["Control", "Alt", "Meta", "Shift"];
|
|
1886
|
-
const changeHotkey = (newHotkey) => () => {
|
|
1887
|
-
if (hotkey().includes(newHotkey)) {
|
|
1888
|
-
return setSettings({
|
|
1889
|
-
openHotkey: hotkey().filter((key) => key !== newHotkey)
|
|
1890
|
-
});
|
|
1891
|
-
}
|
|
1892
|
-
const existingModifiers = hotkey().filter((key) => modifiers.includes(key));
|
|
1893
|
-
const otherModifiers = hotkey().filter((key) => !modifiers.includes(key));
|
|
1894
|
-
setSettings({
|
|
1895
|
-
openHotkey: [...existingModifiers, newHotkey, ...otherModifiers]
|
|
1896
|
-
});
|
|
1897
|
-
};
|
|
1995
|
+
const modifiers = ["CtrlOrMeta", "Alt", "Shift"];
|
|
1898
1996
|
return createComponent(MainPanel$1, {
|
|
1899
1997
|
withPadding: true,
|
|
1900
1998
|
get children() {
|
|
@@ -1910,7 +2008,7 @@ var SettingsTab = () => {
|
|
|
1910
2008
|
}
|
|
1911
2009
|
}), createComponent(SectionDescription, {
|
|
1912
2010
|
children: "Configure general behavior of the devtools panel."
|
|
1913
|
-
}), ssr(_tmpl$
|
|
2011
|
+
}), ssr(_tmpl$7, ssrAttribute("class", escape(styles().settingsGroup, true), false), escape(createComponent(Checkbox, {
|
|
1914
2012
|
label: "Default open",
|
|
1915
2013
|
description: "Automatically open the devtools panel when the page loads",
|
|
1916
2014
|
onChange: () => setSettings({
|
|
@@ -2007,73 +2105,27 @@ var SettingsTab = () => {
|
|
|
2007
2105
|
}
|
|
2008
2106
|
}), createComponent(SectionDescription, {
|
|
2009
2107
|
children: "Customize keyboard shortcuts for quick access."
|
|
2010
|
-
}), ssr(_tmpl$
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
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;
|
|
2014
2113
|
},
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
children: "Shift"
|
|
2025
|
-
}), createComponent(Button, {
|
|
2026
|
-
variant: "success",
|
|
2027
|
-
get onclick() {
|
|
2028
|
-
return changeHotkey("Alt");
|
|
2029
|
-
},
|
|
2030
|
-
get outline() {
|
|
2031
|
-
return !hotkey().includes("Alt");
|
|
2032
|
-
},
|
|
2033
|
-
children: "Alt"
|
|
2034
|
-
}), createComponent(Button, {
|
|
2035
|
-
variant: "success",
|
|
2036
|
-
get onclick() {
|
|
2037
|
-
return changeHotkey("Meta");
|
|
2038
|
-
},
|
|
2039
|
-
get outline() {
|
|
2040
|
-
return !hotkey().includes("Meta");
|
|
2041
|
-
},
|
|
2042
|
-
children: "Meta"
|
|
2043
|
-
}), createComponent(Button, {
|
|
2044
|
-
variant: "success",
|
|
2045
|
-
get onclick() {
|
|
2046
|
-
return changeHotkey("Control");
|
|
2047
|
-
},
|
|
2048
|
-
get outline() {
|
|
2049
|
-
return !hotkey().includes("Control");
|
|
2050
|
-
},
|
|
2051
|
-
children: "Control"
|
|
2052
|
-
})];
|
|
2053
|
-
}
|
|
2054
|
-
})), escape(createComponent(Input, {
|
|
2055
|
-
label: "Hotkey to open/close devtools",
|
|
2056
|
-
description: "Use '+' to combine keys (e.g., 'a+b' or 'd'). This will be used with the enabled modifiers from above",
|
|
2057
|
-
placeholder: "a",
|
|
2058
|
-
get value() {
|
|
2059
|
-
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;
|
|
2060
2123
|
},
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
const newLetter = uppercaseFirstLetter(character);
|
|
2067
|
-
if (!modifiers3.includes(newLetter)) modifiers3.push(newLetter);
|
|
2068
|
-
}
|
|
2069
|
-
return modifiers3;
|
|
2070
|
-
};
|
|
2071
|
-
const modifiers2 = e.split("+").flatMap((key) => makeModifierArray(key)).filter(Boolean);
|
|
2072
|
-
return setSettings({
|
|
2073
|
-
openHotkey: [...hotkey().filter((key) => ["Shift", "Meta", "Alt", "Ctrl"].includes(key)), ...modifiers2]
|
|
2074
|
-
});
|
|
2075
|
-
}
|
|
2076
|
-
})), escape(hotkey().join(" + ")))];
|
|
2124
|
+
modifiers,
|
|
2125
|
+
onHotkeyChange: (hotkey) => setSettings({
|
|
2126
|
+
inspectHotkey: hotkey
|
|
2127
|
+
})
|
|
2128
|
+
})))];
|
|
2077
2129
|
}
|
|
2078
2130
|
}), createComponent(Section, {
|
|
2079
2131
|
get children() {
|
|
@@ -2087,7 +2139,7 @@ var SettingsTab = () => {
|
|
|
2087
2139
|
}
|
|
2088
2140
|
}), createComponent(SectionDescription, {
|
|
2089
2141
|
children: "Adjust the position of the trigger button and devtools panel."
|
|
2090
|
-
}), ssr(_tmpl$
|
|
2142
|
+
}), ssr(_tmpl$42, ssrAttribute("class", escape(styles().settingsGroup, true), false), ssrAttribute("class", escape(styles().settingRow, true), false), escape(createComponent(Select, {
|
|
2091
2143
|
label: "Trigger Position",
|
|
2092
2144
|
options: [{
|
|
2093
2145
|
label: "Bottom Right",
|
|
@@ -2212,14 +2264,14 @@ var getBadgeText = (card) => {
|
|
|
2212
2264
|
};
|
|
2213
2265
|
|
|
2214
2266
|
// src/tabs/marketplace/plugin-card.tsx
|
|
2215
|
-
var _tmpl$
|
|
2267
|
+
var _tmpl$8 = ["<div", ">New</div>"];
|
|
2216
2268
|
var _tmpl$24 = ["<img", ">"];
|
|
2217
2269
|
var _tmpl$33 = ["<span", ">\u2713 v", " \u2022 Min v", "</span>"];
|
|
2218
2270
|
var _tmpl$43 = ["<p", ">", "</p>"];
|
|
2219
|
-
var _tmpl$
|
|
2271
|
+
var _tmpl$52 = ["<a", ' target="_blank" rel="noopener noreferrer"', ">Documentation ", "</a>"];
|
|
2220
2272
|
var _tmpl$62 = ["<div", ">", "</div>"];
|
|
2221
2273
|
var _tmpl$72 = ['<div class="', '" style="', '">', "<span", ">", '</span><div class="', '">', "</div><div", "><h3", ">", "</h3><p", ">", "</p><p", ">", "</p>", "", "", "</div>", "</div>"];
|
|
2222
|
-
var _tmpl$
|
|
2274
|
+
var _tmpl$82 = ["<span", ">\u26A0\uFE0F v", " \u2022 Requires v", "+</span>"];
|
|
2223
2275
|
var _tmpl$9 = ["<span", ">", "</span>"];
|
|
2224
2276
|
var _tmpl$0 = ["<div", "></div>"];
|
|
2225
2277
|
var _tmpl$1 = ["<span", ">Installing...</span>"];
|
|
@@ -2235,7 +2287,7 @@ var PluginCardComponent = (props) => {
|
|
|
2235
2287
|
return card.metadata?.isNew;
|
|
2236
2288
|
},
|
|
2237
2289
|
get children() {
|
|
2238
|
-
return ssr(_tmpl$
|
|
2290
|
+
return ssr(_tmpl$8, ssrAttribute("class", escape(styles().pluginMarketplaceNewBanner, true), false));
|
|
2239
2291
|
}
|
|
2240
2292
|
})), ssrAttribute("class", escape(getBadgeClass(card, styles), true), false), escape(getBadgeText(card)), `${escape(styles().pluginMarketplaceCardIcon, true) || ""} ${!!card.metadata?.logoUrl ? "custom-logo" : ""}`, escape(createComponent(Show, {
|
|
2241
2293
|
get when() {
|
|
@@ -2257,7 +2309,7 @@ var PluginCardComponent = (props) => {
|
|
|
2257
2309
|
return card.versionInfo?.satisfied;
|
|
2258
2310
|
},
|
|
2259
2311
|
get fallback() {
|
|
2260
|
-
return ssr(_tmpl$
|
|
2312
|
+
return ssr(_tmpl$82, ssrAttribute("class", escape(styles().pluginMarketplaceCardVersionUnsatisfied, true), false), escape(card.versionInfo?.current), escape(card.versionInfo?.required));
|
|
2261
2313
|
},
|
|
2262
2314
|
get children() {
|
|
2263
2315
|
return ssr(_tmpl$33, ssrAttribute("class", escape(styles().pluginMarketplaceCardVersionSatisfied, true), false), escape(card.versionInfo?.current), escape(card.versionInfo?.required));
|
|
@@ -2269,7 +2321,7 @@ var PluginCardComponent = (props) => {
|
|
|
2269
2321
|
return card.metadata?.docsUrl;
|
|
2270
2322
|
},
|
|
2271
2323
|
get children() {
|
|
2272
|
-
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, {})));
|
|
2273
2325
|
}
|
|
2274
2326
|
})), escape(createComponent(Show, {
|
|
2275
2327
|
get when() {
|
|
@@ -2336,12 +2388,12 @@ var _tmpl$12 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill
|
|
|
2336
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>';
|
|
2337
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>"];
|
|
2338
2390
|
var _tmpl$44 = ["<div", ">", "</div>"];
|
|
2339
|
-
var _tmpl$
|
|
2391
|
+
var _tmpl$53 = ["<div", "><div", "><div", '><div class="', '">', "</div><h3", ">", "</h3></div></div>", "</div>"];
|
|
2340
2392
|
var StarIcon = () => ssr(_tmpl$12);
|
|
2341
2393
|
var MailIcon = () => ssr(_tmpl$25);
|
|
2342
2394
|
var PluginSectionComponent = (props) => {
|
|
2343
2395
|
const styles = useStyles();
|
|
2344
|
-
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, {
|
|
2345
2397
|
get when() {
|
|
2346
2398
|
return !props.isCollapsed();
|
|
2347
2399
|
},
|
|
@@ -3181,7 +3233,7 @@ var _tmpl$18 = ["<div", ' style="', '"><div', ' style="', '">', " Preview</div>"
|
|
|
3181
3233
|
var _tmpl$29 = ["<img", ' alt="Preview"', ">"];
|
|
3182
3234
|
var _tmpl$36 = ["<div", ' style="', '">No Image</div>'];
|
|
3183
3235
|
var _tmpl$45 = ["<div", ">", "</div>"];
|
|
3184
|
-
var _tmpl$
|
|
3236
|
+
var _tmpl$54 = ["<div>", "", "</div>"];
|
|
3185
3237
|
var _tmpl$63 = ["<div", "><strong>Missing tags for ", ":</strong><ul", ">", "</ul></div>"];
|
|
3186
3238
|
var _tmpl$73 = ["<li", ">", "</li>"];
|
|
3187
3239
|
var SOCIALS = [
|
|
@@ -3359,7 +3411,7 @@ var SeoTab = () => {
|
|
|
3359
3411
|
},
|
|
3360
3412
|
children: (report, i) => {
|
|
3361
3413
|
const social = SOCIALS[i()];
|
|
3362
|
-
return ssr(_tmpl$
|
|
3414
|
+
return ssr(_tmpl$54, escape(createComponent(SocialPreview, {
|
|
3363
3415
|
get meta() {
|
|
3364
3416
|
return report.found;
|
|
3365
3417
|
},
|
|
@@ -3434,6 +3486,9 @@ var TabContent = () => {
|
|
|
3434
3486
|
var _tmpl$21 = ['<div style="', '">', "</div>"];
|
|
3435
3487
|
var _tmpl$211 = ['<div style="', '"></div>'];
|
|
3436
3488
|
var SourceInspector = () => {
|
|
3489
|
+
const {
|
|
3490
|
+
settings
|
|
3491
|
+
} = useDevtoolsSettings();
|
|
3437
3492
|
const highlightStateInit = () => ({
|
|
3438
3493
|
element: null,
|
|
3439
3494
|
bounding: {
|
|
@@ -3462,11 +3517,7 @@ var SourceInspector = () => {
|
|
|
3462
3517
|
});
|
|
3463
3518
|
const downList = useKeyDownList();
|
|
3464
3519
|
const isHighlightingKeysHeld = createMemo(() => {
|
|
3465
|
-
|
|
3466
|
-
const isShiftHeld = keys.includes("SHIFT");
|
|
3467
|
-
const isCtrlHeld = keys.includes("CONTROL");
|
|
3468
|
-
const isMetaHeld = keys.includes("META");
|
|
3469
|
-
return isShiftHeld && (isCtrlHeld || isMetaHeld);
|
|
3520
|
+
return isHotkeyCombinationPressed(downList(), settings().inspectHotkey);
|
|
3470
3521
|
});
|
|
3471
3522
|
createEffect(() => {
|
|
3472
3523
|
if (!isHighlightingKeysHeld()) {
|
|
@@ -3663,11 +3714,8 @@ function DevTools() {
|
|
|
3663
3714
|
}
|
|
3664
3715
|
});
|
|
3665
3716
|
createEffect(() => {
|
|
3666
|
-
const
|
|
3667
|
-
const
|
|
3668
|
-
const allModifierCombinations = getAllPermutations(modifiers);
|
|
3669
|
-
for (const combination of allModifierCombinations) {
|
|
3670
|
-
const permutation = [...combination, ...nonModifiers];
|
|
3717
|
+
const permutations = getHotkeyPermutations(settings().openHotkey);
|
|
3718
|
+
for (const permutation of permutations) {
|
|
3671
3719
|
createShortcut(permutation, () => {
|
|
3672
3720
|
toggleOpen();
|
|
3673
3721
|
});
|