@tanstack/react-query-devtools 5.0.0-alpha.5 → 5.0.0-alpha.51

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 (115) 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 +61 -0
  6. package/build/lib/devtools.cjs.map +1 -0
  7. package/build/lib/devtools.d.ts +11 -75
  8. package/build/lib/devtools.d.ts.map +1 -0
  9. package/build/lib/devtools.js +53 -789
  10. package/build/lib/devtools.js.map +1 -1
  11. package/build/lib/index.cjs +18 -0
  12. package/build/lib/index.cjs.map +1 -0
  13. package/build/lib/index.d.ts +1 -1
  14. package/build/lib/index.d.ts.map +1 -0
  15. package/build/lib/index.js +11 -9
  16. package/build/lib/index.js.map +1 -1
  17. package/build/lib/index.prod.cjs +69 -0
  18. package/build/lib/index.prod.cjs.map +1 -0
  19. package/build/lib/{index.prod.d.ts → index.prod.d.ts/index.d.ts} +1 -1
  20. package/build/lib/index.prod.js +58 -1444
  21. package/build/lib/index.prod.js.map +1 -1
  22. package/package.json +24 -26
  23. package/src/__tests__/devtools.test.tsx +1 -861
  24. package/src/devtools.tsx +61 -1164
  25. package/src/index.ts +6 -6
  26. package/build/lib/Explorer.d.ts +0 -50
  27. package/build/lib/Explorer.esm.js +0 -253
  28. package/build/lib/Explorer.esm.js.map +0 -1
  29. package/build/lib/Explorer.js +0 -287
  30. package/build/lib/Explorer.js.map +0 -1
  31. package/build/lib/Explorer.mjs +0 -253
  32. package/build/lib/Explorer.mjs.map +0 -1
  33. package/build/lib/Logo.d.ts +0 -1
  34. package/build/lib/Logo.esm.js +0 -32
  35. package/build/lib/Logo.esm.js.map +0 -1
  36. package/build/lib/Logo.js +0 -55
  37. package/build/lib/Logo.js.map +0 -1
  38. package/build/lib/Logo.mjs +0 -32
  39. package/build/lib/Logo.mjs.map +0 -1
  40. package/build/lib/__tests__/Explorer.test.d.ts +0 -1
  41. package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +0 -17
  42. package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +0 -1
  43. package/build/lib/_virtual/_rollupPluginBabelHelpers.js +0 -19
  44. package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  45. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +0 -17
  46. package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +0 -1
  47. package/build/lib/devtools.esm.js +0 -773
  48. package/build/lib/devtools.esm.js.map +0 -1
  49. package/build/lib/devtools.mjs +0 -773
  50. package/build/lib/devtools.mjs.map +0 -1
  51. package/build/lib/index.esm.js +0 -11
  52. package/build/lib/index.esm.js.map +0 -1
  53. package/build/lib/index.mjs +0 -11
  54. package/build/lib/index.mjs.map +0 -1
  55. package/build/lib/index.prod.esm.js +0 -1431
  56. package/build/lib/index.prod.esm.js.map +0 -1
  57. package/build/lib/index.prod.mjs +0 -1431
  58. package/build/lib/index.prod.mjs.map +0 -1
  59. package/build/lib/noop.d.ts +0 -2
  60. package/build/lib/screenreader.d.ts +0 -3
  61. package/build/lib/screenreader.esm.js +0 -17
  62. package/build/lib/screenreader.esm.js.map +0 -1
  63. package/build/lib/screenreader.js +0 -40
  64. package/build/lib/screenreader.js.map +0 -1
  65. package/build/lib/screenreader.mjs +0 -17
  66. package/build/lib/screenreader.mjs.map +0 -1
  67. package/build/lib/styledComponents.d.ts +0 -9
  68. package/build/lib/styledComponents.esm.js +0 -93
  69. package/build/lib/styledComponents.esm.js.map +0 -1
  70. package/build/lib/styledComponents.js +0 -102
  71. package/build/lib/styledComponents.js.map +0 -1
  72. package/build/lib/styledComponents.mjs +0 -93
  73. package/build/lib/styledComponents.mjs.map +0 -1
  74. package/build/lib/theme.d.ts +0 -36
  75. package/build/lib/theme.esm.js +0 -32
  76. package/build/lib/theme.esm.js.map +0 -1
  77. package/build/lib/theme.js +0 -55
  78. package/build/lib/theme.js.map +0 -1
  79. package/build/lib/theme.mjs +0 -32
  80. package/build/lib/theme.mjs.map +0 -1
  81. package/build/lib/useLocalStorage.d.ts +0 -1
  82. package/build/lib/useLocalStorage.esm.js +0 -40
  83. package/build/lib/useLocalStorage.esm.js.map +0 -1
  84. package/build/lib/useLocalStorage.js +0 -63
  85. package/build/lib/useLocalStorage.js.map +0 -1
  86. package/build/lib/useLocalStorage.mjs +0 -40
  87. package/build/lib/useLocalStorage.mjs.map +0 -1
  88. package/build/lib/useMediaQuery.d.ts +0 -1
  89. package/build/lib/useMediaQuery.esm.js +0 -36
  90. package/build/lib/useMediaQuery.esm.js.map +0 -1
  91. package/build/lib/useMediaQuery.js +0 -59
  92. package/build/lib/useMediaQuery.js.map +0 -1
  93. package/build/lib/useMediaQuery.mjs +0 -36
  94. package/build/lib/useMediaQuery.mjs.map +0 -1
  95. package/build/lib/utils.d.ts +0 -79
  96. package/build/lib/utils.esm.js +0 -184
  97. package/build/lib/utils.esm.js.map +0 -1
  98. package/build/lib/utils.js +0 -218
  99. package/build/lib/utils.js.map +0 -1
  100. package/build/lib/utils.mjs +0 -184
  101. package/build/lib/utils.mjs.map +0 -1
  102. package/build/umd/index.development.js +0 -3099
  103. package/build/umd/index.development.js.map +0 -1
  104. package/build/umd/index.production.js +0 -2
  105. package/build/umd/index.production.js.map +0 -1
  106. package/src/Explorer.tsx +0 -385
  107. package/src/Logo.tsx +0 -32
  108. package/src/__tests__/Explorer.test.tsx +0 -150
  109. package/src/noop.ts +0 -7
  110. package/src/screenreader.tsx +0 -16
  111. package/src/styledComponents.ts +0 -108
  112. package/src/theme.tsx +0 -33
  113. package/src/useLocalStorage.ts +0 -52
  114. package/src/useMediaQuery.ts +0 -34
  115. package/src/utils.ts +0 -319
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
1
+ //# sourceMappingURL=devtools.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/devtools.test.tsx"],"names":[],"mappings":""}
@@ -12,7 +12,7 @@ export declare function sleep(timeout: number): Promise<void>;
12
12
  * @param textToMatch The string that needs to be matched
