@tanstack/react-query-devtools 5.53.3 → 5.54.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 (69) hide show
  1. package/build/legacy/{devtools-5wO_5H1h.d.cts → ReactQueryDevtools-Cn7cKi7o.d.cts} +5 -5
  2. package/build/legacy/{devtools-5wO_5H1h.d.ts → ReactQueryDevtools-Cn7cKi7o.d.ts} +5 -5
  3. package/build/{modern/devtools.cjs → legacy/ReactQueryDevtools.cjs} +5 -5
  4. package/build/legacy/ReactQueryDevtools.cjs.map +1 -0
  5. package/build/legacy/ReactQueryDevtools.d.cts +4 -0
  6. package/build/legacy/ReactQueryDevtools.d.ts +4 -0
  7. package/build/{modern/devtools.js → legacy/ReactQueryDevtools.js} +2 -2
  8. package/build/legacy/ReactQueryDevtools.js.map +1 -0
  9. package/build/legacy/ReactQueryDevtoolsPanel-D9deyZtU.d.cts +42 -0
  10. package/build/legacy/ReactQueryDevtoolsPanel-D9deyZtU.d.ts +42 -0
  11. package/build/legacy/ReactQueryDevtoolsPanel.cjs +91 -0
  12. package/build/legacy/ReactQueryDevtoolsPanel.cjs.map +1 -0
  13. package/build/legacy/ReactQueryDevtoolsPanel.d.cts +4 -0
  14. package/build/legacy/ReactQueryDevtoolsPanel.d.ts +4 -0
  15. package/build/legacy/ReactQueryDevtoolsPanel.js +57 -0
  16. package/build/legacy/ReactQueryDevtoolsPanel.js.map +1 -0
  17. package/build/legacy/index.cjs +10 -4
  18. package/build/legacy/index.cjs.map +1 -1
  19. package/build/legacy/index.d.cts +5 -3
  20. package/build/legacy/index.d.ts +5 -3
  21. package/build/legacy/index.js +8 -3
  22. package/build/legacy/index.js.map +1 -1
  23. package/build/legacy/production.cjs +8 -4
  24. package/build/legacy/production.cjs.map +1 -1
  25. package/build/legacy/production.d.cts +4 -2
  26. package/build/legacy/production.d.ts +4 -2
  27. package/build/legacy/production.js +6 -3
  28. package/build/legacy/production.js.map +1 -1
  29. package/build/modern/{devtools-5wO_5H1h.d.cts → ReactQueryDevtools-Cn7cKi7o.d.cts} +5 -5
  30. package/build/modern/{devtools-5wO_5H1h.d.ts → ReactQueryDevtools-Cn7cKi7o.d.ts} +5 -5
  31. package/build/{legacy/devtools.cjs → modern/ReactQueryDevtools.cjs} +5 -5
  32. package/build/modern/ReactQueryDevtools.cjs.map +1 -0
  33. package/build/modern/ReactQueryDevtools.d.cts +4 -0
  34. package/build/modern/ReactQueryDevtools.d.ts +4 -0
  35. package/build/{legacy/devtools.js → modern/ReactQueryDevtools.js} +2 -2
  36. package/build/modern/ReactQueryDevtools.js.map +1 -0
  37. package/build/modern/ReactQueryDevtoolsPanel-D9deyZtU.d.cts +42 -0
  38. package/build/modern/ReactQueryDevtoolsPanel-D9deyZtU.d.ts +42 -0
  39. package/build/modern/ReactQueryDevtoolsPanel.cjs +91 -0
  40. package/build/modern/ReactQueryDevtoolsPanel.cjs.map +1 -0
  41. package/build/modern/ReactQueryDevtoolsPanel.d.cts +4 -0
  42. package/build/modern/ReactQueryDevtoolsPanel.d.ts +4 -0
  43. package/build/modern/ReactQueryDevtoolsPanel.js +57 -0
  44. package/build/modern/ReactQueryDevtoolsPanel.js.map +1 -0
  45. package/build/modern/index.cjs +10 -4
  46. package/build/modern/index.cjs.map +1 -1
  47. package/build/modern/index.d.cts +5 -3
  48. package/build/modern/index.d.ts +5 -3
  49. package/build/modern/index.js +8 -3
  50. package/build/modern/index.js.map +1 -1
  51. package/build/modern/production.cjs +8 -4
  52. package/build/modern/production.cjs.map +1 -1
  53. package/build/modern/production.d.cts +4 -2
  54. package/build/modern/production.d.ts +4 -2
  55. package/build/modern/production.js +6 -3
  56. package/build/modern/production.js.map +1 -1
  57. package/package.json +2 -2
  58. package/src/ReactQueryDevtoolsPanel.tsx +91 -0
  59. package/src/index.ts +11 -3
  60. package/src/production.ts +4 -2
  61. package/build/legacy/devtools.cjs.map +0 -1
  62. package/build/legacy/devtools.d.cts +0 -4
  63. package/build/legacy/devtools.d.ts +0 -4
  64. package/build/legacy/devtools.js.map +0 -1
  65. package/build/modern/devtools.cjs.map +0 -1
  66. package/build/modern/devtools.d.cts +0 -4
  67. package/build/modern/devtools.d.ts +0 -4
  68. package/build/modern/devtools.js.map +0 -1
  69. /package/src/{devtools.tsx → ReactQueryDevtools.tsx} +0 -0
@@ -0,0 +1,4 @@
1
+ import 'react';
2
+ import '@tanstack/query-devtools';
3
+ import '@tanstack/react-query';
4
+ export { a as DevtoolsOptions, R as ReactQueryDevtools } from './ReactQueryDevtools-Cn7cKi7o.js';
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- // src/devtools.tsx
3
+ // src/ReactQueryDevtools.tsx
4
4
  import * as React from "react";
