@tanstack/react-query-devtools 4.3.0-beta.4 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/build/lib/Explorer.js +205 -0
  2. package/build/lib/Explorer.js.map +1 -0
  3. package/build/lib/Explorer.mjs +171 -0
  4. package/build/lib/Explorer.mjs.map +1 -0
  5. package/build/lib/Logo.js +56 -0
  6. package/build/lib/Logo.js.map +1 -0
  7. package/build/lib/Logo.mjs +32 -0
  8. package/build/lib/Logo.mjs.map +1 -0
  9. package/build/lib/_virtual/_rollupPluginBabelHelpers.js +23 -0
  10. package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  11. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +19 -0
  12. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +1 -0
  13. package/build/lib/devtools.js +801 -0
  14. package/build/lib/devtools.js.map +1 -0
  15. package/build/lib/{index.prod.mjs → devtools.mjs} +20 -482
  16. package/build/lib/devtools.mjs.map +1 -0
  17. package/build/lib/index.js +3 -1258
  18. package/build/lib/index.js.map +1 -1
  19. package/build/lib/index.mjs +3 -1238
  20. package/build/lib/index.mjs.map +1 -1
  21. package/build/lib/screenreader.d.ts +4 -0
  22. package/build/lib/screenreader.js +41 -0
  23. package/build/lib/screenreader.js.map +1 -0
  24. package/build/lib/screenreader.mjs +17 -0
  25. package/build/lib/screenreader.mjs.map +1 -0
  26. package/build/lib/styledComponents.js +103 -0
  27. package/build/lib/styledComponents.js.map +1 -0
  28. package/build/lib/styledComponents.mjs +92 -0
  29. package/build/lib/styledComponents.mjs.map +1 -0
  30. package/build/lib/theme.js +58 -0
  31. package/build/lib/theme.js.map +1 -0
  32. package/build/lib/theme.mjs +32 -0
  33. package/build/lib/theme.mjs.map +1 -0
  34. package/build/lib/useLocalStorage.js +71 -0
  35. package/build/lib/useLocalStorage.js.map +1 -0
  36. package/build/lib/useLocalStorage.mjs +47 -0
  37. package/build/lib/useLocalStorage.mjs.map +1 -0
  38. package/build/lib/useMediaQuery.js +56 -0
  39. package/build/lib/useMediaQuery.js.map +1 -0
  40. package/build/lib/useMediaQuery.mjs +32 -0
  41. package/build/lib/useMediaQuery.mjs.map +1 -0
  42. package/build/lib/utils.d.ts +0 -1
  43. package/build/lib/utils.js +101 -0
  44. package/build/lib/utils.js.map +1 -0
  45. package/build/lib/utils.mjs +72 -0
  46. package/build/lib/utils.mjs.map +1 -0
  47. package/build/umd/index.development.js +22 -15
  48. package/build/umd/index.development.js.map +1 -1
  49. package/build/umd/index.production.js +0 -10
  50. package/build/umd/index.production.js.map +1 -1
  51. package/package.json +7 -2
  52. package/src/devtools.tsx +11 -3
  53. package/src/screenreader.tsx +16 -0
  54. package/src/utils.ts +1 -3
  55. package/build/lib/index.prod.js +0 -1263
  56. package/build/lib/index.prod.js.map +0 -1
  57. package/build/lib/index.prod.mjs.map +0 -1
