@tanstack/react-query-devtools 5.0.0-alpha.7 → 5.0.0-alpha.71

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.
Files changed (127) hide show
  1. package/build/lib/__tests__/devtools.test.d.ts +1 -1
  2. package/build/lib/__tests__/devtools.test.d.ts.map +1 -0
  3. package/build/lib/__tests__/utils.d.ts +2 -1
  4. package/build/lib/__tests__/utils.d.ts.map +1 -0
  5. package/build/lib/devtools.cjs +65 -0
  6. package/build/lib/devtools.cjs.map +1 -0
  7. package/build/lib/devtools.d.ts +11 -91
  8. package/build/lib/devtools.d.ts.map +1 -0
  9. package/build/lib/devtools.js +56 -913
  10. package/build/lib/devtools.js.map +1 -1
  11. package/build/lib/devtools.legacy.cjs +65 -0
  12. package/build/lib/devtools.legacy.cjs.map +1 -0
  13. package/build/lib/devtools.legacy.js +63 -0
  14. package/build/lib/devtools.legacy.js.map +1 -0
  15. package/build/lib/index.cjs +18 -0
  16. package/build/lib/index.cjs.map +1 -0
  17. package/build/lib/index.d.ts +1 -1
  18. package/build/lib/index.d.ts.map +1 -0
  19. package/build/lib/index.js +11 -9
  20. package/build/lib/index.js.map +1 -1
  21. package/build/lib/index.legacy.cjs +18 -0
  22. package/build/lib/index.legacy.cjs.map +1 -0
  23. package/build/lib/index.legacy.js +16 -0
  24. package/build/lib/index.legacy.js.map +1 -0
  25. package/build/lib/index.prod.cjs +70 -0
  26. package/build/lib/index.prod.cjs.map +1 -0
  27. package/build/lib/{index.prod.d.ts → index.prod.d.ts/index.d.ts} +1 -1
  28. package/build/lib/index.prod.js +59 -1571
  29. package/build/lib/index.prod.js.map +1 -1
  30. package/build/lib/index.prod.legacy.cjs +70 -0
  31. package/build/lib/index.prod.legacy.cjs.map +1 -0
  32. package/build/lib/index.prod.legacy.js +68 -0
  33. package/build/lib/index.prod.legacy.js.map +1 -0
  34. package/package.json +23 -24
  35. package/src/__tests__/devtools.test.tsx +1 -1009
  36. package/src/devtools.tsx +67 -1306
  37. package/src/index.ts +6 -6
  38. package/build/lib/Explorer.d.ts +0 -50
  39. package/build/lib/Explorer.esm.js +0 -253
  40. package/build/lib/Explorer.esm.js.map +0 -1
  41. package/build/lib/Explorer.js +0 -287
  42. package/build/lib/Explorer.js.map +0 -1
  43. package/build/lib/Explorer.mjs +0 -253
  44. package/build/lib/Explorer.mjs.map +0 -1
  45. package/build/lib/Logo.d.ts +0 -1
  46. package/build/lib/Logo.esm.js +0 -32
  47. package/build/lib/Logo.esm.js.map +0 -1
  48. package/build/lib/Logo.js +0 -55
  49. package/build/lib/Logo.js.map +0 -1
  50. package/build/lib/Logo.mjs +0 -32
  51. package/build/lib/Logo.mjs.map +0 -1
  52. package/build/lib/__tests__/Explorer.test.d.ts +0 -1
  53. package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +0 -17
  54. package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +0 -1
  55. package/build/lib/_virtual/_rollupPluginBabelHelpers.js +0 -19
  56. package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  57. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +0 -17
  58. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +0 -1
  59. package/build/lib/devtools.esm.js +0 -899
  60. package/build/lib/devtools.esm.js.map +0 -1
  61. package/build/lib/devtools.mjs +0 -868
  62. package/build/lib/devtools.mjs.map +0 -1
  63. package/build/lib/index.esm.js +0 -11
  64. package/build/lib/index.esm.js.map +0 -1
  65. package/build/lib/index.mjs +0 -11
  66. package/build/lib/index.mjs.map +0 -1
  67. package/build/lib/index.prod.esm.js +0 -1559
  68. package/build/lib/index.prod.esm.js.map +0 -1
  69. package/build/lib/index.prod.mjs +0 -1528
  70. package/build/lib/index.prod.mjs.map +0 -1
  71. package/build/lib/noop.d.ts +0 -2
  72. package/build/lib/screenreader.d.ts +0 -3
  73. package/build/lib/screenreader.esm.js +0 -17
  74. package/build/lib/screenreader.esm.js.map +0 -1
  75. package/build/lib/screenreader.js +0 -40
  76. package/build/lib/screenreader.js.map +0 -1
  77. package/build/lib/screenreader.mjs +0 -17
  78. package/build/lib/screenreader.mjs.map +0 -1
  79. package/build/lib/styledComponents.d.ts +0 -9
  80. package/build/lib/styledComponents.esm.js +0 -95
  81. package/build/lib/styledComponents.esm.js.map +0 -1
  82. package/build/lib/styledComponents.js +0 -104
  83. package/build/lib/styledComponents.js.map +0 -1
  84. package/build/lib/styledComponents.mjs +0 -95
  85. package/build/lib/styledComponents.mjs.map +0 -1
  86. package/build/lib/theme.d.ts +0 -36
  87. package/build/lib/theme.esm.js +0 -32
  88. package/build/lib/theme.esm.js.map +0 -1
  89. package/build/lib/theme.js +0 -55
  90. package/build/lib/theme.js.map +0 -1
  91. package/build/lib/theme.mjs +0 -32
  92. package/build/lib/theme.mjs.map +0 -1
  93. package/build/lib/useLocalStorage.d.ts +0 -1
  94. package/build/lib/useLocalStorage.esm.js +0 -40
  95. package/build/lib/useLocalStorage.esm.js.map +0 -1
  96. package/build/lib/useLocalStorage.js +0 -63
  97. package/build/lib/useLocalStorage.js.map +0 -1
  98. package/build/lib/useLocalStorage.mjs +0 -40
  99. package/build/lib/useLocalStorage.mjs.map +0 -1
  100. package/build/lib/useMediaQuery.d.ts +0 -1
  101. package/build/lib/useMediaQuery.esm.js +0 -36
  102. package/build/lib/useMediaQuery.esm.js.map +0 -1
  103. package/build/lib/useMediaQuery.js +0 -59
  104. package/build/lib/useMediaQuery.js.map +0 -1
  105. package/build/lib/useMediaQuery.mjs +0 -36
  106. package/build/lib/useMediaQuery.mjs.map +0 -1
  107. package/build/lib/utils.d.ts +0 -79
  108. package/build/lib/utils.esm.js +0 -184
  109. package/build/lib/utils.esm.js.map +0 -1
  110. package/build/lib/utils.js +0 -218
  111. package/build/lib/utils.js.map +0 -1
  112. package/build/lib/utils.mjs +0 -184
  113. package/build/lib/utils.mjs.map +0 -1
  114. package/build/umd/index.development.js +0 -3195
  115. package/build/umd/index.development.js.map +0 -1
  116. package/build/umd/index.production.js +0 -2
  117. package/build/umd/index.production.js.map +0 -1
  118. package/src/Explorer.tsx +0 -385
  119. package/src/Logo.tsx +0 -32
  120. package/src/__tests__/Explorer.test.tsx +0 -150
  121. package/src/noop.ts +0 -7
  122. package/src/screenreader.tsx +0 -16
  123. package/src/styledComponents.ts +0 -110
  124. package/src/theme.tsx +0 -33
  125. package/src/useLocalStorage.ts +0 -52
  126. package/src/useMediaQuery.ts +0 -34
  127. package/src/utils.ts +0 -319