5
5
  import { onlineManager, useQueryClient } from "@tanstack/react-query";
6
6
  import { TanstackQueryDevtools } from "@tanstack/query-devtools";
@@ -62,4 +62,4 @@ function ReactQueryDevtools(props) {
62
62
  export {
63
63
  ReactQueryDevtools
64
64
  };
65
- //# sourceMappingURL=devtools.js.map
65
+ //# sourceMappingURL=ReactQueryDevtools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ReactQueryDevtools.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { onlineManager, useQueryClient } from '@tanstack/react-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n} from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/react-query'\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-right'.\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?: Array<DevtoolsErrorType>\n /**\n * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this so you can attach the devtool's styles to specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n}\n\nexport function ReactQueryDevtools(\n props: DevtoolsOptions,\n): React.ReactElement | null {\n const queryClient = useQueryClient(props.client)\n const ref = React.useRef<HTMLDivElement>(null)\n const {\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n } = props\n const [devtools] = React.useState(\n new TanstackQueryDevtools({\n client: queryClient,\n queryFlavor: 'React Query',\n version: '5',\n onlineManager,\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n }),\n )\n\n React.useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, devtools])\n\n React.useEffect(() => {\n if (buttonPosition) {\n devtools.setButtonPosition(buttonPosition)\n }\n }, [buttonPosition, devtools])\n\n React.useEffect(() => {\n if (position) {\n devtools.setPosition(position)\n }\n }, [position, devtools])\n\n React.useEffect(() => {\n devtools.setInitialIsOpen(initialIsOpen || false)\n }, [initialIsOpen, devtools])\n\n React.useEffect(() => {\n devtools.setErrorTypes(errorTypes || [])\n }, [errorTypes, devtools])\n\n React.useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return <div className=\"tsqd-parent-container\" ref={ref}></div>\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB,SAAS,eAAe,sBAAsB;AAC9C,SAAS,6BAA6B;AAyG7B;AA9DF,SAAS,mBACd,OAC2B;AAC3B,QAAM,cAAc,eAAe,MAAM,MAAM;AAC/C,QAAM,MAAY,aAAuB,IAAI;AAC7C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,IAAI,sBAAsB;AAAA,MACxB,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,UAAU,WAAW;AAAA,EAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;AAE1B,EAAM,gBAAU,MAAM;AACpB,QAAI,gBAAgB;AAClB,eAAS,kBAAkB,cAAc;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,gBAAgB,QAAQ,CAAC;AAE7B,EAAM,gBAAU,MAAM;AACpB,QAAI,UAAU;AACZ,eAAS,YAAY,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,EAAM,gBAAU,MAAM;AACpB,aAAS,iBAAiB,iBAAiB,KAAK;AAAA,EAClD,GAAG,CAAC,eAAe,QAAQ,CAAC;AAE5B,EAAM,gBAAU,MAAM;AACpB,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,EAAM,gBAAU,MAAM;AACpB,QAAI,IAAI,SAAS;AACf,eAAS,MAAM,IAAI,OAAO;AAAA,IAC5B;AAEA,WAAO,MAAM;AACX,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO,oBAAC,SAAI,WAAU,yBAAwB,KAAU;AAC1D;","names":[]}
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ import { DevtoolsErrorType } from '@tanstack/query-devtools';
3
+ import { QueryClient } from '@tanstack/react-query';
4
+
5
+ interface DevtoolsPanelOptions {
6
+ /**
7
+ * Custom instance of QueryClient
8
+ */
9
+ client?: QueryClient;
10
+ /**
11
+ * Use this so you can define custom errors that can be shown in the devtools.
12
+ */
13
+ errorTypes?: Array<DevtoolsErrorType>;
14
+ /**
15
+ * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
16
+ */
17
+ styleNonce?: string;
18
+ /**
19
+ * Use this so you can attach the devtool's styles to specific element in the DOM.
20
+ */
21
+ shadowDOMTarget?: ShadowRoot;
22
+ /**
23
+ * Custom styles for the devtools panel
24
+ * @default { height: '500px' }
25
+ * @example { height: '100%' }
26
+ * @example { height: '100%', width: '100%' }
27
+ */
28
+ style?: React.CSSProperties;
29
+ /**
30
+ * Callback function that is called when the devtools panel is closed
31
+ */
32
+ onClose?: () => unknown;
33
+ }
34
+ declare function ReactQueryDevtoolsPanel(props: DevtoolsPanelOptions): React.ReactElement | null;
35
+
36
+ type DevtoolsPanel_DevtoolsPanelOptions = DevtoolsPanelOptions;
37
+ declare const DevtoolsPanel_ReactQueryDevtoolsPanel: typeof ReactQueryDevtoolsPanel;
38
+ declare namespace DevtoolsPanel {
39
+ export { type DevtoolsPanel_DevtoolsPanelOptions as DevtoolsPanelOptions, DevtoolsPanel_ReactQueryDevtoolsPanel as ReactQueryDevtoolsPanel };
40
+ }
41
+
42
+ export { DevtoolsPanel as D, ReactQueryDevtoolsPanel as R, type DevtoolsPanelOptions as a };
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ import { DevtoolsErrorType } from '@tanstack/query-devtools';
3
+ import { QueryClient } from '@tanstack/react-query';
4
+
5
+ interface DevtoolsPanelOptions {
6
+ /**
7
+ * Custom instance of QueryClient
8
+ */
9
+ client?: QueryClient;
10
+ /**
11
+ * Use this so you can define custom errors that can be shown in the devtools.
12
+ */
13
+ errorTypes?: Array<DevtoolsErrorType>;
14
+ /**
15
+ * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
16
+ */
17
+ styleNonce?: string;
18
+ /**
19
+ * Use this so you can attach the devtool's styles to specific element in the DOM.
20
+ */
21
+ shadowDOMTarget?: ShadowRoot;
22
+ /**
23
+ * Custom styles for the devtools panel
24
+ * @default { height: '500px' }
25
+ * @example { height: '100%' }
26
+ * @example { height: '100%', width: '100%' }
27
+ */
28
+ style?: React.CSSProperties;
29
+ /**
30
+ * Callback function that is called when the devtools panel is closed
31
+ */
32
+ onClose?: () => unknown;
33
+ }
34
+ declare function ReactQueryDevtoolsPanel(props: DevtoolsPanelOptions): React.ReactElement | null;
35
+
36
+ type DevtoolsPanel_DevtoolsPanelOptions = DevtoolsPanelOptions;
37
+ declare const DevtoolsPanel_ReactQueryDevtoolsPanel: typeof ReactQueryDevtoolsPanel;
38
+ declare namespace DevtoolsPanel {
39
+ export { type DevtoolsPanel_DevtoolsPanelOptions as DevtoolsPanelOptions, DevtoolsPanel_ReactQueryDevtoolsPanel as ReactQueryDevtoolsPanel };
40
+ }
41
+
42
+ export { DevtoolsPanel as D, ReactQueryDevtoolsPanel as R, type DevtoolsPanelOptions as a };
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/ReactQueryDevtoolsPanel.tsx
32
+ var ReactQueryDevtoolsPanel_exports = {};
33
+ __export(ReactQueryDevtoolsPanel_exports, {
34
+ ReactQueryDevtoolsPanel: () => ReactQueryDevtoolsPanel
35
+ });
36
+ module.exports = __toCommonJS(ReactQueryDevtoolsPanel_exports);
37
+ var React = __toESM(require("react"), 1);
38
+ var import_react_query = require("@tanstack/react-query");
39
+ var import_query_devtools = require("@tanstack/query-devtools");
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ function ReactQueryDevtoolsPanel(props) {
42
+ const queryClient = (0, import_react_query.useQueryClient)(props.client);
43
+ const ref = React.useRef(null);
44
+ const { errorTypes, styleNonce, shadowDOMTarget } = props;
45
+ const [devtools] = React.useState(
46
+ new import_query_devtools.TanstackQueryDevtoolsPanel({
47
+ client: queryClient,
48
+ queryFlavor: "React Query",
49
+ version: "5",
50
+ onlineManager: import_react_query.onlineManager,
51
+ buttonPosition: "bottom-left",
52
+ position: "bottom",
53
+ initialIsOpen: true,
54
+ errorTypes,
55
+ styleNonce,
56
+ shadowDOMTarget,
57
+ onClose: props.onClose
58
+ })
59
+ );
60
+ React.useEffect(() => {
61
+ devtools.setClient(queryClient);
62
+ }, [queryClient, devtools]);
63
+ React.useEffect(() => {
64
+ devtools.setOnClose(props.onClose ?? (() => {
65
+ }));
66
+ }, [props.onClose, devtools]);
67
+ React.useEffect(() => {
68
+ devtools.setErrorTypes(errorTypes || []);
69
+ }, [errorTypes, devtools]);
70
+ React.useEffect(() => {
71
+ if (ref.current) {
72
+ devtools.mount(ref.current);
73
+ }
74
+ return () => {
75
+ devtools.unmount();
76
+ };
77
+ }, [devtools]);
78
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
+ "div",
80
+ {
81
+ style: { height: "500px", ...props.style },
82
+ className: "tsqd-parent-container",
83
+ ref
84
+ }
85
+ );
86
+ }
87
+ // Annotate the CommonJS export names for ESM import in node:
88
+ 0 && (module.exports = {
89
+ ReactQueryDevtoolsPanel
90
+ });
91
+ //# sourceMappingURL=ReactQueryDevtoolsPanel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ReactQueryDevtoolsPanel.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { onlineManager, useQueryClient } from '@tanstack/react-query'\nimport { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'\nimport type { DevtoolsErrorType } from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport interface DevtoolsPanelOptions {\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?: Array<DevtoolsErrorType>\n /**\n * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this so you can attach the devtool's styles to specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n\n /**\n * Custom styles for the devtools panel\n * @default { height: '500px' }\n * @example { height: '100%' }\n * @example { height: '100%', width: '100%' }\n */\n style?: React.CSSProperties\n\n /**\n * Callback function that is called when the devtools panel is closed\n */\n onClose?: () => unknown\n}\n\nexport function ReactQueryDevtoolsPanel(\n props: DevtoolsPanelOptions,\n): React.ReactElement | null {\n const queryClient = useQueryClient(props.client)\n const ref = React.useRef<HTMLDivElement>(null)\n const { errorTypes, styleNonce, shadowDOMTarget } = props\n const [devtools] = React.useState(\n new TanstackQueryDevtoolsPanel({\n client: queryClient,\n queryFlavor: 'React Query',\n version: '5',\n onlineManager,\n buttonPosition: 'bottom-left',\n position: 'bottom',\n initialIsOpen: true,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n onClose: props.onClose,\n }),\n )\n\n React.useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, devtools])\n\n React.useEffect(() => {\n devtools.setOnClose(props.onClose ?? (() => {}))\n }, [props.onClose, devtools])\n\n React.useEffect(() => {\n devtools.setErrorTypes(errorTypes || [])\n }, [errorTypes, devtools])\n\n React.useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return (\n <div\n style={{ height: '500px', ...props.style }}\n className=\"tsqd-parent-container\"\n ref={ref}\n ></div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,yBAA8C;AAC9C,4BAA2C;AAiFvC;AA7CG,SAAS,wBACd,OAC2B;AAC3B,QAAM,kBAAc,mCAAe,MAAM,MAAM;AAC/C,QAAM,MAAY,aAAuB,IAAI;AAC7C,QAAM,EAAE,YAAY,YAAY,gBAAgB,IAAI;AACpD,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,IAAI,iDAA2B;AAAA,MAC7B,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,MAAM;AAAA,IACjB,CAAC;AAAA,EACH;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,UAAU,WAAW;AAAA,EAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;AAE1B,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,MAAM,YAAY,MAAM;AAAA,IAAC,EAAE;AAAA,EACjD,GAAG,CAAC,MAAM,SAAS,QAAQ,CAAC;AAE5B,EAAM,gBAAU,MAAM;AACpB,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,EAAM,gBAAU,MAAM;AACpB,QAAI,IAAI,SAAS;AACf,eAAS,MAAM,IAAI,OAAO;AAAA,IAC5B;AAEA,WAAO,MAAM;AACX,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,QAAQ,SAAS,GAAG,MAAM,MAAM;AAAA,MACzC,WAAU;AAAA,MACV;AAAA;AAAA,EACD;AAEL;","names":[]}
@@ -0,0 +1,4 @@
1
+ import 'react';
2
+ import '@tanstack/query-devtools';
3
+ import '@tanstack/react-query';
4
+ export { a as DevtoolsPanelOptions, R as ReactQueryDevtoolsPanel } from './ReactQueryDevtoolsPanel-D9deyZtU.cjs';
@@ -0,0 +1,4 @@
1
+ import 'react';
2
+ import '@tanstack/query-devtools';
3
+ import '@tanstack/react-query';
4
+ export { a as DevtoolsPanelOptions, R as ReactQueryDevtoolsPanel } from './ReactQueryDevtoolsPanel-D9deyZtU.js';
@@ -0,0 +1,57 @@
1
+ "use client";
2
+
3
+ // src/ReactQueryDevtoolsPanel.tsx
4
+ import * as React from "react";
5
+ import { onlineManager, useQueryClient } from "@tanstack/react-query";
6
+ import { TanstackQueryDevtoolsPanel } from "@tanstack/query-devtools";
7
+ import { jsx } from "react/jsx-runtime";
8
+ function ReactQueryDevtoolsPanel(props) {
9
+ const queryClient = useQueryClient(props.client);
10
+ const ref = React.useRef(null);
11
+ const { errorTypes, styleNonce, shadowDOMTarget } = props;
12
+ const [devtools] = React.useState(
13
+ new TanstackQueryDevtoolsPanel({
14
+ client: queryClient,
15
+ queryFlavor: "React Query",
16
+ version: "5",
17
+ onlineManager,
18
+ buttonPosition: "bottom-left",
19
+ position: "bottom",
20
+ initialIsOpen: true,
21
+ errorTypes,
22
+ styleNonce,
23
+ shadowDOMTarget,
24
+ onClose: props.onClose
25
+ })
26
+ );
27
+ React.useEffect(() => {
28
+ devtools.setClient(queryClient);
29
+ }, [queryClient, devtools]);
30
+ React.useEffect(() => {
31
+ devtools.setOnClose(props.onClose ?? (() => {
32
+ }));
33
+ }, [props.onClose, devtools]);
34
+ React.useEffect(() => {
35
+ devtools.setErrorTypes(errorTypes || []);
36
+ }, [errorTypes, devtools]);
37
+ React.useEffect(() => {
38
+ if (ref.current) {
39
+ devtools.mount(ref.current);
40
+ }
41
+ return () => {
42
+ devtools.unmount();
43
+ };
44
+ }, [devtools]);
45
+ return /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ style: { height: "500px", ...props.style },
49
+ className: "tsqd-parent-container",
50
+ ref
51
+ }
52
+ );
53
+ }
54
+ export {
55
+ ReactQueryDevtoolsPanel
56
+ };
57
+ //# sourceMappingURL=ReactQueryDevtoolsPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ReactQueryDevtoolsPanel.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { onlineManager, useQueryClient } from '@tanstack/react-query'\nimport { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'\nimport type { DevtoolsErrorType } from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport interface DevtoolsPanelOptions {\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?: Array<DevtoolsErrorType>\n /**\n * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this so you can attach the devtool's styles to specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n\n /**\n * Custom styles for the devtools panel\n * @default { height: '500px' }\n * @example { height: '100%' }\n * @example { height: '100%', width: '100%' }\n */\n style?: React.CSSProperties\n\n /**\n * Callback function that is called when the devtools panel is closed\n */\n onClose?: () => unknown\n}\n\nexport function ReactQueryDevtoolsPanel(\n props: DevtoolsPanelOptions,\n): React.ReactElement | null {\n const queryClient = useQueryClient(props.client)\n const ref = React.useRef<HTMLDivElement>(null)\n const { errorTypes, styleNonce, shadowDOMTarget } = props\n const [devtools] = React.useState(\n new TanstackQueryDevtoolsPanel({\n client: queryClient,\n queryFlavor: 'React Query',\n version: '5',\n onlineManager,\n buttonPosition: 'bottom-left',\n position: 'bottom',\n initialIsOpen: true,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n onClose: props.onClose,\n }),\n )\n\n React.useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, devtools])\n\n React.useEffect(() => {\n devtools.setOnClose(props.onClose ?? (() => {}))\n }, [props.onClose, devtools])\n\n React.useEffect(() => {\n devtools.setErrorTypes(errorTypes || [])\n }, [errorTypes, devtools])\n\n React.useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return (\n <div\n style={{ height: '500px', ...props.style }}\n className=\"tsqd-parent-container\"\n ref={ref}\n ></div>\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB,SAAS,eAAe,sBAAsB;AAC9C,SAAS,kCAAkC;AAiFvC;AA7CG,SAAS,wBACd,OAC2B;AAC3B,QAAM,cAAc,eAAe,MAAM,MAAM;AAC/C,QAAM,MAAY,aAAuB,IAAI;AAC7C,QAAM,EAAE,YAAY,YAAY,gBAAgB,IAAI;AACpD,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,IAAI,2BAA2B;AAAA,MAC7B,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,MAAM;AAAA,IACjB,CAAC;AAAA,EACH;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,UAAU,WAAW;AAAA,EAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;AAE1B,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,MAAM,YAAY,MAAM;AAAA,IAAC,EAAE;AAAA,EACjD,GAAG,CAAC,MAAM,SAAS,QAAQ,CAAC;AAE5B,EAAM,gBAAU,MAAM;AACpB,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,EAAM,gBAAU,MAAM;AACpB,QAAI,IAAI,SAAS;AACf,eAAS,MAAM,IAAI,OAAO;AAAA,IAC5B;AAEA,WAAO,MAAM;AACX,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,QAAQ,SAAS,GAAG,MAAM,MAAM;AAAA,MACzC,WAAU;AAAA,MACV;AAAA;AAAA,EACD;AAEL;","names":[]}
@@ -31,15 +31,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/index.ts
32
32
  var src_exports = {};