13
13
  * @reference https://stackoverflow.com/a/56859650/8252081
14
14
  */
15
- declare type MatcherFunction = (content: string, element: Element | null) => boolean;
15
+ type MatcherFunction = (content: string, element: Element | null) => boolean;
16
16
  export declare const getByTextContent: (textToMatch: string) => MatcherFunction;
17
17
  interface CreateQueryClientResponse {
18
18
  queryClient: QueryClient;
@@ -20,3 +20,4 @@ interface CreateQueryClientResponse {
20
20
  }
21
21
  export declare const createQueryClient: () => CreateQueryClientResponse;
22
22
  export {};
23
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,EACL,WAAW,EAEX,UAAU,EACX,MAAM,uBAAuB,CAAA;AAE9B,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,EACnB,EAAE,EAAE,KAAK,CAAC,YAAY,EACtB,eAAe,GAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAM,EACnE,aAAa,CAAC,EAAE,aAAa,GAC5B,UAAU,CAAC,OAAO,MAAM,CAAC,CAkB3B;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpD;AAED;;;;;;;GAOG;AAEH,KAAK,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,OAAO,CAAA;AAE5E,eAAO,MAAM,gBAAgB,gBACb,MAAM,KAAG,eAatB,CAAA;AAEH,UAAU,yBAAyB;IACjC,WAAW,EAAE,WAAW,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,iBAAiB,QAAO,yBAWpC,CAAA"}
@@ -0,0 +1,61 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var reactQuery = require('@tanstack/react-query');
6
+ var queryDevtools = require('@tanstack/query-devtools');
7
+
8
+ function ReactQueryDevtools(props) {
9
+ const queryClient = reactQuery.useQueryClient();
10
+ const client = props.client || queryClient;
11
+ const ref = React.useRef(null);
12
+ const {
13
+ buttonPosition,
14
+ position,
15
+ initialIsOpen,
16
+ errorTypes
17
+ } = props;
18
+ const [devtools] = React.useState(new queryDevtools.TanstackQueryDevtools({
19
+ client: client,
20
+ queryFlavor: 'React Query',
21
+ version: '5',
22
+ onlineManager: reactQuery.onlineManager,
23
+ buttonPosition,
24
+ position,
25
+ initialIsOpen,
26
+ errorTypes
27
+ }));
28
+ React.useEffect(() => {
29
+ devtools.setClient(client);
30
+ }, [client, devtools]);
31
+ React.useEffect(() => {
32
+ if (buttonPosition) {
33
+ devtools.setButtonPosition(buttonPosition);
34
+ }
35
+ }, [buttonPosition, devtools]);
36
+ React.useEffect(() => {
37
+ if (position) {
38
+ devtools.setPosition(position);
39
+ }
40
+ }, [position, devtools]);
41
+ React.useEffect(() => {
42
+ devtools.setInitialIsOpen(initialIsOpen || false);
43
+ }, [initialIsOpen, devtools]);
44
+ React.useEffect(() => {
45
+ devtools.setErrorTypes(errorTypes || []);
46
+ }, [errorTypes, devtools]);
47
+ React.useEffect(() => {
48
+ if (ref.current) {
49
+ devtools.mount(ref.current);
50
+ }
51
+ return () => {
52
+ devtools.unmount();
53
+ };
54
+ }, [devtools]);
55
+ return /*#__PURE__*/React.createElement("div", {
56
+ ref: ref
57
+ });
58
+ }
59
+
60
+ exports.ReactQueryDevtools = ReactQueryDevtools;
61
+ //# sourceMappingURL=devtools.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.cjs","sources":["../../src/devtools.tsx"],"sourcesContent":["'use client'\nimport { useRef, useState, useEffect } from 'react'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { useQueryClient, onlineManager } from '@tanstack/react-query'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsPosition,\n DevToolsErrorType,\n} from '@tanstack/query-devtools'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport React from 'react'\n\nexport interface DevtoolsOptions {\n /**\n * Set this true if you want the dev tools to default to being open\n */\n initialIsOpen?: boolean\n /**\n * The position of the React Query logo to open and close the devtools panel.\n * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n * Defaults to 'bottom-left'.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the React Query devtools panel.\n * 'top' | 'bottom' | 'left' | 'right'\n * Defaults to 'bottom'.\n */\n position?: DevtoolsPosition\n /**\n * Custom instance of QueryClient\n */\n client?: QueryClient\n /**\n * Use this so you can define custom errors that can be shown in the devtools.\n */\n errorTypes?: DevToolsErrorType[]\n}\n\nexport function ReactQueryDevtools(\n props: DevtoolsOptions,\n): React.ReactElement | null {\n const queryClient = useQueryClient()\n const client = props.client || queryClient\n const ref = useRef<HTMLDivElement>(null)\n const { buttonPosition, position, initialIsOpen, errorTypes } = props\n const [devtools] = useState(\n new TanstackQueryDevtools({\n client: client,\n queryFlavor: 'React Query',\n version: '5',\n onlineManager,\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n }),\n )\n\n useEffect(() => {\n devtools.setClient(client)\n }, [client, devtools])\n\n useEffect(() => {\n if (buttonPosition) {\n devtools.setButtonPosition(buttonPosition)\n }\n }, [buttonPosition, devtools])\n\n useEffect(() => {\n if (position) {\n devtools.setPosition(position)\n }\n }, [position, devtools])\n\n useEffect(() => {\n devtools.setInitialIsOpen(initialIsOpen || false)\n }, [initialIsOpen, devtools])\n\n useEffect(() => {\n devtools.setErrorTypes(errorTypes || [])\n }, [errorTypes, devtools])\n\n useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return <div ref={ref}></div>\n}\n"],"names":["errorTypes","client","queryFlavor","version","useEffect","devtools","ref"],"mappings":";;;;;;;AAuCO;AAGL;AACA;AACA;;;;;AACiDA;AAAW;;AAGxDC;AACAC;AACAC;;;;;AAKAH;AACF;AAGFI;AACEC;AACF;AAEAD;AACE;AACEC;AACF;AACF;AAEAD;AACE;AACEC;AACF;AACF;AAEAD;AACEC;AACF;AAEAD;AACEC;AACF;AAEAD;;AAEIC;AACF;AAEA;;;AAGF;;AAEYC;AAAS;AACvB;;"}
@@ -1,95 +1,31 @@
1
- import * as React from 'react';
2
1
  import type { QueryClient } from '@tanstack/react-query';
3
- import type { Corner, Side } from './utils';
2
+ import type { DevtoolsButtonPosition, DevtoolsPosition, DevToolsErrorType } from '@tanstack/query-devtools';
3
+ import React from 'react';
4
4
  export interface DevtoolsOptions {
5
5
  /**
6
6
  * Set this true if you want the dev tools to default to being open
7
7
  */
8
8
  initialIsOpen?: boolean;
9
- /**
10
- * Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
11
- */
12
- panelProps?: React.ComponentPropsWithoutRef<'div'>;
13
- /**
14
- * Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
15
- */
16
- closeButtonProps?: React.ComponentPropsWithoutRef<'button'>;
17
- /**
18
- * Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
19
- */
20
- toggleButtonProps?: React.ComponentPropsWithoutRef<'button'>;
21
9
  /**
22
10
  * The position of the React Query logo to open and close the devtools panel.
11
+ * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
23
12
  * Defaults to 'bottom-left'.
24
13
  */
25
- position?: Corner;
14
+ buttonPosition?: DevtoolsButtonPosition;
26
15
  /**
27
16
  * The position of the React Query devtools panel.
17
+ * 'top' | 'bottom' | 'left' | 'right'
28
18
  * Defaults to 'bottom'.
29
19
  */
30
- panelPosition?: Side;
31
- /**
32
- * Use this to render the devtools inside a different type of container element for a11y purposes.
33
- * Any string which corresponds to a valid intrinsic JSX element is allowed.
34
- * Defaults to 'aside'.
35
- */
36
- containerElement?: string | any;
37
- /**
38
- * nonce for style element for CSP
39
- */
40
- styleNonce?: string;
20
+ position?: DevtoolsPosition;
41
21
  /**
42
22
  * Custom instance of QueryClient
43
23
  */
44
- queryClient?: QueryClient;
45
- }
46
- interface DevtoolsPanelOptions {
47
- /**
48
- * The standard React style object used to style a component with inline styles
49
- */
50
- style?: React.CSSProperties;
51
- /**
52
- * The standard React className property used to style a component with classes
53
- */
54
- className?: string;
55
- /**
56
- * A boolean variable indicating whether the panel is open or closed
57
- */
58
- isOpen?: boolean;
24
+ client?: QueryClient;
59
25
  /**
60
- * nonce for style element for CSP
61
- */
62
- styleNonce?: string;
63
- /**
64
- * A function that toggles the open and close state of the panel
65
- */
66
- setIsOpen: (isOpen: boolean) => void;
67
- /**
68
- * Handles the opening and closing the devtools panel
69
- */
70
- onDragStart: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
71
- /**
72
- * The position of the React Query devtools panel.
73
- * Defaults to 'bottom'.
74
- */
75
- position?: Side;
76
- /**
77
- * Handles the panel position select change
78
- */
79
- onPositionChange?: (side: Side) => void;
80
- /**
81
- * Show a close button inside the panel
82
- */
83
- showCloseButton?: boolean;
84
- /**
85
- * Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
86
- */
87
- closeButtonProps?: React.ComponentPropsWithoutRef<'button'>;
88
- /**
89
- * Custom instance of QueryClient
26
+ * Use this so you can define custom errors that can be shown in the devtools.
90
27
  */
91
- queryClient?: QueryClient;
28
+ errorTypes?: DevToolsErrorType[];
92
29
  }
93
- export declare function ReactQueryDevtools({ initialIsOpen, panelProps, closeButtonProps, toggleButtonProps, position, containerElement: Container, queryClient, styleNonce, panelPosition: initialPanelPosition, }: DevtoolsOptions): React.ReactElement | null;
94
- export declare const ReactQueryDevtoolsPanel: React.ForwardRefExoticComponent<DevtoolsPanelOptions & React.RefAttributes<HTMLDivElement>>;
95
- export {};
30
+ export declare function ReactQueryDevtools(props: DevtoolsOptions): React.ReactElement | null;
31
+ //# sourceMappingURL=devtools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../../src/devtools.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AAEjC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAA;IACvC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACjC;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,eAAe,GACrB,KAAK,CAAC,YAAY,GAAG,IAAI,CAqD3B"}