@@ -1,12 +1,2 @@
1
- /**
2
- * react-query-devtools
3
- *
4
- * Copyright (c) TanStack
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
1
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactQueryDevtools={})}(this,(function(e){"use strict";e.ReactQueryDevtools=function(){return null},e.ReactQueryDevtoolsPanel=function(){return null},Object.defineProperty(e,"__esModule",{value:!0})}));
12
2
  //# sourceMappingURL=index.production.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.production.js","sources":["../../src/index.ts"],"sourcesContent":["import * as devtools from './devtools'\n\nexport const ReactQueryDevtools: typeof devtools['ReactQueryDevtools'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtools.ReactQueryDevtools\n\nexport const ReactQueryDevtoolsPanel: typeof devtools['ReactQueryDevtoolsPanel'] =\n process.env.NODE_ENV !== 'development'\n ? (function () {\n return null\n } as any)\n : devtools.ReactQueryDevtoolsPanel\n"],"names":[],"mappings":";;;;;;;;;;+QAIM,WACE,OAAO,gCAMR,WACC,OAAO"}
1
+ {"version":3,"file":"index.production.js","sources":["../../src/index.ts"],"sourcesContent":["import * as devtools from './devtools'\n\nexport const ReactQueryDevtools: typeof devtools['ReactQueryDevtools'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtools.ReactQueryDevtools\n\nexport const ReactQueryDevtoolsPanel: typeof devtools['ReactQueryDevtoolsPanel'] =\n process.env.NODE_ENV !== 'development'\n ? (function () {\n return null\n } as any)\n : devtools.ReactQueryDevtoolsPanel\n"],"names":[],"mappings":"+QAIM,WACE,OAAO,gCAMR,WACC,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-query-devtools",
3
- "version": "4.3.0-beta.4",
3
+ "version": "4.3.0",
4
4
  "description": "TODO",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -18,6 +18,11 @@
18
18
  "import": "./build/lib/index.mjs",
19
19
  "default": "./build/lib/index.js"
20
20
  },
21
+ "./production": {
22
+ "types": "./build/lib/index.d.ts",
23
+ "import": "./build/lib/index.prod.mjs",
24
+ "default": "./build/lib/index.prod.js"
25
+ },
21
26
  "./build/lib/index.prod.js": {
22
27
  "types": "./build/lib/index.d.ts",
23
28
  "import": "./build/lib/index.prod.mjs",
@@ -45,6 +50,6 @@
45
50
  "peerDependencies": {
46
51
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
47
52
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
48
- "@tanstack/react-query": "4.3.0-beta.4"
53
+ "@tanstack/react-query": "4.3.0"
49
54
  }
50
55
  }
package/src/devtools.tsx CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  import { rankItem, compareItems } from '@tanstack/match-sorter-utils'
13
13
  import useLocalStorage from './useLocalStorage'
14
14
  import { sortFns, useIsMounted } from './utils'
15
+ import ScreenReader from './screenreader'
15
16
 
16
17
  import {
17
18
  Panel,
@@ -98,8 +99,6 @@ interface DevtoolsPanelOptions extends ContextOptions {
98
99
  handleDragStart: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void
99
100
  }
100
101
 
101
- const isServer = typeof window === 'undefined'
102
-
103
102
  export function ReactQueryDevtools({
104
103
  initialIsOpen,
105
104
  panelProps = {},
@@ -191,7 +190,7 @@ export function ReactQueryDevtools({
191
190
  }
192
191
  }, [isResolvedOpen])
193
192
 
194
- React[isServer ? 'useEffect' : 'useLayoutEffect'](() => {
193
+ React.useEffect(() => {
195
194
  if (isResolvedOpen) {
196
195
  const previousValue = rootRef.current?.parentElement?.style.paddingBottom
197
196
 
@@ -368,6 +367,7 @@ export function ReactQueryDevtools({
368
367
  }}
369
368
  >
370
369
  <Logo aria-hidden />
370
+ <ScreenReader text="Open React Query Devtools" />
371
371
  </button>
372
372
  ) : null}
373
373
  </Container>
@@ -538,6 +538,7 @@ export const ReactQueryDevtoolsPanel = React.forwardRef<
538
538
  }}
539
539
  >
540
540
  <Logo aria-hidden />
541
+ <ScreenReader text="Close React Query Devtools" />
541
542
  </button>
542
543
  <div
543
544
  style={{
@@ -648,6 +649,13 @@ export const ReactQueryDevtoolsPanel = React.forwardRef<
648
649
  </>
649
650
  )}
650
651
  </svg>
652
+ <ScreenReader
653
+ text={
654
+ isMockOffline
655
+ ? 'Restore offline mock'
656
+ : 'Mock offline behavior'
657
+ }
658
+ />
651
659
  </Button>
652
660
  </>
653
661
  ) : null}
@@ -0,0 +1,16 @@
1
+ import * as React from 'react'
2
+
3
+ export default function ScreenReader({ text }: { text: string }) {
4
+ return (
5
+ <span
6
+ style={{
7
+ position: 'absolute',
8
+ width: '0.1px',
9
+ height: '0.1px',
10
+ overflow: 'hidden',
11
+ }}
12
+ >
13
+ {text}
14
+ </span>
15
+ )
16
+ }
package/src/utils.ts CHANGED
@@ -4,8 +4,6 @@ import type { Query } from '@tanstack/react-query'
4
4
  import { Theme, useTheme } from './theme'
5
5
  import useMediaQuery from './useMediaQuery'
6
6
 
7
- export const isServer = typeof window === 'undefined'
8
-
9
7
  type StyledComponent<T> = T extends 'button'
10
8
  ? React.DetailedHTMLProps<
11
9
  React.ButtonHTMLAttributes<HTMLButtonElement>,
@@ -104,7 +102,7 @@ export function useIsMounted() {
104
102
  const mountedRef = React.useRef(false)
105
103
  const isMounted = React.useCallback(() => mountedRef.current, [])
106
104
 
107
- React[isServer ? 'useEffect' : 'useLayoutEffect'](() => {
105
+ React.useEffect(() => {
108
106
  mountedRef.current = true
109
107
  return () => {
110
108
  mountedRef.current = false