33
33
  __export(src_exports, {
34
- ReactQueryDevtools: () => ReactQueryDevtools2
34
+ ReactQueryDevtools: () => ReactQueryDevtools2,
35
+ ReactQueryDevtoolsPanel: () => ReactQueryDevtoolsPanel2
35
36
  });
36
37
  module.exports = __toCommonJS(src_exports);
37
- var devtools = __toESM(require("./devtools.cjs"), 1);
38
+ var Devtools = __toESM(require("./ReactQueryDevtools.cjs"), 1);
39
+ var DevtoolsPanel = __toESM(require("./ReactQueryDevtoolsPanel.cjs"), 1);
38
40
  var ReactQueryDevtools2 = process.env.NODE_ENV !== "development" ? function() {
39
41
  return null;
40
- } : devtools.ReactQueryDevtools;
42
+ } : Devtools.ReactQueryDevtools;
43
+ var ReactQueryDevtoolsPanel2 = process.env.NODE_ENV !== "development" ? function() {
44
+ return null;
45
+ } : DevtoolsPanel.ReactQueryDevtoolsPanel;
41
46
  // Annotate the CommonJS export names for ESM import in node:
42
47
  0 && (module.exports = {
43
- ReactQueryDevtools
48
+ ReactQueryDevtools,
49
+ ReactQueryDevtoolsPanel
44
50
  });