@@ -1,920 +1,63 @@
1
- 'use strict';
2
-
3
- var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
4
- var React = require('react');
5
- var reactQuery = require('@tanstack/react-query');
6
- var matchSorterUtils = require('@tanstack/match-sorter-utils');
7
- var useLocalStorage = require('./useLocalStorage.js');
8
- var utils = require('./utils.js');
9
- var styledComponents = require('./styledComponents.js');
10
- var screenreader = require('./screenreader.js');
11
- var theme = require('./theme.js');
12
- var Explorer = require('./Explorer.js');
13
- var Logo = require('./Logo.js');
14
-
15
- function _interopNamespaceDefault(e) {
16
- var n = Object.create(null);
17
- if (e) {
18
- Object.keys(e).forEach(function (k) {
19
- if (k !== 'default') {
20
- var d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(n, k, d.get ? d : {
22
- enumerable: true,
23
- get: function () { return e[k]; }
24
- });
25
- }
26
- });
27
- }
28
- n.default = e;
29
- return Object.freeze(n);
30
- }
31
-
32
- var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
33
-
34
- function ReactQueryDevtools({
35
- initialIsOpen,
36
- panelProps = {},
37
- closeButtonProps = {},
38
- toggleButtonProps = {},
39
- position = 'bottom-left',
40
- containerElement: Container = 'aside',
41
- queryClient,
42
- styleNonce,
43
- panelPosition: initialPanelPosition = 'bottom',
44
- errorTypes = []
45
- }) {
46
- const rootRef = React__namespace.useRef(null);
47
- const panelRef = React__namespace.useRef(null);
48
- const [isOpen, setIsOpen] = useLocalStorage.default('reactQueryDevtoolsOpen', initialIsOpen);
49
- const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage.default('reactQueryDevtoolsHeight', utils.defaultPanelSize);
50
- const [devtoolsWidth, setDevtoolsWidth] = useLocalStorage.default('reactQueryDevtoolsWidth', utils.defaultPanelSize);
51
- const [panelPosition = 'bottom', setPanelPosition] = useLocalStorage.default('reactQueryDevtoolsPanelPosition', initialPanelPosition);
52
- const [isResolvedOpen, setIsResolvedOpen] = React__namespace.useState(false);
53
- const [isResizing, setIsResizing] = React__namespace.useState(false);
54
- const isMounted = utils.useIsMounted();
55
- const handleDragStart = (panelElement, startEvent) => {
56
- if (!panelElement) return;
57
- if (startEvent.button !== 0) return; // Only allow left click for drag
58
- const isVertical = utils.isVerticalSide(panelPosition);
59
- setIsResizing(true);
60
- const {
61
- height,
62
- width
63
- } = panelElement.getBoundingClientRect();
64
- const startX = startEvent.clientX;
65
- const startY = startEvent.clientY;
66
- let newSize = 0;
67
- const run = moveEvent => {
68
- // prevent mouse selecting stuff with mouse drag
69
- moveEvent.preventDefault();
70
-
71
- // calculate the correct size based on mouse position and current panel position
72
- // hint: it is different formula for the opposite sides
73
- if (isVertical) {
74
- newSize = width + (panelPosition === 'right' ? startX - moveEvent.clientX : moveEvent.clientX - startX);
75
- setDevtoolsWidth(newSize);
76
- } else {
77
- newSize = height + (panelPosition === 'bottom' ? startY - moveEvent.clientY : moveEvent.clientY - startY);
78
- setDevtoolsHeight(newSize);
79
- }
80
- if (newSize < utils.minPanelSize) {
81
- setIsOpen(false);
82
- } else {
83
- setIsOpen(true);
84
- }
85
- };
86
- const unsub = () => {
87
- if (isResizing) {
88
- setIsResizing(false);
89
- }
90
- document.removeEventListener('mousemove', run, false);
91
- document.removeEventListener('mouseUp', unsub, false);
92
- };
93
- document.addEventListener('mousemove', run, false);
94
- document.addEventListener('mouseup', unsub, false);
95
- };
96
- React__namespace.useEffect(() => {
97
- setIsResolvedOpen(isOpen != null ? isOpen : false);
98
- }, [isOpen, isResolvedOpen, setIsResolvedOpen]);
99
-
100
- // Toggle panel visibility before/after transition (depending on direction).
101
- // Prevents focusing in a closed panel.
102
- React__namespace.useEffect(() => {
103
- const ref = panelRef.current;
104
- if (ref) {
105
- const handlePanelTransitionStart = () => {
106
- if (isResolvedOpen) {
107
- ref.style.visibility = 'visible';
108
- }
109
- };
110
- const handlePanelTransitionEnd = () => {
111
- if (!isResolvedOpen) {
112
- ref.style.visibility = 'hidden';
113
- }
114
- };
115
- ref.addEventListener('transitionstart', handlePanelTransitionStart);
116
- ref.addEventListener('transitionend', handlePanelTransitionEnd);
117
- return () => {
118
- ref.removeEventListener('transitionstart', handlePanelTransitionStart);
119
- ref.removeEventListener('transitionend', handlePanelTransitionEnd);
120
- };
121
- }
122
- return;
123
- }, [isResolvedOpen]);
124
- React__namespace.useEffect(() => {
125
- var _rootRef$current;
126
- if (isResolvedOpen && (_rootRef$current = rootRef.current) != null && _rootRef$current.parentElement) {
127
- const {
128
- parentElement
129
- } = rootRef.current;
130
- const styleProp = utils.getSidedProp('padding', panelPosition);
131
- const isVertical = utils.isVerticalSide(panelPosition);
132
- const previousPaddings = (({
133
- padding,
134
- paddingTop,
135
- paddingBottom,
136
- paddingLeft,
137
- paddingRight
138
- }) => ({
139
- padding,
140
- paddingTop,
141
- paddingBottom,
142
- paddingLeft,
143
- paddingRight
144
- }))(parentElement.style);
145
- const run = () => {
146
- // reset the padding
147
- parentElement.style.padding = '0px';
148
- parentElement.style.paddingTop = '0px';
149
- parentElement.style.paddingBottom = '0px';
150
- parentElement.style.paddingLeft = '0px';
151
- parentElement.style.paddingRight = '0px';
152
- // set the new padding based on the new panel position
153
-
154
- parentElement.style[styleProp] = `${isVertical ? devtoolsWidth : devtoolsHeight}px`;
155
- };
156
- run();
157
- if (typeof window !== 'undefined') {
158
- window.addEventListener('resize', run);
159
- return () => {
160
- window.removeEventListener('resize', run);
161
- Object.entries(previousPaddings).forEach(([property, previousValue]) => {
162
- parentElement.style[property] = previousValue;
163
- });
164
- };
165
- }
166
- }
167
- return;
168
- }, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth]);
169
- const {
170
- style: panelStyle = {},
171
- ...otherPanelProps
172
- } = panelProps;
1
+ 'use client';
2
+ import React, { useRef, useState, useEffect } from 'react';
3
+ import { useQueryClient, onlineManager } from '@tanstack/react-query';
4
+ import { TanstackQueryDevtools } from '@tanstack/query-devtools';
5
+
6
+ function ReactQueryDevtoolsDev(props) {
7
+ const queryClient = useQueryClient();
8
+ const client = props.client || queryClient;
9
+ const ref = useRef(null);
173
10
  const {
174
- style: toggleButtonStyle = {},
175
- onClick: onToggleClick,
176
- ...otherToggleButtonProps
177
- } = toggleButtonProps;
178
-
179
- // get computed style based on panel position
180
- const style = utils.getSidePanelStyle({
181
- position: panelPosition,
182
- devtoolsTheme: theme.defaultTheme,
183
- isOpen: isResolvedOpen,
184
- height: devtoolsHeight,
185
- width: devtoolsWidth,
186
- isResizing,
187
- panelStyle
188
- });
189
-
190
- // Do not render on the server
191
- if (!isMounted()) return null;
192
- return /*#__PURE__*/React__namespace.createElement(Container, {
193
- ref: rootRef,
194
- className: "ReactQueryDevtools",
195
- "aria-label": "React Query Devtools"
196
- }, /*#__PURE__*/React__namespace.createElement(theme.ThemeProvider, {
197
- theme: theme.defaultTheme
198
- }, /*#__PURE__*/React__namespace.createElement(ReactQueryDevtoolsPanel, _rollupPluginBabelHelpers.extends({
199
- ref: panelRef,
200
- queryClient: queryClient,
201
- styleNonce: styleNonce,
202
- position: panelPosition,
203
- onPositionChange: setPanelPosition,
204
- showCloseButton: true,
205
- closeButtonProps: closeButtonProps
206
- }, otherPanelProps, {
207
- style: style,
208
- isOpen: isResolvedOpen,
209
- setIsOpen: setIsOpen,
210
- onDragStart: e => handleDragStart(panelRef.current, e),
211
- errorTypes: errorTypes
212
- }))), !isResolvedOpen ? /*#__PURE__*/React__namespace.createElement("button", _rollupPluginBabelHelpers.extends({
213
- type: "button"
214
- }, otherToggleButtonProps, {
215
- "aria-label": "Open React Query Devtools",
216
- "aria-controls": "ReactQueryDevtoolsPanel",
217
- "aria-haspopup": "true",
218
- "aria-expanded": "false",
219
- onClick: e => {
220
- setIsOpen(true);
221
- onToggleClick == null ? void 0 : onToggleClick(e);
222
- },
223
- style: {
224
- background: 'none',
225
- border: 0,
226
- padding: 0,
227
- position: 'fixed',
228
- zIndex: 99999,
229
- display: 'inline-flex',
230
- fontSize: '1.5em',
231
- margin: '.5em',
232
- cursor: 'pointer',
233
- width: 'fit-content',
234
- ...(position === 'top-right' ? {
235
- top: '0',
236
- right: '0'
237
- } : position === 'top-left' ? {
238
- top: '0',
239
- left: '0'
240
- } : position === 'bottom-right' ? {
241
- bottom: '0',
242
- right: '0'
243
- } : {
244
- bottom: '0',
245
- left: '0'
246
- }),
247
- ...toggleButtonStyle
248
- }
249
- }), /*#__PURE__*/React__namespace.createElement(Logo.default, {
250
- "aria-hidden": true
251
- }), /*#__PURE__*/React__namespace.createElement(screenreader.default, {
252
- text: "Open React Query Devtools"
253
- })) : null);
254
- }
255
- const useSubscribeToQueryCache = (queryCache, getSnapshot, skip = false) => {
256
- return React__namespace.useSyncExternalStore(React__namespace.useCallback(onStoreChange => {
257
- if (!skip) return queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange));
258
- return () => {
259
- return;
260
- };
261
- }, [queryCache, skip]), getSnapshot, getSnapshot);
262
- };
263
- const ReactQueryDevtoolsPanel = /*#__PURE__*/React__namespace.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {
264
- const {
265
- isOpen = true,
266
- styleNonce,
267
- setIsOpen,
268
- queryClient,
269
- onDragStart,
270
- onPositionChange,
271
- showCloseButton,
11
+ buttonPosition,
272
12
  position,
273
- closeButtonProps = {},
274
- errorTypes = [],
275
- ...panelProps
13
+ initialIsOpen,
14
+ errorTypes
276
15
  } = props;
277
- const {
278
- onClick: onCloseClick,
279
- ...otherCloseButtonProps
280
- } = closeButtonProps;
281
- const client = reactQuery.useQueryClient(queryClient);
282
- const queryCache = client.getQueryCache();
283
- const [sort, setSort] = useLocalStorage.default('reactQueryDevtoolsSortFn', Object.keys(utils.sortFns)[0]);
284
- const [filter, setFilter] = useLocalStorage.default('reactQueryDevtoolsFilter', '');
285
- const [baseSort, setBaseSort] = useLocalStorage.default('reactQueryDevtoolsBaseSort', 1);
286
- const sortFn = React__namespace.useMemo(() => utils.sortFns[sort], [sort]);
287
- const queriesCount = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().length, !isOpen);
288
- const [activeQueryHash, setActiveQueryHash] = useLocalStorage.default('reactQueryDevtoolsActiveQueryHash', '');
289
- const queries = React__namespace.useMemo(() => {
290
- const unsortedQueries = queryCache.getAll();
291
- if (queriesCount === 0) {
292
- return [];
293
- }
294
- const filtered = filter ? unsortedQueries.filter(item => matchSorterUtils.rankItem(item.queryHash, filter).passed) : [...unsortedQueries];
295
- const sorted = sortFn ? filtered.sort((a, b) => sortFn(a, b) * baseSort) : filtered;
296
- return sorted;
297
- }, [baseSort, sortFn, filter, queriesCount, queryCache]);
298
- const [isMockOffline, setMockOffline] = React__namespace.useState(false);
299
- return /*#__PURE__*/React__namespace.createElement(theme.ThemeProvider, {
300
- theme: theme.defaultTheme
301
- }, /*#__PURE__*/React__namespace.createElement(styledComponents.Panel, _rollupPluginBabelHelpers.extends({
302
- ref: ref,
303
- className: "ReactQueryDevtoolsPanel",
304
- "aria-label": "React Query Devtools Panel",
305
- id: "ReactQueryDevtoolsPanel"
306
- }, panelProps, {
307
- style: {
308
- height: utils.defaultPanelSize,
309
- position: 'relative',
310
- ...panelProps.style
311
- }
312
- }), /*#__PURE__*/React__namespace.createElement("style", {
313
- nonce: styleNonce,
314
- dangerouslySetInnerHTML: {
315
- __html: `
316
- .ReactQueryDevtoolsPanel * {
317
- scrollbar-color: ${theme.defaultTheme.backgroundAlt} ${theme.defaultTheme.gray};
318
- }
319
-
320
- .ReactQueryDevtoolsPanel *::-webkit-scrollbar, .ReactQueryDevtoolsPanel scrollbar {
321
- width: 1em;
322
- height: 1em;
323
- }
324
-
325
- .ReactQueryDevtoolsPanel *::-webkit-scrollbar-track, .ReactQueryDevtoolsPanel scrollbar-track {
326
- background: ${theme.defaultTheme.backgroundAlt};
327
- }
328
-
329
- .ReactQueryDevtoolsPanel *::-webkit-scrollbar-thumb, .ReactQueryDevtoolsPanel scrollbar-thumb {
330
- background: ${theme.defaultTheme.gray};
331
- border-radius: .5em;
332
- border: 3px solid ${theme.defaultTheme.backgroundAlt};
333
- }
334
- `
335
- }
336
- }), /*#__PURE__*/React__namespace.createElement("div", {
337
- style: utils.getResizeHandleStyle(position),
338
- onMouseDown: onDragStart
339
- }), isOpen && /*#__PURE__*/React__namespace.createElement("div", {
340
- style: {
341
- flex: '1 1 500px',
342
- minHeight: '40%',
343
- maxHeight: '100%',
344
- overflow: 'auto',
345
- borderRight: `1px solid ${theme.defaultTheme.grayAlt}`,
346
- display: 'flex',
347
- flexDirection: 'column'
348
- }
349
- }, /*#__PURE__*/React__namespace.createElement("div", {
350
- style: {
351
- padding: '.5em',
352
- background: theme.defaultTheme.backgroundAlt,
353
- display: 'flex',
354
- justifyContent: 'space-between',
355
- alignItems: 'center'
356
- }
357
- }, /*#__PURE__*/React__namespace.createElement("button", {
358
- type: "button",
359
- "aria-label": "Close React Query Devtools",
360
- "aria-controls": "ReactQueryDevtoolsPanel",
361
- "aria-haspopup": "true",
362
- "aria-expanded": "true",
363
- onClick: () => setIsOpen(false),
364
- style: {
365
- display: 'inline-flex',
366
- background: 'none',
367
- border: 0,
368
- padding: 0,
369
- marginRight: '.5em',
370
- cursor: 'pointer'
371
- }
372
- }, /*#__PURE__*/React__namespace.createElement(Logo.default, {
373
- "aria-hidden": true
374
- }), /*#__PURE__*/React__namespace.createElement(screenreader.default, {
375
- text: "Close React Query Devtools"
376
- })), /*#__PURE__*/React__namespace.createElement("div", {
377
- style: {
378
- display: 'flex',
379
- flexDirection: 'column'
380
- }
381
- }, /*#__PURE__*/React__namespace.createElement("div", {
382
- style: {
383
- display: 'flex',
384
- justifyContent: 'space-between',
385
- alignItems: 'center',
386
- marginBottom: '.5em'
387
- }
388
- }, /*#__PURE__*/React__namespace.createElement(QueryStatusCount, {
389
- queryCache: queryCache
390
- }), position && onPositionChange ? /*#__PURE__*/React__namespace.createElement(styledComponents.Select, {
391
- "aria-label": "Panel position",
392
- value: position,
393
- style: {
394
- marginInlineStart: '.5em'
395
- },
396
- onChange: e => onPositionChange(e.target.value)
397
- }, /*#__PURE__*/React__namespace.createElement("option", {
398
- value: "left"
399
- }, "Left"), /*#__PURE__*/React__namespace.createElement("option", {
400
- value: "right"
401
- }, "Right"), /*#__PURE__*/React__namespace.createElement("option", {
402
- value: "top"
403
- }, "Top"), /*#__PURE__*/React__namespace.createElement("option", {
404
- value: "bottom"
405
- }, "Bottom")) : null), /*#__PURE__*/React__namespace.createElement("div", {
406
- style: {
407
- display: 'flex',
408
- alignItems: 'center',
409
- flexWrap: 'wrap',
410
- gap: '0.5em'
411
- }
412
- }, /*#__PURE__*/React__namespace.createElement(styledComponents.Input, {
413
- placeholder: "Filter",
414
- "aria-label": "Filter by queryhash",
415
- value: filter != null ? filter : '',
416
- onChange: e => setFilter(e.target.value),
417
- onKeyDown: e => {
418
- if (e.key === 'Escape') setFilter('');
419
- },
420
- style: {
421
- flex: '1',
422
- width: '100%'
423
- }
424
- }), /*#__PURE__*/React__namespace.createElement(styledComponents.Select, {
425
- "aria-label": "Sort queries",
426
- value: sort,
427
- onChange: e => setSort(e.target.value),
428
- style: {
429
- flex: '1',
430
- minWidth: 75,
431
- marginRight: '.5em'
432
- }
433
- }, Object.keys(utils.sortFns).map(key => /*#__PURE__*/React__namespace.createElement("option", {
434
- key: key,
435
- value: key
436
- }, "Sort by ", key))), /*#__PURE__*/React__namespace.createElement(styledComponents.Button, {
437
- type: "button",
438
- onClick: () => setBaseSort(old => old * -1),
439
- style: {
440
- padding: '.3em .4em',
441
- marginRight: '.5em'
442
- }
443
- }, baseSort === 1 ? '⬆ Asc' : '⬇ Desc'), /*#__PURE__*/React__namespace.createElement(styledComponents.Button, {
444
- type: "button",
445
- onClick: () => {
446
- if (isMockOffline) {
447
- reactQuery.onlineManager.setOnline(undefined);
448
- setMockOffline(false);
449
- window.dispatchEvent(new Event('online'));
450
- } else {
451
- reactQuery.onlineManager.setOnline(false);
452
- setMockOffline(true);
453
- }
454
- },
455
- "aria-label": isMockOffline ? 'Restore offline mock' : 'Mock offline behavior',
456
- title: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior',
457
- style: {
458
- padding: '0',
459
- height: '2em'
460
- }
461
- }, /*#__PURE__*/React__namespace.createElement("svg", {
462
- xmlns: "http://www.w3.org/2000/svg",
463
- width: "2em",
464
- height: "2em",
465
- viewBox: "0 0 24 24",
466
- stroke: isMockOffline ? theme.defaultTheme.danger : 'currentColor',
467
- fill: "none"
468
- }, isMockOffline ? /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("path", {
469
- stroke: "none",
470
- d: "M0 0h24v24H0z",
471
- fill: "none"
472
- }), /*#__PURE__*/React__namespace.createElement("line", {
473
- x1: "12",
474
- y1: "18",
475
- x2: "12.01",
476
- y2: "18"
477
- }), /*#__PURE__*/React__namespace.createElement("path", {
478
- d: "M9.172 15.172a4 4 0 0 1 5.656 0"
479
- }), /*#__PURE__*/React__namespace.createElement("path", {
480
- d: "M6.343 12.343a7.963 7.963 0 0 1 3.864 -2.14m4.163 .155a7.965 7.965 0 0 1 3.287 2"
481
- }), /*#__PURE__*/React__namespace.createElement("path", {
482
- d: "M3.515 9.515a12 12 0 0 1 3.544 -2.455m3.101 -.92a12 12 0 0 1 10.325 3.374"
483
- }), /*#__PURE__*/React__namespace.createElement("line", {
484
- x1: "3",
485
- y1: "3",
486
- x2: "21",
487
- y2: "21"
488
- })) : /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("path", {
489
- stroke: "none",
490
- d: "M0 0h24v24H0z",
491
- fill: "none"
492
- }), /*#__PURE__*/React__namespace.createElement("line", {
493
- x1: "12",
494
- y1: "18",
495
- x2: "12.01",
496
- y2: "18"
497
- }), /*#__PURE__*/React__namespace.createElement("path", {
498
- d: "M9.172 15.172a4 4 0 0 1 5.656 0"
499
- }), /*#__PURE__*/React__namespace.createElement("path", {
500
- d: "M6.343 12.343a8 8 0 0 1 11.314 0"
501
- }), /*#__PURE__*/React__namespace.createElement("path", {
502
- d: "M3.515 9.515c4.686 -4.687 12.284 -4.687 17 0"
503
- }))), /*#__PURE__*/React__namespace.createElement(screenreader.default, {
504
- text: isMockOffline ? 'Restore offline mock' : 'Mock offline behavior'
505
- }))))), /*#__PURE__*/React__namespace.createElement("div", {
506
- style: {
507
- overflowY: 'auto',
508
- flex: '1'
509
- }
510
- }, queries.map(query => {
511
- return /*#__PURE__*/React__namespace.createElement(QueryRow, {
512
- queryKey: query.queryKey,
513
- activeQueryHash: activeQueryHash,
514
- setActiveQueryHash: setActiveQueryHash,
515
- key: query.queryHash,
516
- queryCache: queryCache
517
- });
518
- }))), activeQueryHash && isOpen ? /*#__PURE__*/React__namespace.createElement(ActiveQuery, {
519
- activeQueryHash: activeQueryHash,
520
- queryCache: queryCache,
521
- queryClient: client,
522
- errorTypes: errorTypes
523
- }) : null, showCloseButton ? /*#__PURE__*/React__namespace.createElement(styledComponents.Button, _rollupPluginBabelHelpers.extends({
524
- type: "button",
525
- "aria-controls": "ReactQueryDevtoolsPanel",
526
- "aria-haspopup": "true",
527
- "aria-expanded": "true"
528
- }, otherCloseButtonProps, {
529
- style: {
530
- position: 'absolute',
531
- zIndex: 99999,
532
- margin: '.5em',
533
- bottom: 0,
534
- left: 0,
535
- ...otherCloseButtonProps.style
536
- },
537
- onClick: e => {
538
- setIsOpen(false);
539
- onCloseClick == null ? void 0 : onCloseClick(e);
540
- }
541
- }), "Close") : null));
542
- });
543
- const ActiveQuery = ({
544
- queryCache,
545
- activeQueryHash,
546
- queryClient,
547
- errorTypes
548
- }) => {
549
- var _useSubscribeToQueryC, _useSubscribeToQueryC2;
550
- const activeQuery = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().find(query => query.queryHash === activeQueryHash));
551
- const activeQueryState = useSubscribeToQueryCache(queryCache, () => {
552
- var _queryCache$getAll$fi;
553
- return (_queryCache$getAll$fi = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi.state;
554
- });
555
- const isStale = (_useSubscribeToQueryC = useSubscribeToQueryCache(queryCache, () => {
556
- var _queryCache$getAll$fi2;
557
- return (_queryCache$getAll$fi2 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi2.isStale();
558
- })) != null ? _useSubscribeToQueryC : false;
559
- const observerCount = (_useSubscribeToQueryC2 = useSubscribeToQueryCache(queryCache, () => {
560
- var _queryCache$getAll$fi3;
561
- return (_queryCache$getAll$fi3 = queryCache.getAll().find(query => query.queryHash === activeQueryHash)) == null ? void 0 : _queryCache$getAll$fi3.getObserversCount();
562
- })) != null ? _useSubscribeToQueryC2 : 0;
563
- const handleRefetch = () => {
564
- const promise = activeQuery == null ? void 0 : activeQuery.fetch();
565
- promise == null ? void 0 : promise.catch(noop);
566
- };
567
- const currentErrorTypeName = React.useMemo(() => {
568
- if (activeQuery && activeQueryState != null && activeQueryState.error) {
569
- const errorType = errorTypes.find(type => {
570
- var _activeQueryState$err;
571
- return type.initializer(activeQuery).toString() === ((_activeQueryState$err = activeQueryState.error) == null ? void 0 : _activeQueryState$err.toString());
572
- });
573
- return errorType == null ? void 0 : errorType.name;
574
- }
575
- return undefined;
576
- }, [activeQuery, activeQueryState == null ? void 0 : activeQueryState.error, errorTypes]);
577
- if (!activeQuery || !activeQueryState) {
578
- return null;
579
- }
580
- const triggerError = errorType => {
581
- var _errorType$initialize;
582
- const error = (_errorType$initialize = errorType == null ? void 0 : errorType.initializer(activeQuery)) != null ? _errorType$initialize : new Error('Unknown error from devtools');
583
- const __previousQueryOptions = activeQuery.options;
584
- activeQuery.setState({
585
- status: 'error',
586
- error,
587
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
588
- fetchMeta: {
589
- ...activeQuery.state.fetchMeta,
590
- __previousQueryOptions
591
- }
592
- });
593
- };
594
- const restoreQueryAfterLoadingOrError = () => {
595
- activeQuery.fetch(activeQuery.state.fetchMeta.__previousQueryOptions, {
596
- // Make sure this fetch will cancel the previous one
597
- cancelRefetch: true
598
- });
599
- };
600
- return /*#__PURE__*/React__namespace.createElement(styledComponents.ActiveQueryPanel, null, /*#__PURE__*/React__namespace.createElement("div", {
601
- style: {
602
- padding: '.5em',
603
- background: theme.defaultTheme.backgroundAlt,
604
- position: 'sticky',
605
- top: 0,
606
- zIndex: 1
607
- }
608
- }, "Query Details"), /*#__PURE__*/React__namespace.createElement("div", {
609
- style: {
610
- padding: '.5em'
611
- }
612
- }, /*#__PURE__*/React__namespace.createElement("div", {
613
- style: {
614
- marginBottom: '.5em',
615
- display: 'flex',
616
- alignItems: 'flex-start',
617
- justifyContent: 'space-between'
618
- }
619
- }, /*#__PURE__*/React__namespace.createElement(styledComponents.Code, {
620
- style: {
621
- lineHeight: '1.8em'
622
- }
623
- }, /*#__PURE__*/React__namespace.createElement("pre", {
624
- style: {
625
- margin: 0,
626
- padding: 0,
627
- overflow: 'auto'
628
- }
629
- }, utils.displayValue(activeQuery.queryKey, true))), /*#__PURE__*/React__namespace.createElement("span", {
630
- style: {
631
- padding: '0.3em .6em',
632
- borderRadius: '0.4em',
633
- fontWeight: 'bold',
634
- textShadow: '0 2px 10px black',
635
- background: utils.getQueryStatusColor({
636
- queryState: activeQueryState,
637
- isStale: isStale,
638
- observerCount: observerCount,
639
- theme: theme.defaultTheme
640
- }),
641
- flexShrink: 0
642
- }
643
- }, utils.getQueryStatusLabel(activeQuery))), /*#__PURE__*/React__namespace.createElement("div", {
644
- style: {
645
- marginBottom: '.5em',
646
- display: 'flex',
647
- alignItems: 'center',
648
- justifyContent: 'space-between'
649
- }
650
- }, "Observers: ", /*#__PURE__*/React__namespace.createElement(styledComponents.Code, null, observerCount)), /*#__PURE__*/React__namespace.createElement("div", {
651
- style: {
652
- display: 'flex',
653
- alignItems: 'center',
654
- justifyContent: 'space-between'
655
- }
656
- }, "Last Updated:", ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.Code, null, new Date(activeQueryState.dataUpdatedAt).toLocaleTimeString()))), /*#__PURE__*/React__namespace.createElement("div", {
657
- style: {
658
- background: theme.defaultTheme.backgroundAlt,
659
- padding: '.5em',
660
- position: 'sticky',
661
- top: 0,
662
- zIndex: 1
663
- }
664
- }, "Actions"), /*#__PURE__*/React__namespace.createElement("div", {
665
- style: {
666
- padding: '0.5em',
667
- display: 'flex',
668
- flexWrap: 'wrap',
669
- gap: '0.5em',
670
- alignItems: 'flex-end'
671
- }
672
- }, /*#__PURE__*/React__namespace.createElement(styledComponents.Button, {
673
- type: "button",
674
- onClick: handleRefetch,
675
- disabled: activeQueryState.fetchStatus === 'fetching',
676
- style: {
677
- background: theme.defaultTheme.active
678
- }
679
- }, "Refetch"), ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.Button, {
680
- type: "button",
681
- onClick: () => queryClient.invalidateQueries(activeQuery),
682
- style: {
683
- background: theme.defaultTheme.warning,
684
- color: theme.defaultTheme.inputTextColor
685
- }
686
- }, "Invalidate"), ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.Button, {
687
- type: "button",
688
- onClick: () => queryClient.resetQueries(activeQuery),
689
- style: {
690
- background: theme.defaultTheme.gray
691
- }
692
- }, "Reset"), ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.Button, {
693
- type: "button",
694
- onClick: () => queryClient.removeQueries(activeQuery),
695
- style: {
696
- background: theme.defaultTheme.danger
697
- }
698
- }, "Remove"), ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.Button, {
699
- type: "button",
700
- onClick: () => {
701
- if (activeQuery.state.data === undefined) {
702
- restoreQueryAfterLoadingOrError();
703
- } else {
704
- const __previousQueryOptions = activeQuery.options;
705
- // Trigger a fetch in order to trigger suspense as well.
706
- activeQuery.fetch({
707
- ...__previousQueryOptions,
708
- queryFn: () => {
709
- return new Promise(() => {
710
- // Never resolve
711
- });
712
- },
713
- gcTime: -1
714
- });
715
- activeQuery.setState({
716
- data: undefined,
717
- status: 'pending',
718
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
719
- fetchMeta: {
720
- ...activeQuery.state.fetchMeta,
721
- __previousQueryOptions
722
- }
723
- });
724
- }
725
- },
726
- style: {
727
- background: theme.defaultTheme.paused
728
- }
729
- }, activeQuery.state.status === 'pending' ? 'Restore' : 'Trigger', ' ', "loading"), ' ', errorTypes.length === 0 || activeQuery.state.status === 'error' ? /*#__PURE__*/React__namespace.createElement(styledComponents.Button, {
730
- type: "button",
731
- onClick: () => {
732
- if (!activeQuery.state.error) {
733
- triggerError();
734
- } else {
735
- queryClient.resetQueries(activeQuery);
736
- }
737
- },
738
- style: {
739
- background: theme.defaultTheme.danger
740
- }
741
- }, activeQuery.state.status === 'error' ? 'Restore' : 'Trigger', " error") : /*#__PURE__*/React__namespace.createElement("label", null, "Trigger error:", /*#__PURE__*/React__namespace.createElement(styledComponents.Select, {
742
- value: currentErrorTypeName != null ? currentErrorTypeName : '',
743
- style: {
744
- marginInlineStart: '.5em'
745
- },
746
- onChange: e => {
747
- const errorType = errorTypes.find(t => t.name === e.target.value);
748
- triggerError(errorType);
749
- }
750
- }, /*#__PURE__*/React__namespace.createElement("option", {
751
- key: "",
752
- value: ""
753
- }), errorTypes.map(errorType => /*#__PURE__*/React__namespace.createElement("option", {
754
- key: errorType.name,
755
- value: errorType.name
756
- }, errorType.name))))), /*#__PURE__*/React__namespace.createElement("div", {
757
- style: {
758
- background: theme.defaultTheme.backgroundAlt,
759
- padding: '.5em',
760
- position: 'sticky',
761
- top: 0,
762
- zIndex: 1
763
- }
764
- }, "Data Explorer"), /*#__PURE__*/React__namespace.createElement("div", {
765
- style: {
766
- padding: '.5em'
767
- }
768
- }, /*#__PURE__*/React__namespace.createElement(Explorer.default, {
769
- label: "Data",
770
- value: activeQueryState.data,
771
- defaultExpanded: {},
772
- copyable: true
773
- })), /*#__PURE__*/React__namespace.createElement("div", {
774
- style: {
775
- background: theme.defaultTheme.backgroundAlt,
776
- padding: '.5em',
777
- position: 'sticky',
778
- top: 0,
779
- zIndex: 1
780
- }
781
- }, "Query Explorer"), /*#__PURE__*/React__namespace.createElement("div", {
782
- style: {
783
- padding: '.5em'
784
- }
785
- }, /*#__PURE__*/React__namespace.createElement(Explorer.default, {
786
- label: "Query",
787
- value: activeQuery,
788
- defaultExpanded: {
789
- queryKey: true
790
- }
791
- })));
792
- };
793
- const QueryStatusCount = ({
794
- queryCache
795
- }) => {
796
- const hasFresh = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => utils.getQueryStatusLabel(q) === 'fresh').length);
797
- const hasFetching = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => utils.getQueryStatusLabel(q) === 'fetching').length);
798
- const hasPaused = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => utils.getQueryStatusLabel(q) === 'paused').length);
799
- const hasStale = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => utils.getQueryStatusLabel(q) === 'stale').length);
800
- const hasInactive = useSubscribeToQueryCache(queryCache, () => queryCache.getAll().filter(q => utils.getQueryStatusLabel(q) === 'inactive').length);
801
- return /*#__PURE__*/React__namespace.createElement(styledComponents.QueryKeys, null, /*#__PURE__*/React__namespace.createElement(styledComponents.QueryKey, {
802
- style: {
803
- background: theme.defaultTheme.success,
804
- opacity: hasFresh ? 1 : 0.3
805
- }
806
- }, "fresh ", /*#__PURE__*/React__namespace.createElement(styledComponents.Code, null, "(", hasFresh, ")")), ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.QueryKey, {
807
- style: {
808
- background: theme.defaultTheme.active,
809
- opacity: hasFetching ? 1 : 0.3
810
- }
811
- }, "fetching ", /*#__PURE__*/React__namespace.createElement(styledComponents.Code, null, "(", hasFetching, ")")), ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.QueryKey, {
812
- style: {
813
- background: theme.defaultTheme.paused,
814
- opacity: hasPaused ? 1 : 0.3
815
- }
816
- }, "paused ", /*#__PURE__*/React__namespace.createElement(styledComponents.Code, null, "(", hasPaused, ")")), ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.QueryKey, {
817
- style: {
818
- background: theme.defaultTheme.warning,
819
- color: 'black',
820
- textShadow: '0',
821
- opacity: hasStale ? 1 : 0.3
822
- }
823
- }, "stale ", /*#__PURE__*/React__namespace.createElement(styledComponents.Code, null, "(", hasStale, ")")), ' ', /*#__PURE__*/React__namespace.createElement(styledComponents.QueryKey, {
824
- style: {
825
- background: theme.defaultTheme.gray,
826
- opacity: hasInactive ? 1 : 0.3
16
+ const [devtools] = useState(new TanstackQueryDevtools({
17
+ client: client,
18
+ queryFlavor: 'React Query',
19
+ version: '5',
20
+ onlineManager,
21
+ buttonPosition,
22
+ position,
23
+ initialIsOpen,
24
+ errorTypes
25
+ }));
26
+ useEffect(() => {
27
+ devtools.setClient(client);
28
+ }, [client, devtools]);
29
+ useEffect(() => {
30
+ if (buttonPosition) {
31
+ devtools.setButtonPosition(buttonPosition);
32
+ }
33
+ }, [buttonPosition, devtools]);
34
+ useEffect(() => {
35
+ if (position) {
36
+ devtools.setPosition(position);
37
+ }
38
+ }, [position, devtools]);
39
+ useEffect(() => {
40
+ devtools.setInitialIsOpen(initialIsOpen || false);
41
+ }, [initialIsOpen, devtools]);
42
+ useEffect(() => {
43
+ devtools.setErrorTypes(errorTypes || []);
44
+ }, [errorTypes, devtools]);
45
+ useEffect(() => {
46
+ if (ref.current) {
47
+ devtools.mount(ref.current);
827
48
  }
828
- }, "inactive ", /*#__PURE__*/React__namespace.createElement(styledComponents.Code, null, "(", hasInactive, ")")));
829
- };
830
- const QueryRow = /*#__PURE__*/React__namespace.memo(({
831
- queryKey,
832
- setActiveQueryHash,
833
- activeQueryHash,
834
- queryCache
835
- }) => {
836
- var _useSubscribeToQueryC3, _useSubscribeToQueryC4, _useSubscribeToQueryC5, _useSubscribeToQueryC6;
837
- const queryHash = (_useSubscribeToQueryC3 = useSubscribeToQueryCache(queryCache, () => {
838
- var _queryCache$find;
839
- return (_queryCache$find = queryCache.find({
840
- queryKey
841
- })) == null ? void 0 : _queryCache$find.queryHash;
842
- })) != null ? _useSubscribeToQueryC3 : '';
843
- const queryState = useSubscribeToQueryCache(queryCache, () => {
844
- var _queryCache$find2;
845
- return (_queryCache$find2 = queryCache.find({
846
- queryKey
847
- })) == null ? void 0 : _queryCache$find2.state;
49
+ return () => {
50
+ devtools.unmount();
51
+ };
52
+ }, [devtools]);
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ ref: ref
848
55
  });
849
- const isStale = (_useSubscribeToQueryC4 = useSubscribeToQueryCache(queryCache, () => {
850
- var _queryCache$find3;
851
- return (_queryCache$find3 = queryCache.find({
852
- queryKey
853
- })) == null ? void 0 : _queryCache$find3.isStale();
854
- })) != null ? _useSubscribeToQueryC4 : false;
855
- const isDisabled = (_useSubscribeToQueryC5 = useSubscribeToQueryCache(queryCache, () => {
856
- var _queryCache$find4;
857
- return (_queryCache$find4 = queryCache.find({
858
- queryKey
859
- })) == null ? void 0 : _queryCache$find4.isDisabled();
860
- })) != null ? _useSubscribeToQueryC5 : false;
861
- const observerCount = (_useSubscribeToQueryC6 = useSubscribeToQueryCache(queryCache, () => {
862
- var _queryCache$find5;
863
- return (_queryCache$find5 = queryCache.find({
864
- queryKey
865
- })) == null ? void 0 : _queryCache$find5.getObserversCount();
866
- })) != null ? _useSubscribeToQueryC6 : 0;
867
- if (!queryState) {
868
- return null;
869
- }
870
- return /*#__PURE__*/React__namespace.createElement("div", {
871
- role: "button",
872
- "aria-label": `Open query details for ${queryHash}`,
873
- onClick: () => setActiveQueryHash(activeQueryHash === queryHash ? '' : queryHash),
874
- style: {
875
- display: 'flex',
876
- borderBottom: `solid 1px ${theme.defaultTheme.grayAlt}`,
877
- cursor: 'pointer',
878
- background: queryHash === activeQueryHash ? 'rgba(255,255,255,.1)' : undefined
879
- }
880
- }, /*#__PURE__*/React__namespace.createElement("div", {
881
- style: {
882
- flex: '0 0 auto',
883
- width: '2em',
884
- height: '2em',
885
- background: utils.getQueryStatusColor({
886
- queryState,
887
- isStale,
888
- observerCount,
889
- theme: theme.defaultTheme
890
- }),
891
- display: 'flex',
892
- alignItems: 'center',
893
- justifyContent: 'center',
894
- fontWeight: 'bold',
895
- textShadow: isStale ? '0' : '0 0 10px black',
896
- color: isStale ? 'black' : 'white'
897
- }
898
- }, observerCount), isDisabled ? /*#__PURE__*/React__namespace.createElement("div", {
899
- style: {
900
- flex: '0 0 auto',
901
- height: '2em',
902
- background: theme.defaultTheme.gray,
903
- display: 'flex',
904
- alignItems: 'center',
905
- fontWeight: 'bold',
906
- padding: '0 0.5em'
907
- }
908
- }, "disabled") : null, /*#__PURE__*/React__namespace.createElement(styledComponents.Code, {
909
- style: {
910
- padding: '.5em'
911
- }
912
- }, `${queryHash}`));
913
- });
914
-
915
- // eslint-disable-next-line @typescript-eslint/no-empty-function
916
- function noop() {}
56
+ }
57
+ function ReactQueryDevtoolsProd(_props) {
58
+ return null;
59
+ }
60
+ const ReactQueryDevtools = process.env.NODE_ENV !== 'development' ? ReactQueryDevtoolsProd : ReactQueryDevtoolsDev;
917
61
 
918
- exports.ReactQueryDevtools = ReactQueryDevtools;
919
- exports.ReactQueryDevtoolsPanel = ReactQueryDevtoolsPanel;
62
+ export { ReactQueryDevtools };
920
63
  //# sourceMappingURL=devtools.js.map