@tanstack/react-query-devtools 4.24.13 → 5.0.0-alpha.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/build/lib/Explorer.d.ts +4 -4
- package/build/lib/Explorer.esm.js +5 -15
- package/build/lib/Explorer.esm.js.map +1 -1
- package/build/lib/Explorer.js +11 -25
- package/build/lib/Explorer.js.map +1 -1
- package/build/lib/Explorer.mjs +5 -15
- package/build/lib/Explorer.mjs.map +1 -1
- package/build/lib/Logo.d.ts +0 -1
- package/build/lib/Logo.esm.js.map +1 -1
- package/build/lib/Logo.js +5 -6
- package/build/lib/Logo.js.map +1 -1
- package/build/lib/Logo.mjs.map +1 -1
- package/build/lib/__tests__/devtools.test.d.ts +0 -5
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +0 -2
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +1 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js +1 -5
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +0 -2
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -1
- package/build/lib/devtools.d.ts +12 -4
- package/build/lib/devtools.esm.js +72 -107
- package/build/lib/devtools.esm.js.map +1 -1
- package/build/lib/devtools.js +94 -132
- package/build/lib/devtools.js.map +1 -1
- package/build/lib/devtools.mjs +72 -107
- package/build/lib/devtools.mjs.map +1 -1
- package/build/lib/index.d.ts +2 -2
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +0 -2
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/index.prod.d.ts +2 -2
- package/build/lib/index.prod.esm.js +120 -175
- package/build/lib/index.prod.esm.js.map +1 -1
- package/build/lib/index.prod.js +125 -186
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +120 -175
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/lib/screenreader.d.ts +0 -1
- package/build/lib/screenreader.esm.js.map +1 -1
- package/build/lib/screenreader.js +4 -5
- package/build/lib/screenreader.js.map +1 -1
- package/build/lib/screenreader.mjs.map +1 -1
- package/build/lib/styledComponents.esm.js +17 -16
- package/build/lib/styledComponents.esm.js.map +1 -1
- package/build/lib/styledComponents.js +17 -18
- package/build/lib/styledComponents.js.map +1 -1
- package/build/lib/styledComponents.mjs +17 -16
- package/build/lib/styledComponents.mjs.map +1 -1
- package/build/lib/theme.esm.js.map +1 -1
- package/build/lib/theme.js +4 -7
- package/build/lib/theme.js.map +1 -1
- package/build/lib/theme.mjs.map +1 -1
- package/build/lib/useLocalStorage.esm.js +0 -7
- package/build/lib/useLocalStorage.esm.js.map +1 -1
- package/build/lib/useLocalStorage.js +4 -12
- package/build/lib/useLocalStorage.js.map +1 -1
- package/build/lib/useLocalStorage.mjs +0 -7
- package/build/lib/useLocalStorage.mjs.map +1 -1
- package/build/lib/useMediaQuery.esm.js +6 -6
- package/build/lib/useMediaQuery.esm.js.map +1 -1
- package/build/lib/useMediaQuery.js +10 -11
- package/build/lib/useMediaQuery.js.map +1 -1
- package/build/lib/useMediaQuery.mjs +6 -6
- package/build/lib/useMediaQuery.mjs.map +1 -1
- package/build/lib/utils.esm.js +20 -22
- package/build/lib/utils.esm.js.map +1 -1
- package/build/lib/utils.js +24 -32
- package/build/lib/utils.js.map +1 -1
- package/build/lib/utils.mjs +20 -22
- package/build/lib/utils.mjs.map +1 -1
- package/build/umd/index.development.js +123 -438
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +6 -10
- package/src/Explorer.tsx +4 -4
- package/src/__tests__/Explorer.test.tsx +5 -0
- package/src/__tests__/devtools.test.tsx +127 -181
- package/src/__tests__/utils.tsx +2 -2
- package/src/devtools.tsx +23 -17
- package/src/index.ts +2 -2
- package/build/lib/useSyncExternalStore.d.ts +0 -1
- package/build/lib/useSyncExternalStore.native.d.ts +0 -1
- package/src/useSyncExternalStore.native.ts +0 -3
- package/src/useSyncExternalStore.ts +0 -2
|
@@ -4,10 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactQueryDevtools = {}, global.React, global.ReactQuery));
|
|
5
5
|
})(this, (function (exports, React, reactQuery) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
11
8
|
var n = Object.create(null);
|
|
12
9
|
if (e) {
|
|
13
10
|
Object.keys(e).forEach(function (k) {
|
|
@@ -20,285 +17,27 @@
|
|
|
20
17
|
}
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
|
-
n
|
|
20
|
+
n.default = e;
|
|
24
21
|
return Object.freeze(n);
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
var
|
|
28
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
24
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
29
25
|
|
|
30
26
|
function _extends() {
|
|
31
27
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
32
28
|
for (var i = 1; i < arguments.length; i++) {
|
|
33
29
|
var source = arguments[i];
|
|
34
|
-
|
|
35
30
|
for (var key in source) {
|
|
36
31
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
37
32
|
target[key] = source[key];
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
return target;
|
|
43
37
|
};
|
|
44
38
|
return _extends.apply(this, arguments);
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
var shim = {exports: {}};
|
|
48
|
-
|
|
49
|
-
var useSyncExternalStoreShim_development = {};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @license React
|
|
53
|
-
* use-sync-external-store-shim.development.js
|
|
54
|
-
*
|
|
55
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
56
|
-
*
|
|
57
|
-
* This source code is licensed under the MIT license found in the
|
|
58
|
-
* LICENSE file in the root directory of this source tree.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
var hasRequiredUseSyncExternalStoreShim_development;
|
|
62
|
-
|
|
63
|
-
function requireUseSyncExternalStoreShim_development () {
|
|
64
|
-
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
65
|
-
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
(function() {
|
|
69
|
-
|
|
70
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
71
|
-
if (
|
|
72
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
73
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
74
|
-
'function'
|
|
75
|
-
) {
|
|
76
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
77
|
-
}
|
|
78
|
-
var React = React__default["default"];
|
|
79
|
-
|
|
80
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
81
|
-
|
|
82
|
-
function error(format) {
|
|
83
|
-
{
|
|
84
|
-
{
|
|
85
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
86
|
-
args[_key2 - 1] = arguments[_key2];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
printWarning('error', format, args);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function printWarning(level, format, args) {
|
|
95
|
-
// When changing this logic, you might want to also
|
|
96
|
-
// update consoleWithStackDev.www.js as well.
|
|
97
|
-
{
|
|
98
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
99
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
100
|
-
|
|
101
|
-
if (stack !== '') {
|
|
102
|
-
format += '%s';
|
|
103
|
-
args = args.concat([stack]);
|
|
104
|
-
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var argsWithFormat = args.map(function (item) {
|
|
108
|
-
return String(item);
|
|
109
|
-
}); // Careful: RN currently depends on this prefix
|
|
110
|
-
|
|
111
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
112
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
113
|
-
// eslint-disable-next-line react-internal/no-production-logging
|
|
114
|
-
|
|
115
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
121
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
122
|
-
*/
|
|
123
|
-
function is(x, y) {
|
|
124
|
-
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
125
|
-
;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
129
|
-
|
|
130
|
-
// dispatch for CommonJS interop named imports.
|
|
131
|
-
|
|
132
|
-
var useState = React.useState,
|
|
133
|
-
useEffect = React.useEffect,
|
|
134
|
-
useLayoutEffect = React.useLayoutEffect,
|
|
135
|
-
useDebugValue = React.useDebugValue;
|
|
136
|
-
var didWarnOld18Alpha = false;
|
|
137
|
-
var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
|
|
138
|
-
// because of a very particular set of implementation details and assumptions
|
|
139
|
-
// -- change any one of them and it will break. The most important assumption
|
|
140
|
-
// is that updates are always synchronous, because concurrent rendering is
|
|
141
|
-
// only available in versions of React that also have a built-in
|
|
142
|
-
// useSyncExternalStore API. And we only use this shim when the built-in API
|
|
143
|
-
// does not exist.
|
|
144
|
-
//
|
|
145
|
-
// Do not assume that the clever hacks used by this hook also work in general.
|
|
146
|
-
// The point of this shim is to replace the need for hacks by other libraries.
|
|
147
|
-
|
|
148
|
-
function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
149
|
-
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
150
|
-
// will need to track that themselves and return the correct value
|
|
151
|
-
// from `getSnapshot`.
|
|
152
|
-
getServerSnapshot) {
|
|
153
|
-
{
|
|
154
|
-
if (!didWarnOld18Alpha) {
|
|
155
|
-
if (React.startTransition !== undefined) {
|
|
156
|
-
didWarnOld18Alpha = true;
|
|
157
|
-
|
|
158
|
-
error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
} // Read the current snapshot from the store on every render. Again, this
|
|
162
|
-
// breaks the rules of React, and only works here because of specific
|
|
163
|
-
// implementation details, most importantly that updates are
|
|
164
|
-
// always synchronous.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var value = getSnapshot();
|
|
168
|
-
|
|
169
|
-
{
|
|
170
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
171
|
-
var cachedValue = getSnapshot();
|
|
172
|
-
|
|
173
|
-
if (!objectIs(value, cachedValue)) {
|
|
174
|
-
error('The result of getSnapshot should be cached to avoid an infinite loop');
|
|
175
|
-
|
|
176
|
-
didWarnUncachedGetSnapshot = true;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
} // Because updates are synchronous, we don't queue them. Instead we force a
|
|
180
|
-
// re-render whenever the subscribed state changes by updating an some
|
|
181
|
-
// arbitrary useState hook. Then, during render, we call getSnapshot to read
|
|
182
|
-
// the current value.
|
|
183
|
-
//
|
|
184
|
-
// Because we don't actually use the state returned by the useState hook, we
|
|
185
|
-
// can save a bit of memory by storing other stuff in that slot.
|
|
186
|
-
//
|
|
187
|
-
// To implement the early bailout, we need to track some things on a mutable
|
|
188
|
-
// object. Usually, we would put that in a useRef hook, but we can stash it in
|
|
189
|
-
// our useState hook instead.
|
|
190
|
-
//
|
|
191
|
-
// To force a re-render, we call forceUpdate({inst}). That works because the
|
|
192
|
-
// new object always fails an equality check.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var _useState = useState({
|
|
196
|
-
inst: {
|
|
197
|
-
value: value,
|
|
198
|
-
getSnapshot: getSnapshot
|
|
199
|
-
}
|
|
200
|
-
}),
|
|
201
|
-
inst = _useState[0].inst,
|
|
202
|
-
forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
|
|
203
|
-
// in the layout phase so we can access it during the tearing check that
|
|
204
|
-
// happens on subscribe.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
useLayoutEffect(function () {
|
|
208
|
-
inst.value = value;
|
|
209
|
-
inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
|
|
210
|
-
// commit phase if there was an interleaved mutation. In concurrent mode
|
|
211
|
-
// this can happen all the time, but even in synchronous mode, an earlier
|
|
212
|
-
// effect may have mutated the store.
|
|
213
|
-
|
|
214
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
215
|
-
// Force a re-render.
|
|
216
|
-
forceUpdate({
|
|
217
|
-
inst: inst
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
}, [subscribe, value, getSnapshot]);
|
|
221
|
-
useEffect(function () {
|
|
222
|
-
// Check for changes right before subscribing. Subsequent changes will be
|
|
223
|
-
// detected in the subscription handler.
|
|
224
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
225
|
-
// Force a re-render.
|
|
226
|
-
forceUpdate({
|
|
227
|
-
inst: inst
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
var handleStoreChange = function () {
|
|
232
|
-
// TODO: Because there is no cross-renderer API for batching updates, it's
|
|
233
|
-
// up to the consumer of this library to wrap their subscription event
|
|
234
|
-
// with unstable_batchedUpdates. Should we try to detect when this isn't
|
|
235
|
-
// the case and print a warning in development?
|
|
236
|
-
// The store changed. Check if the snapshot changed since the last time we
|
|
237
|
-
// read from the store.
|
|
238
|
-
if (checkIfSnapshotChanged(inst)) {
|
|
239
|
-
// Force a re-render.
|
|
240
|
-
forceUpdate({
|
|
241
|
-
inst: inst
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
}; // Subscribe to the store and return a clean-up function.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
return subscribe(handleStoreChange);
|
|
248
|
-
}, [subscribe]);
|
|
249
|
-
useDebugValue(value);
|
|
250
|
-
return value;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function checkIfSnapshotChanged(inst) {
|
|
254
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
255
|
-
var prevValue = inst.value;
|
|
256
|
-
|
|
257
|
-
try {
|
|
258
|
-
var nextValue = latestGetSnapshot();
|
|
259
|
-
return !objectIs(prevValue, nextValue);
|
|
260
|
-
} catch (error) {
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
266
|
-
// Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
267
|
-
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
268
|
-
// will need to track that themselves and return the correct value
|
|
269
|
-
// from `getSnapshot`.
|
|
270
|
-
return getSnapshot();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
274
|
-
|
|
275
|
-
var isServerEnvironment = !canUseDOM;
|
|
276
|
-
|
|
277
|
-
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
278
|
-
var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
|
|
279
|
-
|
|
280
|
-
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
281
|
-
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
282
|
-
if (
|
|
283
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
284
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
285
|
-
'function'
|
|
286
|
-
) {
|
|
287
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
})();
|
|
291
|
-
}
|
|
292
|
-
return useSyncExternalStoreShim_development;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
(function (module) {
|
|
296
|
-
|
|
297
|
-
{
|
|
298
|
-
module.exports = requireUseSyncExternalStoreShim_development();
|
|
299
|
-
}
|
|
300
|
-
} (shim));
|
|
301
|
-
|
|
302
41
|
/**
|
|
303
42
|
* match-sorter-utils
|
|
304
43
|
*
|
|
@@ -1000,22 +739,18 @@
|
|
|
1000
739
|
const getItem = key => {
|
|
1001
740
|
try {
|
|
1002
741
|
const itemValue = localStorage.getItem(key);
|
|
1003
|
-
|
|
1004
742
|
if (typeof itemValue === 'string') {
|
|
1005
743
|
return JSON.parse(itemValue);
|
|
1006
744
|
}
|
|
1007
|
-
|
|
1008
745
|
return undefined;
|
|
1009
746
|
} catch {
|
|
1010
747
|
return undefined;
|
|
1011
748
|
}
|
|
1012
749
|
};
|
|
1013
|
-
|
|
1014
750
|
function useLocalStorage(key, defaultValue) {
|
|
1015
751
|
const [value, setValue] = React__namespace.useState();
|
|
1016
752
|
React__namespace.useEffect(() => {
|
|
1017
753
|
const initialValue = getItem(key);
|
|
1018
|
-
|
|
1019
754
|
if (typeof initialValue === 'undefined' || initialValue === null) {
|
|
1020
755
|
setValue(typeof defaultValue === 'function' ? defaultValue() : defaultValue);
|
|
1021
756
|
} else {
|
|
@@ -1025,15 +760,12 @@
|
|
|
1025
760
|
const setter = React__namespace.useCallback(updater => {
|
|
1026
761
|
setValue(old => {
|
|
1027
762
|
let newVal = updater;
|
|
1028
|
-
|
|
1029
763
|
if (typeof updater == 'function') {
|
|
1030
764
|
newVal = updater(old);
|
|
1031
765
|
}
|
|
1032
|
-
|
|
1033
766
|
try {
|
|
1034
767
|
localStorage.setItem(key, JSON.stringify(newVal));
|
|
1035
768
|
} catch {}
|
|
1036
|
-
|
|
1037
769
|
return newVal;
|
|
1038
770
|
});
|
|
1039
771
|
}, [key]);
|
|
@@ -2020,27 +1752,27 @@
|
|
|
2020
1752
|
if (typeof window !== 'undefined') {
|
|
2021
1753
|
return window.matchMedia(query).matches;
|
|
2022
1754
|
}
|
|
2023
|
-
|
|
2024
1755
|
return;
|
|
2025
|
-
});
|
|
1756
|
+
});
|
|
2026
1757
|
|
|
1758
|
+
// Watch for changes
|
|
2027
1759
|
React__namespace.useEffect(() => {
|
|
2028
1760
|
if (typeof window !== 'undefined') {
|
|
2029
1761
|
// Create a matcher
|
|
2030
|
-
const matcher = window.matchMedia(query);
|
|
1762
|
+
const matcher = window.matchMedia(query);
|
|
2031
1763
|
|
|
1764
|
+
// Create our handler
|
|
2032
1765
|
const onChange = ({
|
|
2033
1766
|
matches
|
|
2034
|
-
}) => setIsMatch(matches);
|
|
2035
|
-
|
|
1767
|
+
}) => setIsMatch(matches);
|
|
2036
1768
|
|
|
1769
|
+
// Listen for changes
|
|
2037
1770
|
matcher.addListener(onChange);
|
|
2038
1771
|
return () => {
|
|
2039
1772
|
// Stop listening for changes
|
|
2040
1773
|
matcher.removeListener(onChange);
|
|
2041
1774
|
};
|
|
2042
1775
|
}
|
|
2043
|
-
|
|
2044
1776
|
return;
|
|
2045
1777
|
}, [isMatch, query, setIsMatch]);
|
|
2046
1778
|
return isMatch;
|
|
@@ -2065,12 +1797,15 @@
|
|
|
2065
1797
|
const theme = useTheme();
|
|
2066
1798
|
const mediaStyles = Object.entries(queries).reduce((current, [key, value]) => {
|
|
2067
1799
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
2068
|
-
return useMediaQuery(key) ? {
|
|
1800
|
+
return useMediaQuery(key) ? {
|
|
1801
|
+
...current,
|
|
2069
1802
|
...(typeof value === 'function' ? value(rest, theme) : value)
|
|
2070
1803
|
} : current;
|
|
2071
1804
|
}, {});
|
|
2072
|
-
return /*#__PURE__*/React__namespace.createElement(type, {
|
|
2073
|
-
|
|
1805
|
+
return /*#__PURE__*/React__namespace.createElement(type, {
|
|
1806
|
+
...rest,
|
|
1807
|
+
style: {
|
|
1808
|
+
...(typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles),
|
|
2074
1809
|
...style,
|
|
2075
1810
|
...mediaStyles
|
|
2076
1811
|
},
|
|
@@ -2089,33 +1824,30 @@
|
|
|
2089
1824
|
}, []);
|
|
2090
1825
|
return isMounted;
|
|
2091
1826
|
}
|
|
1827
|
+
|
|
2092
1828
|
/**
|
|
2093
1829
|
* Displays a string regardless the type of the data
|
|
2094
1830
|
* @param {unknown} value Value to be stringified
|
|
2095
1831
|
* @param {boolean} beautify Formats json to multiline
|
|
2096
1832
|
*/
|
|
2097
|
-
|
|
2098
1833
|
const displayValue = (value, beautify = false) => {
|
|
2099
1834
|
const {
|
|
2100
1835
|
json
|
|
2101
1836
|
} = superjson.serialize(value);
|
|
2102
1837
|
return JSON.stringify(json, null, beautify ? 2 : undefined);
|
|
2103
|
-
};
|
|
1838
|
+
};
|
|
2104
1839
|
|
|
2105
|
-
|
|
1840
|
+
// Sorting functions
|
|
2106
1841
|
|
|
1842
|
+
const getStatusRank = q => q.state.fetchStatus !== 'idle' ? 0 : !q.getObserversCount() ? 3 : q.isStale() ? 2 : 1;
|
|
2107
1843
|
const queryHashSort = (a, b) => a.queryHash.localeCompare(b.queryHash);
|
|
2108
|
-
|
|
2109
1844
|
const dateSort = (a, b) => a.state.dataUpdatedAt < b.state.dataUpdatedAt ? 1 : -1;
|
|
2110
|
-
|
|
2111
1845
|
const statusAndDateSort = (a, b) => {
|
|
2112
1846
|
if (getStatusRank(a) === getStatusRank(b)) {
|
|
2113
1847
|
return dateSort(a, b);
|
|
2114
1848
|
}
|
|
2115
|
-
|
|
2116
1849
|
return getStatusRank(a) > getStatusRank(b) ? 1 : -1;
|
|
2117
1850
|
};
|
|
2118
|
-
|
|
2119
1851
|
const sortFns = {
|
|
2120
1852
|
'Status > Last Updated': statusAndDateSort,
|
|
2121
1853
|
'Query Hash': queryHashSort,
|
|
@@ -2129,7 +1861,6 @@
|
|
|
2129
1861
|
left: 'right',
|
|
2130
1862
|
right: 'left'
|
|
2131
1863
|
};
|
|
2132
|
-
|
|
2133
1864
|
/**
|
|
2134
1865
|
* Check if the given side is vertical (left/right)
|
|
2135
1866
|
*/
|
|
@@ -2139,7 +1870,6 @@
|
|
|
2139
1870
|
/**
|
|
2140
1871
|
* Get the opposite side, eg 'left' => 'right'. 'top' => 'bottom', etc
|
|
2141
1872
|
*/
|
|
2142
|
-
|
|
2143
1873
|
function getOppositeSide(side) {
|
|
2144
1874
|
return sides[side];
|
|
2145
1875
|
}
|
|
@@ -2147,9 +1877,8 @@
|
|
|
2147
1877
|
* Given as css prop it will return a sided css prop based on a given side
|
|
2148
1878
|
* Example given `border` and `right` it return `borderRight`
|
|
2149
1879
|
*/
|
|
2150
|
-
|
|
2151
1880
|
function getSidedProp(prop, side) {
|
|
2152
|
-
return
|
|
1881
|
+
return `${prop}${side.charAt(0).toUpperCase() + side.slice(1)}`;
|
|
2153
1882
|
}
|
|
2154
1883
|
function getSidePanelStyle({
|
|
2155
1884
|
position = 'bottom',
|
|
@@ -2163,29 +1892,30 @@
|
|
|
2163
1892
|
const oppositeSide = getOppositeSide(position);
|
|
2164
1893
|
const borderSide = getSidedProp('border', oppositeSide);
|
|
2165
1894
|
const isVertical = isVerticalSide(position);
|
|
2166
|
-
return {
|
|
1895
|
+
return {
|
|
1896
|
+
...panelStyle,
|
|
2167
1897
|
direction: 'ltr',
|
|
2168
1898
|
position: 'fixed',
|
|
2169
1899
|
[position]: 0,
|
|
2170
|
-
[borderSide]:
|
|
1900
|
+
[borderSide]: `1px solid ${devtoolsTheme.gray}`,
|
|
2171
1901
|
transformOrigin: oppositeSide,
|
|
2172
1902
|
boxShadow: '0 0 20px rgba(0,0,0,.3)',
|
|
2173
1903
|
zIndex: 99999,
|
|
2174
1904
|
// visibility will be toggled after transitions, but set initial state here
|
|
2175
1905
|
visibility: isOpen ? 'visible' : 'hidden',
|
|
2176
1906
|
...(isResizing ? {
|
|
2177
|
-
transition:
|
|
1907
|
+
transition: `none`
|
|
2178
1908
|
} : {
|
|
2179
|
-
transition:
|
|
1909
|
+
transition: `all .2s ease`
|
|
2180
1910
|
}),
|
|
2181
1911
|
...(isOpen ? {
|
|
2182
1912
|
opacity: 1,
|
|
2183
1913
|
pointerEvents: 'all',
|
|
2184
|
-
transform: isVertical ?
|
|
1914
|
+
transform: isVertical ? `translateX(0) scale(1)` : `translateY(0) scale(1)`
|
|
2185
1915
|
} : {
|
|
2186
1916
|
opacity: 0,
|
|
2187
1917
|
pointerEvents: 'none',
|
|
2188
|
-
transform: isVertical ?
|
|
1918
|
+
transform: isVertical ? `translateX(15px) scale(1.02)` : `translateY(15px) scale(1.02)`
|
|
2189
1919
|
}),
|
|
2190
1920
|
...(isVertical ? {
|
|
2191
1921
|
top: 0,
|
|
@@ -2200,10 +1930,10 @@
|
|
|
2200
1930
|
})
|
|
2201
1931
|
};
|
|
2202
1932
|
}
|
|
1933
|
+
|
|
2203
1934
|
/**
|
|
2204
1935
|
* Get resize handle style based on a given side
|
|
2205
1936
|
*/
|
|
2206
|
-
|
|
2207
1937
|
function getResizeHandleStyle(position = 'bottom') {
|
|
2208
1938
|
const isVertical = isVerticalSide(position);
|
|
2209
1939
|
const oppositeSide = getOppositeSide(position);
|
|
@@ -2213,7 +1943,7 @@
|
|
|
2213
1943
|
cursor: isVertical ? 'col-resize' : 'row-resize',
|
|
2214
1944
|
zIndex: 100000,
|
|
2215
1945
|
[oppositeSide]: 0,
|
|
2216
|
-
[marginSide]:
|
|
1946
|
+
[marginSide]: `-4px`,
|
|
2217
1947
|
...(isVertical ? {
|
|
2218
1948
|
top: 0,
|
|
2219
1949
|
height: '100%',
|
|
@@ -2227,7 +1957,7 @@
|
|
|
2227
1957
|
|
|
2228
1958
|
const Panel = styled('div', (_props, theme) => ({
|
|
2229
1959
|
fontSize: 'clamp(12px, 1.5vw, 14px)',
|
|
2230
|
-
fontFamily:
|
|
1960
|
+
fontFamily: `sans-serif`,
|
|
2231
1961
|
display: 'flex',
|
|
2232
1962
|
backgroundColor: theme.background,
|
|
2233
1963
|
color: theme.foreground
|
|
@@ -2236,10 +1966,11 @@
|
|
|
2236
1966
|
flexDirection: 'column'
|
|
2237
1967
|
},
|
|
2238
1968
|
'(max-width: 600px)': {
|
|
2239
|
-
fontSize: '.9em'
|
|
2240
|
-
|
|
1969
|
+
fontSize: '.9em'
|
|
1970
|
+
// flexDirection: 'column',
|
|
2241
1971
|
}
|
|
2242
1972
|
});
|
|
1973
|
+
|
|
2243
1974
|
const ActiveQueryPanel = styled('div', () => ({
|
|
2244
1975
|
flex: '1 1 500px',
|
|
2245
1976
|
display: 'flex',
|
|
@@ -2248,7 +1979,7 @@
|
|
|
2248
1979
|
height: '100%'
|
|
2249
1980
|
}), {
|
|
2250
1981
|
'(max-width: 700px)': (_props, theme) => ({
|
|
2251
|
-
borderTop:
|
|
1982
|
+
borderTop: `2px solid ${theme.gray}`
|
|
2252
1983
|
})
|
|
2253
1984
|
});
|
|
2254
1985
|
const Button = styled('button', (props, theme) => ({
|
|
@@ -2286,26 +2017,26 @@
|
|
|
2286
2017
|
borderRadius: '.2em',
|
|
2287
2018
|
color: theme.inputTextColor,
|
|
2288
2019
|
fontSize: '.9em',
|
|
2289
|
-
lineHeight:
|
|
2020
|
+
lineHeight: `1.3`,
|
|
2290
2021
|
padding: '.3em .4em'
|
|
2291
2022
|
}));
|
|
2292
2023
|
const Select = styled('select', (_props, theme) => ({
|
|
2293
|
-
display:
|
|
2294
|
-
fontSize:
|
|
2295
|
-
fontFamily:
|
|
2024
|
+
display: `inline-block`,
|
|
2025
|
+
fontSize: `.9em`,
|
|
2026
|
+
fontFamily: `sans-serif`,
|
|
2296
2027
|
fontWeight: 'normal',
|
|
2297
|
-
lineHeight:
|
|
2298
|
-
padding:
|
|
2028
|
+
lineHeight: `1.3`,
|
|
2029
|
+
padding: `.3em 1.5em .3em .5em`,
|
|
2299
2030
|
height: 'auto',
|
|
2300
2031
|
border: 0,
|
|
2301
|
-
borderRadius:
|
|
2302
|
-
appearance:
|
|
2032
|
+
borderRadius: `.2em`,
|
|
2033
|
+
appearance: `none`,
|
|
2303
2034
|
WebkitAppearance: 'none',
|
|
2304
2035
|
backgroundColor: theme.inputBackgroundColor,
|
|
2305
|
-
backgroundImage:
|
|
2306
|
-
backgroundRepeat:
|
|
2307
|
-
backgroundPosition:
|
|
2308
|
-
backgroundSize:
|
|
2036
|
+
backgroundImage: `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23444444'><polygon points='0,25 100,25 50,75'/></svg>")`,
|
|
2037
|
+
backgroundRepeat: `no-repeat`,
|
|
2038
|
+
backgroundPosition: `right .55em center`,
|
|
2039
|
+
backgroundSize: `.65em auto, 100%`,
|
|
2309
2040
|
color: theme.inputTextColor
|
|
2310
2041
|
}), {
|
|
2311
2042
|
'(max-width: 500px)': {
|
|
@@ -2398,11 +2129,10 @@
|
|
|
2398
2129
|
style: {
|
|
2399
2130
|
display: 'inline-block',
|
|
2400
2131
|
transition: 'all .1s ease',
|
|
2401
|
-
transform:
|
|
2132
|
+
transform: `rotate(${expanded ? 90 : 0}deg) ${style.transform || ''}`,
|
|
2402
2133
|
...style
|
|
2403
2134
|
}
|
|
2404
2135
|
}, "\u25B6");
|
|
2405
|
-
|
|
2406
2136
|
const Copier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
2407
2137
|
"aria-label": "Copy object to clipboard",
|
|
2408
2138
|
title: "Copy object to clipboard",
|
|
@@ -2420,7 +2150,6 @@
|
|
|
2420
2150
|
fill: "currentColor",
|
|
2421
2151
|
d: "M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"
|
|
2422
2152
|
})));
|
|
2423
|
-
|
|
2424
2153
|
const ErrorCopier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
2425
2154
|
"aria-label": "Failed copying to clipboard",
|
|
2426
2155
|
title: "Failed copying to clipboard",
|
|
@@ -2446,7 +2175,6 @@
|
|
|
2446
2175
|
top: '2px'
|
|
2447
2176
|
}
|
|
2448
2177
|
}, "See console"));
|
|
2449
|
-
|
|
2450
2178
|
const CopiedCopier = () => /*#__PURE__*/React__namespace.createElement("span", {
|
|
2451
2179
|
"aria-label": "Object copied to clipboard",
|
|
2452
2180
|
title: "Object copied to clipboard",
|
|
@@ -2464,7 +2192,6 @@
|
|
|
2464
2192
|
fill: "green",
|
|
2465
2193
|
d: "M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"
|
|
2466
2194
|
})));
|
|
2467
|
-
|
|
2468
2195
|
/**
|
|
2469
2196
|
* Chunk elements in the array by size
|
|
2470
2197
|
*
|
|
@@ -2478,12 +2205,10 @@
|
|
|
2478
2205
|
if (size < 1) return [];
|
|
2479
2206
|
let i = 0;
|
|
2480
2207
|
const result = [];
|
|
2481
|
-
|
|
2482
2208
|
while (i < array.length) {
|
|
2483
2209
|
result.push(array.slice(i, i + size));
|
|
2484
2210
|
i = i + size;
|
|
2485
2211
|
}
|
|
2486
|
-
|
|
2487
2212
|
return result;
|
|
2488
2213
|
}
|
|
2489
2214
|
const DefaultRenderer = ({
|
|
@@ -2505,7 +2230,7 @@
|
|
|
2505
2230
|
onClick: () => toggleExpanded()
|
|
2506
2231
|
}, /*#__PURE__*/React__namespace.createElement(Expander, {
|
|
2507
2232
|
expanded: expanded
|
|
2508
|
-
}), " ", label, ' ', /*#__PURE__*/React__namespace.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ?
|
|
2233
|
+
}), " ", label, ' ', /*#__PURE__*/React__namespace.createElement(Info, null, String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : '', subEntries.length, " ", subEntries.length > 1 ? `items` : `item`)), copyable ? /*#__PURE__*/React__namespace.createElement(CopyButton, {
|
|
2509
2234
|
value: value
|
|
2510
2235
|
}) : null, expanded ? subEntryPages.length === 1 ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntries.map(handleEntry)) : /*#__PURE__*/React__namespace.createElement(SubEntries, null, subEntryPages.map((entries, index) => /*#__PURE__*/React__namespace.createElement("div", {
|
|
2511
2236
|
key: index
|
|
@@ -2515,11 +2240,9 @@
|
|
|
2515
2240
|
expanded: expanded
|
|
2516
2241
|
}), " [", index * pageSize, " ...", ' ', index * pageSize + pageSize - 1, "]"), expandedPages.includes(index) ? /*#__PURE__*/React__namespace.createElement(SubEntries, null, entries.map(handleEntry)) : null)))) : null) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Label, null, label, ":"), " ", /*#__PURE__*/React__namespace.createElement(Value, null, displayValue(value))));
|
|
2517
2242
|
};
|
|
2518
|
-
|
|
2519
2243
|
function isIterable(x) {
|
|
2520
2244
|
return Symbol.iterator in x;
|
|
2521
2245
|
}
|
|
2522
|
-
|
|
2523
2246
|
function Explorer({
|
|
2524
2247
|
value,
|
|
2525
2248
|
defaultExpanded,
|
|
@@ -2532,16 +2255,15 @@
|
|
|
2532
2255
|
const toggleExpanded = React__namespace.useCallback(() => setExpanded(old => !old), []);
|
|
2533
2256
|
let type = typeof value;
|
|
2534
2257
|
let subEntries = [];
|
|
2535
|
-
|
|
2536
2258
|
const makeProperty = sub => {
|
|
2537
2259
|
const subDefaultExpanded = defaultExpanded === true ? {
|
|
2538
2260
|
[sub.label]: true
|
|
2539
|
-
} : defaultExpanded
|
|
2540
|
-
return {
|
|
2261
|
+
} : defaultExpanded?.[sub.label];
|
|
2262
|
+
return {
|
|
2263
|
+
...sub,
|
|
2541
2264
|
defaultExpanded: subDefaultExpanded
|
|
2542
2265
|
};
|
|
2543
2266
|
};
|
|
2544
|
-
|
|
2545
2267
|
if (Array.isArray(value)) {
|
|
2546
2268
|
type = 'array';
|
|
2547
2269
|
subEntries = value.map((d, i) => makeProperty({
|
|
@@ -2561,7 +2283,6 @@
|
|
|
2561
2283
|
value: val
|
|
2562
2284
|
}));
|
|
2563
2285
|
}
|
|
2564
|
-
|
|
2565
2286
|
const subEntryPages = chunkArray(subEntries, pageSize);
|
|
2566
2287
|
return renderer({
|
|
2567
2288
|
handleEntry: entry => /*#__PURE__*/React__namespace.createElement(Explorer, _extends({
|
|
@@ -2616,7 +2337,7 @@
|
|
|
2616
2337
|
toggleButtonProps = {},
|
|
2617
2338
|
position = 'bottom-left',
|
|
2618
2339
|
containerElement: Container = 'aside',
|
|
2619
|
-
|
|
2340
|
+
queryClient,
|
|
2620
2341
|
styleNonce,
|
|
2621
2342
|
panelPosition: initialPanelPosition = 'bottom'
|
|
2622
2343
|
}) {
|
|
@@ -2629,11 +2350,9 @@
|
|
|
2629
2350
|
const [isResolvedOpen, setIsResolvedOpen] = React__namespace.useState(false);
|
|
2630
2351
|
const [isResizing, setIsResizing] = React__namespace.useState(false);
|
|
2631
2352
|
const isMounted = useIsMounted();
|
|
2632
|
-
|
|
2633
2353
|
const handleDragStart = (panelElement, startEvent) => {
|
|
2634
2354
|
if (!panelElement) return;
|
|
2635
2355
|
if (startEvent.button !== 0) return; // Only allow left click for drag
|
|
2636
|
-
|
|
2637
2356
|
const isVertical = isVerticalSide(panelPosition);
|
|
2638
2357
|
setIsResizing(true);
|
|
2639
2358
|
const {
|
|
@@ -2643,12 +2362,12 @@
|
|
|
2643
2362
|
const startX = startEvent.clientX;
|
|
2644
2363
|
const startY = startEvent.clientY;
|
|
2645
2364
|
let newSize = 0;
|
|
2646
|
-
|
|
2647
2365
|
const run = moveEvent => {
|
|
2648
2366
|
// prevent mouse selecting stuff with mouse drag
|
|
2649
|
-
moveEvent.preventDefault();
|
|
2650
|
-
// hint: it is different formula for the opposite sides
|
|
2367
|
+
moveEvent.preventDefault();
|
|
2651
2368
|
|
|
2369
|
+
// calculate the correct size based on mouse position and current panel position
|
|
2370
|
+
// hint: it is different formula for the opposite sides
|
|
2652
2371
|
if (isVertical) {
|
|
2653
2372
|
newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
|
|
2654
2373
|
setDevtoolsWidth(newSize);
|
|
@@ -2656,48 +2375,41 @@
|
|
|
2656
2375
|
newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
|
|
2657
2376
|
setDevtoolsHeight(newSize);
|
|
2658
2377
|
}
|
|
2659
|
-
|
|
2660
2378
|
if (newSize < minPanelSize) {
|
|
2661
2379
|
setIsOpen(false);
|
|
2662
2380
|
} else {
|
|
2663
2381
|
setIsOpen(true);
|
|
2664
2382
|
}
|
|
2665
2383
|
};
|
|
2666
|
-
|
|
2667
2384
|
const unsub = () => {
|
|
2668
2385
|
if (isResizing) {
|
|
2669
2386
|
setIsResizing(false);
|
|
2670
2387
|
}
|
|
2671
|
-
|
|
2672
2388
|
document.removeEventListener('mousemove', run, false);
|
|
2673
2389
|
document.removeEventListener('mouseUp', unsub, false);
|
|
2674
2390
|
};
|
|
2675
|
-
|
|
2676
2391
|
document.addEventListener('mousemove', run, false);
|
|
2677
2392
|
document.addEventListener('mouseup', unsub, false);
|
|
2678
2393
|
};
|
|
2679
|
-
|
|
2680
2394
|
React__namespace.useEffect(() => {
|
|
2681
|
-
setIsResolvedOpen(isOpen
|
|
2682
|
-
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
2683
|
-
// Prevents focusing in a closed panel.
|
|
2395
|
+
setIsResolvedOpen(isOpen ?? false);
|
|
2396
|
+
}, [isOpen, isResolvedOpen, setIsResolvedOpen]);
|
|
2684
2397
|
|
|
2398
|
+
// Toggle panel visibility before/after transition (depending on direction).
|
|
2399
|
+
// Prevents focusing in a closed panel.
|
|
2685
2400
|
React__namespace.useEffect(() => {
|
|
2686
2401
|
const ref = panelRef.current;
|
|
2687
|
-
|
|
2688
2402
|
if (ref) {
|
|
2689
2403
|
const handlePanelTransitionStart = () => {
|
|
2690
2404
|
if (isResolvedOpen) {
|
|
2691
2405
|
ref.style.visibility = 'visible';
|
|
2692
2406
|
}
|
|
2693
2407
|
};
|
|
2694
|
-
|
|
2695
2408
|
const handlePanelTransitionEnd = () => {
|
|
2696
2409
|
if (!isResolvedOpen) {
|
|
2697
2410
|
ref.style.visibility = 'hidden';
|
|
2698
2411
|
}
|
|
2699
2412
|
};
|
|
2700
|
-
|
|
2701
2413
|
ref.addEventListener('transitionstart', handlePanelTransitionStart);
|
|
2702
2414
|
ref.addEventListener('transitionend', handlePanelTransitionEnd);
|
|
2703
2415
|
return () => {
|
|
@@ -2705,19 +2417,15 @@
|
|
|
2705
2417
|
ref.removeEventListener('transitionend', handlePanelTransitionEnd);
|
|
2706
2418
|
};
|
|
2707
2419
|
}
|
|
2708
|
-
|
|
2709
2420
|
return;
|
|
2710
2421
|
}, [isResolvedOpen]);
|
|
2711
2422
|
React__namespace.useEffect(() => {
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
if (isResolvedOpen && (_rootRef$current = rootRef.current) != null && _rootRef$current.parentElement) {
|
|
2423
|
+
if (isResolvedOpen && rootRef.current?.parentElement) {
|
|
2715
2424
|
const {
|
|
2716
2425
|
parentElement
|
|
2717
2426
|
} = rootRef.current;
|
|
2718
2427
|
const styleProp = getSidedProp('padding', panelPosition);
|
|
2719
2428
|
const isVertical = isVerticalSide(panelPosition);
|
|
2720
|
-
|
|
2721
2429
|
const previousPaddings = (({
|
|
2722
2430
|
padding,
|
|
2723
2431
|
paddingTop,
|
|
@@ -2731,20 +2439,18 @@
|
|
|
2731
2439
|
paddingLeft,
|
|
2732
2440
|
paddingRight
|
|
2733
2441
|
}))(parentElement.style);
|
|
2734
|
-
|
|
2735
2442
|
const run = () => {
|
|
2736
2443
|
// reset the padding
|
|
2737
2444
|
parentElement.style.padding = '0px';
|
|
2738
2445
|
parentElement.style.paddingTop = '0px';
|
|
2739
2446
|
parentElement.style.paddingBottom = '0px';
|
|
2740
2447
|
parentElement.style.paddingLeft = '0px';
|
|
2741
|
-
parentElement.style.paddingRight = '0px';
|
|
2448
|
+
parentElement.style.paddingRight = '0px';
|
|
2449
|
+
// set the new padding based on the new panel position
|
|
2742
2450
|
|
|
2743
|
-
parentElement.style[styleProp] =
|
|
2451
|
+
parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
|
|
2744
2452
|
};
|
|
2745
|
-
|
|
2746
2453
|
run();
|
|
2747
|
-
|
|
2748
2454
|
if (typeof window !== 'undefined') {
|
|
2749
2455
|
window.addEventListener('resize', run);
|
|
2750
2456
|
return () => {
|
|
@@ -2755,7 +2461,6 @@
|
|
|
2755
2461
|
};
|
|
2756
2462
|
}
|
|
2757
2463
|
}
|
|
2758
|
-
|
|
2759
2464
|
return;
|
|
2760
2465
|
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
|
|
2761
2466
|
const {
|
|
@@ -2766,8 +2471,9 @@
|
|
|
2766
2471
|
style: toggleButtonStyle = {},
|
|
2767
2472
|
onClick: onToggleClick,
|
|
2768
2473
|
...otherToggleButtonProps
|
|
2769
|
-
} = toggleButtonProps;
|
|
2474
|
+
} = toggleButtonProps;
|
|
2770
2475
|
|
|
2476
|
+
// get computed style based on panel position
|
|
2771
2477
|
const style = getSidePanelStyle({
|
|
2772
2478
|
position: panelPosition,
|
|
2773
2479
|
devtoolsTheme: defaultTheme,
|
|
@@ -2776,8 +2482,9 @@
|
|
|
2776
2482
|
width: devtoolsWidth,
|
|
2777
2483
|
isResizing,
|
|
2778
2484
|
panelStyle
|
|
2779
|
-
});
|
|
2485
|
+
});
|
|
2780
2486
|
|
|
2487
|
+
// Do not render on the server
|
|
2781
2488
|
if (!isMounted()) return null;
|
|
2782
2489
|
return /*#__PURE__*/React__namespace.createElement(Container, {
|
|
2783
2490
|
ref: rootRef,
|
|
@@ -2787,7 +2494,7 @@
|
|
|
2787
2494
|
theme: defaultTheme
|
|
2788
2495
|
}, /*#__PURE__*/React__namespace.createElement(ReactQueryDevtoolsPanel$1, _extends({
|
|
2789
2496
|
ref: panelRef,
|
|
2790
|
-
|
|
2497
|
+
queryClient: queryClient,
|
|
2791
2498
|
styleNonce: styleNonce,
|
|
2792
2499
|
position: panelPosition,
|
|
2793
2500
|
onPositionChange: setPanelPosition,
|
|
@@ -2807,7 +2514,7 @@
|
|
|
2807
2514
|
"aria-expanded": "false",
|
|
2808
2515
|
onClick: e => {
|
|
2809
2516
|
setIsOpen(true);
|
|
2810
|
-
onToggleClick
|
|
2517
|
+
onToggleClick?.(e);
|
|
2811
2518
|
},
|
|
2812
2519
|
style: {
|
|
2813
2520
|
background: 'none',
|
|
@@ -2841,22 +2548,20 @@
|
|
|
2841
2548
|
text: "Open React Query Devtools"
|
|
2842
2549
|
})) : null);
|
|
2843
2550
|
}
|
|
2844
|
-
|
|
2845
2551
|
const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
|
|
2846
|
-
return
|
|
2552
|
+
return React__namespace.useSyncExternalStore(React__namespace.useCallback(onStoreChange => {
|
|
2847
2553
|
if (!skip) return queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange));
|
|
2848
2554
|
return () => {
|
|
2849
2555
|
return;
|
|
2850
2556
|
};
|
|
2851
2557
|
}, [queryCache, skip]), getSnapshot, getSnapshot);
|
|
2852
2558
|
};
|
|
2853
|
-
|
|
2854
2559
|
const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
|
|
2855
2560
|
const {
|
|
2856
2561
|
isOpen = true,
|
|
2857
2562
|
styleNonce,
|
|
2858
2563
|
setIsOpen,
|
|
2859
|
-
|
|
2564
|
+
queryClient,
|
|
2860
2565
|
onDragStart,
|
|
2861
2566
|
onPositionChange,
|
|
2862
2567
|
showCloseButton,
|
|
@@ -2868,10 +2573,8 @@
|
|
|
2868
2573
|
onClick: onCloseClick,
|
|
2869
2574
|
...otherCloseButtonProps
|
|
2870
2575
|
} = closeButtonProps;
|
|
2871
|
-
const
|
|
2872
|
-
|
|
2873
|
-
});
|
|
2874
|
-
const queryCache = queryClient.getQueryCache();
|
|
2576
|
+
const client = reactQuery.useQueryClient(queryClient);
|
|
2577
|
+
const queryCache = client.getQueryCache();
|
|
2875
2578
|
const [sort, setSort] = useLocalStorage('reactQueryDevtoolsSortFn', Object.keys(sortFns)[0]);
|
|
2876
2579
|
const [filter, setFilter] = useLocalStorage('reactQueryDevtoolsFilter', '');
|
|
2877
2580
|
const [baseSort, setBaseSort] = useLocalStorage('reactQueryDevtoolsBaseSort', 1);
|
|
@@ -2880,11 +2583,9 @@
|
|
|
2880
2583
|
const [activeQueryHash, setActiveQueryHash] = useLocalStorage('reactQueryDevtoolsActiveQueryHash', '');
|
|
2881
2584
|
const queries = React__namespace.useMemo(() => {
|
|
2882
2585
|
const unsortedQueries = queryCache.getAll();
|
|
2883
|
-
|
|
2884
2586
|
if (queriesCount === 0) {
|
|
2885
2587
|
return [];
|
|
2886
2588
|
}
|
|
2887
|
-
|
|
2888
2589
|
const filtered = filter ? unsortedQueries.filter(item => rankItem(item.queryHash, filter).passed) : [...unsortedQueries];
|
|
2889
2590
|
const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
|
|
2890
2591
|
return sorted;
|
|
@@ -2906,7 +2607,26 @@
|
|
|
2906
2607
|
}), /*#__PURE__*/React__namespace.createElement("style", {
|
|
2907
2608
|
nonce: styleNonce,
|
|
2908
2609
|
dangerouslySetInnerHTML: {
|
|
2909
|
-
__html:
|
|
2610
|
+
__html: `
|
|
2611
|
+
.ReactQueryDevtoolsPanel * {
|
|
2612
|
+
scrollbar-color: ${defaultTheme.backgroundAlt} ${defaultTheme.gray};
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar, .ReactQueryDevtoolsPanel scrollbar {
|
|
2616
|
+
width: 1em;
|
|
2617
|
+
height: 1em;
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-track, .ReactQueryDevtoolsPanel scrollbar-track {
|
|
2621
|
+
background: ${defaultTheme.backgroundAlt};
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
.ReactQueryDevtoolsPanel *::-webkit-scrollbar-thumb, .ReactQueryDevtoolsPanel scrollbar-thumb {
|
|
2625
|
+
background: ${defaultTheme.gray};
|
|
2626
|
+
border-radius: .5em;
|
|
2627
|
+
border: 3px solid ${defaultTheme.backgroundAlt};
|
|
2628
|
+
}
|
|
2629
|
+
`
|
|
2910
2630
|
}
|
|
2911
2631
|
}), /*#__PURE__*/React__namespace.createElement("div", {
|
|
2912
2632
|
style: getResizeHandleStyle(position),
|
|
@@ -2917,7 +2637,7 @@
|
|
|
2917
2637
|
minHeight: '40%',
|
|
2918
2638
|
maxHeight: '100%',
|
|
2919
2639
|
overflow: 'auto',
|
|
2920
|
-
borderRight:
|
|
2640
|
+
borderRight: `1px solid ${defaultTheme.grayAlt}`,
|
|
2921
2641
|
display: 'flex',
|
|
2922
2642
|
flexDirection: 'column'
|
|
2923
2643
|
}
|
|
@@ -2985,7 +2705,7 @@
|
|
|
2985
2705
|
}, /*#__PURE__*/React__namespace.createElement(Input, {
|
|
2986
2706
|
placeholder: "Filter",
|
|
2987
2707
|
"aria-label": "Filter by queryhash",
|
|
2988
|
-
value: filter
|
|
2708
|
+
value: filter ?? '',
|
|
2989
2709
|
onChange: e => setFilter(e.target.value),
|
|
2990
2710
|
onKeyDown: e => {
|
|
2991
2711
|
if (e.key === 'Escape') setFilter('');
|
|
@@ -3092,7 +2812,7 @@
|
|
|
3092
2812
|
}))), activeQueryHash && isOpen ? /*#__PURE__*/React__namespace.createElement(ActiveQuery, {
|
|
3093
2813
|
activeQueryHash: activeQueryHash,
|
|
3094
2814
|
queryCache: queryCache,
|
|
3095
|
-
queryClient:
|
|
2815
|
+
queryClient: client
|
|
3096
2816
|
}) : null, showCloseButton ? /*#__PURE__*/React__namespace.createElement(Button, _extends({
|
|
3097
2817
|
type: "button",
|
|
3098
2818
|
"aria-controls": "ReactQueryDevtoolsPanel",
|
|
@@ -3109,44 +2829,26 @@
|
|
|
3109
2829
|
},
|
|
3110
2830
|
onClick: e => {
|
|
3111
2831
|
setIsOpen(false);
|
|
3112
|
-
onCloseClick
|
|
2832
|
+
onCloseClick?.(e);
|
|
3113
2833
|
}
|
|
3114
2834
|
}), "Close") : null));
|
|
3115
2835
|
});
|
|
3116
|
-
|
|
3117
2836
|
const ActiveQuery = ({
|
|
3118
2837
|
queryCache,
|
|
3119
2838
|
activeQueryHash,
|
|
3120
2839
|
queryClient
|
|
3121
2840
|
}) => {
|
|
3122
|
-
var _useSubscribeToQueryC, _useSubscribeToQueryC2;
|
|
3123
|
-
|
|
3124
2841
|
const activeQuery = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
|
|
3125
|
-
const activeQueryState = useSubscribeToQueryCache(queryCache, () =>
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
return (_queryCache$getAll$fi = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi.state;
|
|
3129
|
-
});
|
|
3130
|
-
const isStale = (_useSubscribeToQueryC = useSubscribeToQueryCache(queryCache, () => {
|
|
3131
|
-
var _queryCache$getAll$fi2;
|
|
3132
|
-
|
|
3133
|
-
return (_queryCache$getAll$fi2 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi2.isStale();
|
|
3134
|
-
})) != null ? _useSubscribeToQueryC : false;
|
|
3135
|
-
const observerCount = (_useSubscribeToQueryC2 = useSubscribeToQueryCache(queryCache, () => {
|
|
3136
|
-
var _queryCache$getAll$fi3;
|
|
3137
|
-
|
|
3138
|
-
return (_queryCache$getAll$fi3 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi3.getObserversCount();
|
|
3139
|
-
})) != null ? _useSubscribeToQueryC2 : 0;
|
|
3140
|
-
|
|
2842
|
+
const activeQueryState = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.state);
|
|
2843
|
+
const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.isStale()) ?? false;
|
|
2844
|
+
const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash)?.getObserversCount()) ?? 0;
|
|
3141
2845
|
const handleRefetch = () => {
|
|
3142
|
-
const promise = activeQuery
|
|
3143
|
-
promise
|
|
2846
|
+
const promise = activeQuery?.fetch();
|
|
2847
|
+
promise?.catch(noop);
|
|
3144
2848
|
};
|
|
3145
|
-
|
|
3146
2849
|
if (!activeQuery || !activeQueryState) {
|
|
3147
2850
|
return null;
|
|
3148
2851
|
}
|
|
3149
|
-
|
|
3150
2852
|
return /*#__PURE__*/React__namespace.createElement(ActiveQueryPanel, null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
3151
2853
|
style: {
|
|
3152
2854
|
padding: '.5em',
|
|
@@ -3163,7 +2865,7 @@
|
|
|
3163
2865
|
style: {
|
|
3164
2866
|
marginBottom: '.5em',
|
|
3165
2867
|
display: 'flex',
|
|
3166
|
-
alignItems: '
|
|
2868
|
+
alignItems: 'stretch',
|
|
3167
2869
|
justifyContent: 'space-between'
|
|
3168
2870
|
}
|
|
3169
2871
|
}, /*#__PURE__*/React__namespace.createElement(Code, {
|
|
@@ -3278,7 +2980,6 @@
|
|
|
3278
2980
|
}
|
|
3279
2981
|
})));
|
|
3280
2982
|
};
|
|
3281
|
-
|
|
3282
2983
|
const QueryStatusCount = ({
|
|
3283
2984
|
queryCache
|
|
3284
2985
|
}) => {
|
|
@@ -3316,52 +3017,37 @@
|
|
|
3316
3017
|
}
|
|
3317
3018
|
}, "inactive ", /*#__PURE__*/React__namespace.createElement(Code, null, "(", hasInactive, ")")));
|
|
3318
3019
|
};
|
|
3319
|
-
|
|
3320
3020
|
const QueryRow = /*#__PURE__*/React__namespace.memo(({
|
|
3321
3021
|
queryKey,
|
|
3322
3022
|
setActiveQueryHash,
|
|
3323
3023
|
activeQueryHash,
|
|
3324
3024
|
queryCache
|
|
3325
3025
|
}) => {
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
});
|
|
3338
|
-
const
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
return (_queryCache$find3 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find3.isStale();
|
|
3342
|
-
})) != null ? _useSubscribeToQueryC4 : false;
|
|
3343
|
-
const isDisabled = (_useSubscribeToQueryC5 = useSubscribeToQueryCache(queryCache, () => {
|
|
3344
|
-
var _queryCache$find4;
|
|
3345
|
-
|
|
3346
|
-
return (_queryCache$find4 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find4.isDisabled();
|
|
3347
|
-
})) != null ? _useSubscribeToQueryC5 : false;
|
|
3348
|
-
const observerCount = (_useSubscribeToQueryC6 = useSubscribeToQueryCache(queryCache, () => {
|
|
3349
|
-
var _queryCache$find5;
|
|
3350
|
-
|
|
3351
|
-
return (_queryCache$find5 = queryCache.find(queryKey)) == null ? void 0 : _queryCache$find5.getObserversCount();
|
|
3352
|
-
})) != null ? _useSubscribeToQueryC6 : 0;
|
|
3353
|
-
|
|
3026
|
+
const queryHash = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
3027
|
+
queryKey
|
|
3028
|
+
})?.queryHash) ?? '';
|
|
3029
|
+
const queryState = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
3030
|
+
queryKey
|
|
3031
|
+
})?.state);
|
|
3032
|
+
const isStale = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
3033
|
+
queryKey
|
|
3034
|
+
})?.isStale()) ?? false;
|
|
3035
|
+
const isDisabled = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
3036
|
+
queryKey
|
|
3037
|
+
})?.isDisabled()) ?? false;
|
|
3038
|
+
const observerCount = useSubscribeToQueryCache(queryCache, () => queryCache.find({
|
|
3039
|
+
queryKey
|
|
3040
|
+
})?.getObserversCount()) ?? 0;
|
|
3354
3041
|
if (!queryState) {
|
|
3355
3042
|
return null;
|
|
3356
3043
|
}
|
|
3357
|
-
|
|
3358
3044
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
3359
3045
|
role: "button",
|
|
3360
|
-
"aria-label":
|
|
3046
|
+
"aria-label": `Open query details for ${queryHash}`,
|
|
3361
3047
|
onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
|
|
3362
3048
|
style: {
|
|
3363
3049
|
display: 'flex',
|
|
3364
|
-
borderBottom:
|
|
3050
|
+
borderBottom: `solid 1px ${defaultTheme.grayAlt}`,
|
|
3365
3051
|
cursor: 'pointer',
|
|
3366
3052
|
background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
|
|
3367
3053
|
}
|
|
@@ -3397,9 +3083,10 @@
|
|
|
3397
3083
|
style: {
|
|
3398
3084
|
padding: '.5em'
|
|
3399
3085
|
}
|
|
3400
|
-
},
|
|
3401
|
-
});
|
|
3086
|
+
}, `${queryHash}`));
|
|
3087
|
+
});
|
|
3402
3088
|
|
|
3089
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3403
3090
|
function noop() {}
|
|
3404
3091
|
|
|
3405
3092
|
const ReactQueryDevtools = ReactQueryDevtools$1;
|
|
@@ -3408,7 +3095,5 @@
|
|
|
3408
3095
|
exports.ReactQueryDevtools = ReactQueryDevtools;
|
|
3409
3096
|
exports.ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel;
|
|
3410
3097
|
|
|
3411
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3412
|
-
|
|
3413
3098
|
}));
|
|
3414
3099
|
//# sourceMappingURL=index.development.js.map
|