45
51
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["'use client'\n\nimport * 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAAA;AAAA;AAAA;AAEA,eAA0B;AAEnB,IAAMA,sBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACS;","names":["ReactQueryDevtools"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["'use client'\n\nimport * as Devtools from './ReactQueryDevtools'\nimport * as DevtoolsPanel from './ReactQueryDevtoolsPanel'\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 DevtoolsPanel)['ReactQueryDevtoolsPanel'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : DevtoolsPanel.ReactQueryDevtoolsPanel\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,+BAAAC;AAAA;AAAA;AAEA,eAA0B;AAC1B,oBAA+B;AAExB,IAAMD,sBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACS;AAER,IAAMC,2BACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACc;","names":["ReactQueryDevtools","ReactQueryDevtoolsPanel"]}
@@ -1,8 +1,10 @@
1
- import { d as devtools } from './devtools-5wO_5H1h.cjs';
1
+ import { D as Devtools } from './ReactQueryDevtools-Cn7cKi7o.cjs';
2
+ import { D as DevtoolsPanel } from './ReactQueryDevtoolsPanel-D9deyZtU.cjs';
2
3
  import 'react';
3
4
  import '@tanstack/query-devtools';
4
5
  import '@tanstack/react-query';
5
6
 
6
- declare const ReactQueryDevtools: (typeof devtools)['ReactQueryDevtools'];
7
+ declare const ReactQueryDevtools: (typeof Devtools)['ReactQueryDevtools'];
8
+ declare const ReactQueryDevtoolsPanel: (typeof DevtoolsPanel)['ReactQueryDevtoolsPanel'];
7
9
 
8
- export { ReactQueryDevtools };
10
+ export { ReactQueryDevtools, ReactQueryDevtoolsPanel };
@@ -1,8 +1,10 @@
1
- import { d as devtools } from './devtools-5wO_5H1h.js';
1
+ import { D as Devtools } from './ReactQueryDevtools-Cn7cKi7o.js';
2
+ import { D as DevtoolsPanel } from './ReactQueryDevtoolsPanel-D9deyZtU.js';
2
3
  import 'react';
3
4
  import '@tanstack/query-devtools';
4
5
  import '@tanstack/react-query';
5
6
 
6
- declare const ReactQueryDevtools: (typeof devtools)['ReactQueryDevtools'];
7
+ declare const ReactQueryDevtools: (typeof Devtools)['ReactQueryDevtools'];
8
+ declare const ReactQueryDevtoolsPanel: (typeof DevtoolsPanel)['ReactQueryDevtoolsPanel'];
7
9
 
8
- export { ReactQueryDevtools };
10
+ export { ReactQueryDevtools, ReactQueryDevtoolsPanel };
@@ -1,11 +1,16 @@
1
1
  "use client";
2
2
 
3
3
  // src/index.ts
4
- import * as devtools from "./devtools.js";
4
+ import * as Devtools from "./ReactQueryDevtools.js";
5
+ import * as DevtoolsPanel from "./ReactQueryDevtoolsPanel.js";
5
6
  var ReactQueryDevtools2 = process.env.NODE_ENV !== "development" ? function() {
6
7
  return null;
7
- } : devtools.ReactQueryDevtools;
8
+ } : Devtools.ReactQueryDevtools;
9
+ var ReactQueryDevtoolsPanel2 = process.env.NODE_ENV !== "development" ? function() {
10
+ return null;
11
+ } : DevtoolsPanel.ReactQueryDevtoolsPanel;
8
12
  export {
9
- ReactQueryDevtools2 as ReactQueryDevtools
13
+ ReactQueryDevtools2 as ReactQueryDevtools,
14
+ ReactQueryDevtoolsPanel2 as ReactQueryDevtoolsPanel
10
15
  };
11
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["'use client'\n\nimport * 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"],"mappings":";;;AAEA,YAAY,cAAc;AAEnB,IAAMA,sBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACS;","names":["ReactQueryDevtools"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["'use client'\n\nimport * as Devtools from './ReactQueryDevtools'\nimport * as DevtoolsPanel from './ReactQueryDevtoolsPanel'\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 DevtoolsPanel)['ReactQueryDevtoolsPanel'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : DevtoolsPanel.ReactQueryDevtoolsPanel\n"],"mappings":";;;AAEA,YAAY,cAAc;AAC1B,YAAY,mBAAmB;AAExB,IAAMA,sBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACS;AAER,IAAMC,2BACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACc;","names":["ReactQueryDevtools","ReactQueryDevtoolsPanel"]}
@@ -31,13 +31,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/production.ts
32
32
  var production_exports = {};
33
33
  __export(production_exports, {
34
- ReactQueryDevtools: () => ReactQueryDevtools2
34
+ ReactQueryDevtools: () => ReactQueryDevtools2,
35
+ ReactQueryDevtoolsPanel: () => ReactQueryDevtoolsPanel2
35
36
  });
36
37
  module.exports = __toCommonJS(production_exports);
37
- var devtools = __toESM(require("./devtools.cjs"), 1);
38
- var ReactQueryDevtools2 = devtools.ReactQueryDevtools;
38
+ var Devtools = __toESM(require("./ReactQueryDevtools.cjs"), 1);
39
+ var DevtoolsPanel = __toESM(require("./ReactQueryDevtoolsPanel.cjs"), 1);
40
+ var ReactQueryDevtools2 = Devtools.ReactQueryDevtools;
41
+ var ReactQueryDevtoolsPanel2 = DevtoolsPanel.ReactQueryDevtoolsPanel;
39
42
  // Annotate the CommonJS export names for ESM import in node:
40
43
  0 && (module.exports = {
41
- ReactQueryDevtools
44
+ ReactQueryDevtools,
45
+ ReactQueryDevtoolsPanel
42
46
  });
43
47
  //# sourceMappingURL=production.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/production.ts"],"sourcesContent":["'use client'\n\nimport * as devtools from './devtools'\n\nexport const ReactQueryDevtools = devtools.ReactQueryDevtools\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAAA;AAAA;AAAA;AAEA,eAA0B;AAEnB,IAAMA,sBAA8B;","names":["ReactQueryDevtools"]}
1
+ {"version":3,"sources":["../../src/production.ts"],"sourcesContent":["'use client'\n\nimport * as Devtools from './ReactQueryDevtools'\nimport * as DevtoolsPanel from './ReactQueryDevtoolsPanel'\n\nexport const ReactQueryDevtools = Devtools.ReactQueryDevtools\nexport const ReactQueryDevtoolsPanel = DevtoolsPanel.ReactQueryDevtoolsPanel\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA,+BAAAC;AAAA;AAAA;AAEA,eAA0B;AAC1B,oBAA+B;AAExB,IAAMD,sBAA8B;AACpC,IAAMC,2BAAwC;","names":["ReactQueryDevtools","ReactQueryDevtoolsPanel"]}
@@ -1,8 +1,10 @@
1
- import { R as ReactQueryDevtools$1 } from './devtools-5wO_5H1h.cjs';
1
+ import { R as ReactQueryDevtools$1 } from './ReactQueryDevtools-Cn7cKi7o.cjs';
2
+ import { R as ReactQueryDevtoolsPanel$1 } from './ReactQueryDevtoolsPanel-D9deyZtU.cjs';
2
3
  import 'react';
3
4
  import '@tanstack/query-devtools';
4
5
  import '@tanstack/react-query';
5
6
 
6
7
  declare const ReactQueryDevtools: typeof ReactQueryDevtools$1;
8
+ declare const ReactQueryDevtoolsPanel: typeof ReactQueryDevtoolsPanel$1;
7
9
 
8
- export { ReactQueryDevtools };
10
+ export { ReactQueryDevtools, ReactQueryDevtoolsPanel };
@@ -1,8 +1,10 @@
1
- import { R as ReactQueryDevtools$1 } from './devtools-5wO_5H1h.js';
1
+ import { R as ReactQueryDevtools$1 } from './ReactQueryDevtools-Cn7cKi7o.js';
2
+ import { R as ReactQueryDevtoolsPanel$1 } from './ReactQueryDevtoolsPanel-D9deyZtU.js';
2
3
  import 'react';
3
4
  import '@tanstack/query-devtools';
4
5
  import '@tanstack/react-query';
5
6
 
6
7
  declare const ReactQueryDevtools: typeof ReactQueryDevtools$1;
8
+ declare const ReactQueryDevtoolsPanel: typeof ReactQueryDevtoolsPanel$1;
7
9
 
8
- export { ReactQueryDevtools };
10
+ export { ReactQueryDevtools, ReactQueryDevtoolsPanel };
@@ -1,9 +1,12 @@
1
1
  "use client";
2
2
 
3
3
  // src/production.ts
4
- import * as devtools from "./devtools.js";
5
- var ReactQueryDevtools2 = devtools.ReactQueryDevtools;
4
+ import * as Devtools from "./ReactQueryDevtools.js";
5
+ import * as DevtoolsPanel from "./ReactQueryDevtoolsPanel.js";
6
+ var ReactQueryDevtools2 = Devtools.ReactQueryDevtools;
7
+ var ReactQueryDevtoolsPanel2 = DevtoolsPanel.ReactQueryDevtoolsPanel;
6
8
  export {
7
- ReactQueryDevtools2 as ReactQueryDevtools
9
+ ReactQueryDevtools2 as ReactQueryDevtools,
10
+ ReactQueryDevtoolsPanel2 as ReactQueryDevtoolsPanel
8
11
  };
9
12
  //# sourceMappingURL=production.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/production.ts"],"sourcesContent":["'use client'\n\nimport * as devtools from './devtools'\n\nexport const ReactQueryDevtools = devtools.ReactQueryDevtools\n"],"mappings":";;;AAEA,YAAY,cAAc;AAEnB,IAAMA,sBAA8B;","names":["ReactQueryDevtools"]}
1
+ {"version":3,"sources":["../../src/production.ts"],"sourcesContent":["'use client'\n\nimport * as Devtools from './ReactQueryDevtools'\nimport * as DevtoolsPanel from './ReactQueryDevtoolsPanel'\n\nexport const ReactQueryDevtools = Devtools.ReactQueryDevtools\nexport const ReactQueryDevtoolsPanel = DevtoolsPanel.ReactQueryDevtoolsPanel\n"],"mappings":";;;AAEA,YAAY,cAAc;AAC1B,YAAY,mBAAmB;AAExB,IAAMA,sBAA8B;AACpC,IAAMC,2BAAwC;","names":["ReactQueryDevtools","ReactQueryDevtoolsPanel"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-query-devtools",
3
- "version": "5.53.3",
3
+ "version": "5.54.0",
4
4
  "description": "Developer tools to interact with and visualize the TanStack/react-query cache",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "src"
58
58
  ],
59
59
  "dependencies": {
60
- "@tanstack/query-devtools": "5.52.3"
60
+ "@tanstack/query-devtools": "5.54.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/react": "npm:types-react@rc",
@@ -0,0 +1,91 @@
1
+ 'use client'
2
+ import * as React from 'react'
3
+ import { onlineManager, useQueryClient } from '@tanstack/react-query'
4
+ import { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'
5
+ import type { DevtoolsErrorType } from '@tanstack/query-devtools'
6
+ import type { QueryClient } from '@tanstack/react-query'
7
+
8
+ export interface DevtoolsPanelOptions {
9
+ /**
10
+ * Custom instance of QueryClient
11
+ */
12
+ client?: QueryClient
13
+ /**
14
+ * Use this so you can define custom errors that can be shown in the devtools.
15
+ */
16
+ errorTypes?: Array<DevtoolsErrorType>
17
+ /**
18
+ * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
19
+ */
20
+ styleNonce?: string
21
+ /**
22
+ * Use this so you can attach the devtool's styles to specific element in the DOM.
23
+ */
24
+ shadowDOMTarget?: ShadowRoot
25
+
26
+ /**
27
+ * Custom styles for the devtools panel
28
+ * @default { height: '500px' }
29
+ * @example { height: '100%' }
30
+ * @example { height: '100%', width: '100%' }
31
+ */
32
+ style?: React.CSSProperties
33
+
34
+ /**
35
+ * Callback function that is called when the devtools panel is closed
36
+ */
37
+ onClose?: () => unknown
38
+ }
39
+
40
+ export function ReactQueryDevtoolsPanel(
41
+ props: DevtoolsPanelOptions,
42
+ ): React.ReactElement | null {
43
+ const queryClient = useQueryClient(props.client)
44
+ const ref = React.useRef<HTMLDivElement>(null)
45
+ const { errorTypes, styleNonce, shadowDOMTarget } = props
46
+ const [devtools] = React.useState(
47
+ new TanstackQueryDevtoolsPanel({
48
+ client: queryClient,
49
+ queryFlavor: 'React Query',
50
+ version: '5',
51
+ onlineManager,
52
+ buttonPosition: 'bottom-left',
53
+ position: 'bottom',
54
+ initialIsOpen: true,
55
+ errorTypes,
56
+ styleNonce,
57
+ shadowDOMTarget,
58
+ onClose: props.onClose,
59
+ }),
60
+ )
61
+
62
+ React.useEffect(() => {
63
+ devtools.setClient(queryClient)
64
+ }, [queryClient, devtools])
65
+
66
+ React.useEffect(() => {
67
+ devtools.setOnClose(props.onClose ?? (() => {}))
68
+ }, [props.onClose, devtools])
69
+
70
+ React.useEffect(() => {
71
+ devtools.setErrorTypes(errorTypes || [])
72
+ }, [errorTypes, devtools])
73
+
74
+ React.useEffect(() => {
75
+ if (ref.current) {
76
+ devtools.mount(ref.current)
77
+ }
78
+
79
+ return () => {
80
+ devtools.unmount()
81
+ }
82
+ }, [devtools])
83
+
84
+ return (
85
+ <div
86
+ style={{ height: '500px', ...props.style }}
87
+ className="tsqd-parent-container"
88
+ ref={ref}
89
+ ></div>
90
+ )
91
+ }
package/src/index.ts CHANGED
@@ -1,10 +1,18 @@
1
1
  'use client'
2
2
 
3
- import * as devtools from './devtools'
3
+ import * as Devtools from './ReactQueryDevtools'
4
+ import * as DevtoolsPanel from './ReactQueryDevtoolsPanel'
4
5
 
5
- export const ReactQueryDevtools: (typeof devtools)['ReactQueryDevtools'] =
6
+ export const ReactQueryDevtools: (typeof Devtools)['ReactQueryDevtools'] =
6
7
  process.env.NODE_ENV !== 'development'
7
8
  ? function () {
8
9
  return null
9
10
  }
10
- : devtools.ReactQueryDevtools
11
+ : Devtools.ReactQueryDevtools
12
+
13
+ export const ReactQueryDevtoolsPanel: (typeof DevtoolsPanel)['ReactQueryDevtoolsPanel'] =
14
+ process.env.NODE_ENV !== 'development'
15
+ ? function () {
16
+ return null
17
+ }
18
+ : DevtoolsPanel.ReactQueryDevtoolsPanel
package/src/production.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  'use client'
2
2
 
3
- import * as devtools from './devtools'
3
+ import * as Devtools from './ReactQueryDevtools'
4
+ import * as DevtoolsPanel from './ReactQueryDevtoolsPanel'
4
5
 
5
- export const ReactQueryDevtools = devtools.ReactQueryDevtools
6
+ export const ReactQueryDevtools = Devtools.ReactQueryDevtools
7
+ export const ReactQueryDevtoolsPanel = DevtoolsPanel.ReactQueryDevtoolsPanel
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/devtools.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { onlineManager, useQueryClient } from '@tanstack/react-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n} from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/react-query'\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-right'.\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?: Array<DevtoolsErrorType>\n /**\n * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this so you can attach the devtool's styles to specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n}\n\nexport function ReactQueryDevtools(\n props: DevtoolsOptions,\n): React.ReactElement | null {\n const queryClient = useQueryClient(props.client)\n const ref = React.useRef<HTMLDivElement>(null)\n const {\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n } = props\n const [devtools] = React.useState(\n new TanstackQueryDevtools({\n client: queryClient,\n queryFlavor: 'React Query',\n version: '5',\n onlineManager,\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n }),\n )\n\n React.useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, devtools])\n\n React.useEffect(() => {\n if (buttonPosition) {\n devtools.setButtonPosition(buttonPosition)\n }\n }, [buttonPosition, devtools])\n\n React.useEffect(() => {\n if (position) {\n devtools.setPosition(position)\n }\n }, [position, devtools])\n\n React.useEffect(() => {\n devtools.setInitialIsOpen(initialIsOpen || false)\n }, [initialIsOpen, devtools])\n\n React.useEffect(() => {\n devtools.setErrorTypes(errorTypes || [])\n }, [errorTypes, devtools])\n\n React.useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return <div className=\"tsqd-parent-container\" ref={ref}></div>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,yBAA8C;AAC9C,4BAAsC;AAyG7B;AA9DF,SAAS,mBACd,OAC2B;AAC3B,QAAM,kBAAc,mCAAe,MAAM,MAAM;AAC/C,QAAM,MAAY,aAAuB,IAAI;AAC7C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,IAAI,4CAAsB;AAAA,MACxB,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,UAAU,WAAW;AAAA,EAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;AAE1B,EAAM,gBAAU,MAAM;AACpB,QAAI,gBAAgB;AAClB,eAAS,kBAAkB,cAAc;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,gBAAgB,QAAQ,CAAC;AAE7B,EAAM,gBAAU,MAAM;AACpB,QAAI,UAAU;AACZ,eAAS,YAAY,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,EAAM,gBAAU,MAAM;AACpB,aAAS,iBAAiB,iBAAiB,KAAK;AAAA,EAClD,GAAG,CAAC,eAAe,QAAQ,CAAC;AAE5B,EAAM,gBAAU,MAAM;AACpB,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,EAAM,gBAAU,MAAM;AACpB,QAAI,IAAI,SAAS;AACf,eAAS,MAAM,IAAI,OAAO;AAAA,IAC5B;AAEA,WAAO,MAAM;AACX,eAAS,QAAQ;AAAA,IACnB;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO,4CAAC,SAAI,WAAU,yBAAwB,KAAU;AAC1D;","names":[]}
@@ -1,4 +0,0 @@
1
- import 'react';
2
- import '@tanstack/query-devtools';
3
- import '@tanstack/react-query';
4
- export { D as DevtoolsOptions, R as ReactQueryDevtools } from './devtools-5wO_5H1h.cjs';
@@ -1,4 +0,0 @@
1
- import 'react';
2
- import '@tanstack/query-devtools';
3
- import '@tanstack/react-query';
4
- export { D as DevtoolsOptions, R as ReactQueryDevtools } from './devtools-5wO_5H1h.js';