@tanstack/react-query-devtools 5.0.0-alpha.9 → 5.0.0-alpha.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/devtools-d8b99e07.d.ts +42 -0
- package/build/legacy/devtools.cjs +91 -0
- package/build/legacy/devtools.cjs.map +1 -0
- package/build/legacy/devtools.d.cts +4 -0
- package/build/legacy/devtools.d.ts +4 -0
- package/build/legacy/devtools.js +57 -0
- package/build/legacy/devtools.js.map +1 -0
- package/build/legacy/index.cjs +45 -0
- package/build/legacy/index.cjs.map +1 -0
- package/build/legacy/index.d.cts +8 -0
- package/build/legacy/index.d.ts +8 -0
- package/build/legacy/index.js +11 -0
- package/build/legacy/index.js.map +1 -0
- package/build/legacy/production.cjs +43 -0
- package/build/legacy/production.cjs.map +1 -0
- package/build/legacy/production.d.cts +8 -0
- package/build/legacy/production.d.ts +8 -0
- package/build/legacy/production.js +9 -0
- package/build/legacy/production.js.map +1 -0
- package/build/modern/devtools-d8b99e07.d.ts +42 -0
- package/build/modern/devtools.cjs +91 -0
- package/build/modern/devtools.cjs.map +1 -0
- package/build/modern/devtools.d.cts +4 -0
- package/build/modern/devtools.d.ts +4 -0
- package/build/modern/devtools.js +57 -0
- package/build/modern/devtools.js.map +1 -0
- package/build/modern/index.cjs +45 -0
- package/build/modern/index.cjs.map +1 -0
- package/build/modern/index.d.cts +8 -0
- package/build/modern/index.d.ts +8 -0
- package/build/modern/index.js +11 -0
- package/build/modern/index.js.map +1 -0
- package/build/modern/production.cjs +43 -0
- package/build/modern/production.cjs.map +1 -0
- package/build/modern/production.d.cts +8 -0
- package/build/modern/production.d.ts +8 -0
- package/build/modern/production.js +9 -0
- package/build/modern/production.js.map +1 -0
- package/package.json +32 -27
- package/src/__tests__/devtools.test.tsx +1 -1009
- package/src/__tests__/utils.tsx +4 -4
- package/src/devtools.tsx +59 -1309
- package/src/index.ts +0 -7
- package/src/production.ts +5 -0
- package/build/lib/Explorer.d.ts +0 -50
- package/build/lib/Explorer.esm.js +0 -254
- package/build/lib/Explorer.esm.js.map +0 -1
- package/build/lib/Explorer.js +0 -288
- package/build/lib/Explorer.js.map +0 -1
- package/build/lib/Explorer.mjs +0 -254
- package/build/lib/Explorer.mjs.map +0 -1
- package/build/lib/Logo.d.ts +0 -1
- package/build/lib/Logo.esm.js +0 -32
- package/build/lib/Logo.esm.js.map +0 -1
- package/build/lib/Logo.js +0 -55
- package/build/lib/Logo.js.map +0 -1
- package/build/lib/Logo.mjs +0 -32
- package/build/lib/Logo.mjs.map +0 -1
- package/build/lib/__tests__/Explorer.test.d.ts +0 -1
- package/build/lib/__tests__/devtools.test.d.ts +0 -1
- package/build/lib/__tests__/utils.d.ts +0 -22
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +0 -17
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +0 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js +0 -19
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +0 -17
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +0 -1
- package/build/lib/devtools.d.ts +0 -113
- package/build/lib/devtools.esm.js +0 -900
- package/build/lib/devtools.esm.js.map +0 -1
- package/build/lib/devtools.js +0 -921
- package/build/lib/devtools.js.map +0 -1
- package/build/lib/devtools.mjs +0 -869
- package/build/lib/devtools.mjs.map +0 -1
- package/build/lib/index.d.ts +0 -3
- package/build/lib/index.esm.js +0 -12
- package/build/lib/index.esm.js.map +0 -1
- package/build/lib/index.js +0 -15
- package/build/lib/index.js.map +0 -1
- package/build/lib/index.mjs +0 -12
- package/build/lib/index.mjs.map +0 -1
- package/build/lib/index.prod.d.ts +0 -3
- package/build/lib/index.prod.esm.js +0 -1559
- package/build/lib/index.prod.esm.js.map +0 -1
- package/build/lib/index.prod.js +0 -1580
- package/build/lib/index.prod.js.map +0 -1
- package/build/lib/index.prod.mjs +0 -1528
- package/build/lib/index.prod.mjs.map +0 -1
- package/build/lib/noop.d.ts +0 -2
- package/build/lib/screenreader.d.ts +0 -3
- package/build/lib/screenreader.esm.js +0 -17
- package/build/lib/screenreader.esm.js.map +0 -1
- package/build/lib/screenreader.js +0 -40
- package/build/lib/screenreader.js.map +0 -1
- package/build/lib/screenreader.mjs +0 -17
- package/build/lib/screenreader.mjs.map +0 -1
- package/build/lib/styledComponents.d.ts +0 -8
- package/build/lib/styledComponents.esm.js +0 -95
- package/build/lib/styledComponents.esm.js.map +0 -1
- package/build/lib/styledComponents.js +0 -104
- package/build/lib/styledComponents.js.map +0 -1
- package/build/lib/styledComponents.mjs +0 -95
- package/build/lib/styledComponents.mjs.map +0 -1
- package/build/lib/theme.d.ts +0 -36
- package/build/lib/theme.esm.js +0 -33
- package/build/lib/theme.esm.js.map +0 -1
- package/build/lib/theme.js +0 -56
- package/build/lib/theme.js.map +0 -1
- package/build/lib/theme.mjs +0 -33
- package/build/lib/theme.mjs.map +0 -1
- package/build/lib/useLocalStorage.d.ts +0 -1
- package/build/lib/useLocalStorage.esm.js +0 -40
- package/build/lib/useLocalStorage.esm.js.map +0 -1
- package/build/lib/useLocalStorage.js +0 -63
- package/build/lib/useLocalStorage.js.map +0 -1
- package/build/lib/useLocalStorage.mjs +0 -40
- package/build/lib/useLocalStorage.mjs.map +0 -1
- package/build/lib/useMediaQuery.d.ts +0 -1
- package/build/lib/useMediaQuery.esm.js +0 -36
- package/build/lib/useMediaQuery.esm.js.map +0 -1
- package/build/lib/useMediaQuery.js +0 -59
- package/build/lib/useMediaQuery.js.map +0 -1
- package/build/lib/useMediaQuery.mjs +0 -36
- package/build/lib/useMediaQuery.mjs.map +0 -1
- package/build/lib/utils.d.ts +0 -79
- package/build/lib/utils.esm.js +0 -184
- package/build/lib/utils.esm.js.map +0 -1
- package/build/lib/utils.js +0 -218
- package/build/lib/utils.js.map +0 -1
- package/build/lib/utils.mjs +0 -184
- package/build/lib/utils.mjs.map +0 -1
- package/build/umd/index.development.js +0 -3195
- package/build/umd/index.development.js.map +0 -1
- package/build/umd/index.production.js +0 -2
- package/build/umd/index.production.js.map +0 -1
- package/src/Explorer.tsx +0 -385
- package/src/Logo.tsx +0 -32
- package/src/__tests__/Explorer.test.tsx +0 -150
- package/src/noop.ts +0 -7
- package/src/screenreader.tsx +0 -16
- package/src/styledComponents.ts +0 -110
- package/src/theme.tsx +0 -33
- package/src/useLocalStorage.ts +0 -52
- package/src/useMediaQuery.ts +0 -34
- package/src/utils.ts +0 -319
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DevtoolsButtonPosition, DevtoolsPosition, DevToolsErrorType } from '@tanstack/query-devtools';
|
|
3
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
+
|
|
5
|
+
interface DevtoolsOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Set this true if you want the dev tools to default to being open
|
|
8
|
+
*/
|
|
9
|
+
initialIsOpen?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The position of the React Query logo to open and close the devtools panel.
|
|
12
|
+
* 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
13
|
+
* Defaults to 'bottom-left'.
|
|
14
|
+
*/
|
|
15
|
+
buttonPosition?: DevtoolsButtonPosition;
|
|
16
|
+
/**
|
|
17
|
+
* The position of the React Query devtools panel.
|
|
18
|
+
* 'top' | 'bottom' | 'left' | 'right'
|
|
19
|
+
* Defaults to 'bottom'.
|
|
20
|
+
*/
|
|
21
|
+
position?: DevtoolsPosition;
|
|
22
|
+
/**
|
|
23
|
+
* Custom instance of QueryClient
|
|
24
|
+
*/
|
|
25
|
+
client?: QueryClient;
|
|
26
|
+
/**
|
|
27
|
+
* Use this so you can define custom errors that can be shown in the devtools.
|
|
28
|
+
*/
|
|
29
|
+
errorTypes?: DevToolsErrorType[];
|
|
30
|
+
}
|
|
31
|
+
declare function ReactQueryDevtools(props: DevtoolsOptions): React.ReactElement | null;
|
|
32
|
+
|
|
33
|
+
type devtools_DevtoolsOptions = DevtoolsOptions;
|
|
34
|
+
declare const devtools_ReactQueryDevtools: typeof ReactQueryDevtools;
|
|
35
|
+
declare namespace devtools {
|
|
36
|
+
export {
|
|
37
|
+
devtools_DevtoolsOptions as DevtoolsOptions,
|
|
38
|
+
devtools_ReactQueryDevtools as ReactQueryDevtools,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { DevtoolsOptions as D, ReactQueryDevtools as R, devtools as d };
|
|
@@ -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/devtools.tsx
|
|
32
|
+
var devtools_exports = {};
|
|
33
|
+
__export(devtools_exports, {
|
|
34
|
+
ReactQueryDevtools: () => ReactQueryDevtools
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(devtools_exports);
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_react_query = require("@tanstack/react-query");
|
|
39
|
+
var import_query_devtools = require("@tanstack/query-devtools");
|
|
40
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
41
|
+
function ReactQueryDevtools(props) {
|
|
42
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
43
|
+
const client = props.client || queryClient;
|
|
44
|
+
const ref = (0, import_react.useRef)(null);
|
|
45
|
+
const { buttonPosition, position, initialIsOpen, errorTypes } = props;
|
|
46
|
+
const [devtools] = (0, import_react.useState)(
|
|
47
|
+
new import_query_devtools.TanstackQueryDevtools({
|
|
48
|
+
client,
|
|
49
|
+
queryFlavor: "React Query",
|
|
50
|
+
version: "5",
|
|
51
|
+
onlineManager: import_react_query.onlineManager,
|
|
52
|
+
buttonPosition,
|
|
53
|
+
position,
|
|
54
|
+
initialIsOpen,
|
|
55
|
+
errorTypes
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
(0, import_react.useEffect)(() => {
|
|
59
|
+
devtools.setClient(client);
|
|
60
|
+
}, [client, devtools]);
|
|
61
|
+
(0, import_react.useEffect)(() => {
|
|
62
|
+
if (buttonPosition) {
|
|
63
|
+
devtools.setButtonPosition(buttonPosition);
|
|
64
|
+
}
|
|
65
|
+
}, [buttonPosition, devtools]);
|
|
66
|
+
(0, import_react.useEffect)(() => {
|
|
67
|
+
if (position) {
|
|
68
|
+
devtools.setPosition(position);
|
|
69
|
+
}
|
|
70
|
+
}, [position, devtools]);
|
|
71
|
+
(0, import_react.useEffect)(() => {
|
|
72
|
+
devtools.setInitialIsOpen(initialIsOpen || false);
|
|
73
|
+
}, [initialIsOpen, devtools]);
|
|
74
|
+
(0, import_react.useEffect)(() => {
|
|
75
|
+
devtools.setErrorTypes(errorTypes || []);
|
|
76
|
+
}, [errorTypes, devtools]);
|
|
77
|
+
(0, import_react.useEffect)(() => {
|
|
78
|
+
if (ref.current) {
|
|
79
|
+
devtools.mount(ref.current);
|
|
80
|
+
}
|
|
81
|
+
return () => {
|
|
82
|
+
devtools.unmount();
|
|
83
|
+
};
|
|
84
|
+
}, [devtools]);
|
|
85
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", { ref });
|
|
86
|
+
}
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
ReactQueryDevtools
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=devtools.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/devtools.tsx"],"sourcesContent":["'use client'\nimport { useEffect, useRef, useState } from 'react'\nimport { onlineManager, useQueryClient } from '@tanstack/react-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport React from 'react'\nimport type {\n DevToolsErrorType,\n DevtoolsButtonPosition,\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-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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4C;AAC5C,yBAA8C;AAC9C,4BAAsC;AACtC,IAAAA,gBAAkB;AAmCX,SAAS,mBACd,OAC2B;AAC3B,QAAM,kBAAc,mCAAe;AACnC,QAAM,SAAS,MAAM,UAAU;AAC/B,QAAM,UAAM,qBAAuB,IAAI;AACvC,QAAM,EAAE,gBAAgB,UAAU,eAAe,WAAW,IAAI;AAChE,QAAM,CAAC,QAAQ,QAAI;AAAA,IACjB,IAAI,4CAAsB;AAAA,MACxB;AAAA,MACA,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,8BAAU,MAAM;AACd,aAAS,UAAU,MAAM;AAAA,EAC3B,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,8BAAU,MAAM;AACd,QAAI,gBAAgB;AAClB,eAAS,kBAAkB,cAAc;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,gBAAgB,QAAQ,CAAC;AAE7B,8BAAU,MAAM;AACd,QAAI,UAAU;AACZ,eAAS,YAAY,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,8BAAU,MAAM;AACd,aAAS,iBAAiB,iBAAiB,KAAK;AAAA,EAClD,GAAG,CAAC,eAAe,QAAQ,CAAC;AAE5B,8BAAU,MAAM;AACd,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,8BAAU,MAAM;AACd,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,8BAAAC,QAAA,cAAC,SAAI,KAAU;AACxB;","names":["import_react","React"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/devtools.tsx
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { onlineManager, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { TanstackQueryDevtools } from "@tanstack/query-devtools";
|
|
7
|
+
import React from "react";
|
|
8
|
+
function ReactQueryDevtools(props) {
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const client = props.client || queryClient;
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const { buttonPosition, position, initialIsOpen, errorTypes } = props;
|
|
13
|
+
const [devtools] = useState(
|
|
14
|
+
new TanstackQueryDevtools({
|
|
15
|
+
client,
|
|
16
|
+
queryFlavor: "React Query",
|
|
17
|
+
version: "5",
|
|
18
|
+
onlineManager,
|
|
19
|
+
buttonPosition,
|
|
20
|
+
position,
|
|
21
|
+
initialIsOpen,
|
|
22
|
+
errorTypes
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
devtools.setClient(client);
|
|
27
|
+
}, [client, devtools]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (buttonPosition) {
|
|
30
|
+
devtools.setButtonPosition(buttonPosition);
|
|
31
|
+
}
|
|
32
|
+
}, [buttonPosition, devtools]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (position) {
|
|
35
|
+
devtools.setPosition(position);
|
|
36
|
+
}
|
|
37
|
+
}, [position, devtools]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
devtools.setInitialIsOpen(initialIsOpen || false);
|
|
40
|
+
}, [initialIsOpen, devtools]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
devtools.setErrorTypes(errorTypes || []);
|
|
43
|
+
}, [errorTypes, devtools]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (ref.current) {
|
|
46
|
+
devtools.mount(ref.current);
|
|
47
|
+
}
|
|
48
|
+
return () => {
|
|
49
|
+
devtools.unmount();
|
|
50
|
+
};
|
|
51
|
+
}, [devtools]);
|
|
52
|
+
return /* @__PURE__ */ React.createElement("div", { ref });
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
ReactQueryDevtools
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=devtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/devtools.tsx"],"sourcesContent":["'use client'\nimport { useEffect, useRef, useState } from 'react'\nimport { onlineManager, useQueryClient } from '@tanstack/react-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport React from 'react'\nimport type {\n DevToolsErrorType,\n DevtoolsButtonPosition,\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-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"],"mappings":";;;AACA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,eAAe,sBAAsB;AAC9C,SAAS,6BAA6B;AACtC,OAAO,WAAW;AAmCX,SAAS,mBACd,OAC2B;AAC3B,QAAM,cAAc,eAAe;AACnC,QAAM,SAAS,MAAM,UAAU;AAC/B,QAAM,MAAM,OAAuB,IAAI;AACvC,QAAM,EAAE,gBAAgB,UAAU,eAAe,WAAW,IAAI;AAChE,QAAM,CAAC,QAAQ,IAAI;AAAA,IACjB,IAAI,sBAAsB;AAAA,MACxB;AAAA,MACA,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,YAAU,MAAM;AACd,aAAS,UAAU,MAAM;AAAA,EAC3B,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,YAAU,MAAM;AACd,QAAI,gBAAgB;AAClB,eAAS,kBAAkB,cAAc;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,gBAAgB,QAAQ,CAAC;AAE7B,YAAU,MAAM;AACd,QAAI,UAAU;AACZ,eAAS,YAAY,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,YAAU,MAAM;AACd,aAAS,iBAAiB,iBAAiB,KAAK;AAAA,EAClD,GAAG,CAAC,eAAe,QAAQ,CAAC;AAE5B,YAAU,MAAM;AACd,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,YAAU,MAAM;AACd,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,oCAAC,SAAI,KAAU;AACxB;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
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/index.ts
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
ReactQueryDevtools: () => ReactQueryDevtools2
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
var devtools = __toESM(require("./devtools.cjs"), 1);
|
|
38
|
+
var ReactQueryDevtools2 = process.env.NODE_ENV !== "development" ? function() {
|
|
39
|
+
return null;
|
|
40
|
+
} : devtools.ReactQueryDevtools;
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
ReactQueryDevtools
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import * as devtools from "./devtools.js";
|
|
5
|
+
var ReactQueryDevtools2 = process.env.NODE_ENV !== "development" ? function() {
|
|
6
|
+
return null;
|
|
7
|
+
} : devtools.ReactQueryDevtools;
|
|
8
|
+
export {
|
|
9
|
+
ReactQueryDevtools2 as ReactQueryDevtools
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
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/production.ts
|
|
32
|
+
var production_exports = {};
|
|
33
|
+
__export(production_exports, {
|
|
34
|
+
ReactQueryDevtools: () => ReactQueryDevtools2
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(production_exports);
|
|
37
|
+
var devtools = __toESM(require("./devtools.cjs"), 1);
|
|
38
|
+
var ReactQueryDevtools2 = devtools.ReactQueryDevtools;
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
ReactQueryDevtools
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=production.cjs.map
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +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"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DevtoolsButtonPosition, DevtoolsPosition, DevToolsErrorType } from '@tanstack/query-devtools';
|
|
3
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
+
|
|
5
|
+
interface DevtoolsOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Set this true if you want the dev tools to default to being open
|
|
8
|
+
*/
|
|
9
|
+
initialIsOpen?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The position of the React Query logo to open and close the devtools panel.
|
|
12
|
+
* 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
13
|
+
* Defaults to 'bottom-left'.
|
|
14
|
+
*/
|
|
15
|
+
buttonPosition?: DevtoolsButtonPosition;
|
|
16
|
+
/**
|
|
17
|
+
* The position of the React Query devtools panel.
|
|
18
|
+
* 'top' | 'bottom' | 'left' | 'right'
|
|
19
|
+
* Defaults to 'bottom'.
|
|
20
|
+
*/
|
|
21
|
+
position?: DevtoolsPosition;
|
|
22
|
+
/**
|
|
23
|
+
* Custom instance of QueryClient
|
|
24
|
+
*/
|
|
25
|
+
client?: QueryClient;
|
|
26
|
+
/**
|
|
27
|
+
* Use this so you can define custom errors that can be shown in the devtools.
|
|
28
|
+
*/
|
|
29
|
+
errorTypes?: DevToolsErrorType[];
|
|
30
|
+
}
|
|
31
|
+
declare function ReactQueryDevtools(props: DevtoolsOptions): React.ReactElement | null;
|
|
32
|
+
|
|
33
|
+
type devtools_DevtoolsOptions = DevtoolsOptions;
|
|
34
|
+
declare const devtools_ReactQueryDevtools: typeof ReactQueryDevtools;
|
|
35
|
+
declare namespace devtools {
|
|
36
|
+
export {
|
|
37
|
+
devtools_DevtoolsOptions as DevtoolsOptions,
|
|
38
|
+
devtools_ReactQueryDevtools as ReactQueryDevtools,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { DevtoolsOptions as D, ReactQueryDevtools as R, devtools as d };
|
|
@@ -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/devtools.tsx
|
|
32
|
+
var devtools_exports = {};
|
|
33
|
+
__export(devtools_exports, {
|
|
34
|
+
ReactQueryDevtools: () => ReactQueryDevtools
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(devtools_exports);
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_react_query = require("@tanstack/react-query");
|
|
39
|
+
var import_query_devtools = require("@tanstack/query-devtools");
|
|
40
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
41
|
+
function ReactQueryDevtools(props) {
|
|
42
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
43
|
+
const client = props.client || queryClient;
|
|
44
|
+
const ref = (0, import_react.useRef)(null);
|
|
45
|
+
const { buttonPosition, position, initialIsOpen, errorTypes } = props;
|
|
46
|
+
const [devtools] = (0, import_react.useState)(
|
|
47
|
+
new import_query_devtools.TanstackQueryDevtools({
|
|
48
|
+
client,
|
|
49
|
+
queryFlavor: "React Query",
|
|
50
|
+
version: "5",
|
|
51
|
+
onlineManager: import_react_query.onlineManager,
|
|
52
|
+
buttonPosition,
|
|
53
|
+
position,
|
|
54
|
+
initialIsOpen,
|
|
55
|
+
errorTypes
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
(0, import_react.useEffect)(() => {
|
|
59
|
+
devtools.setClient(client);
|
|
60
|
+
}, [client, devtools]);
|
|
61
|
+
(0, import_react.useEffect)(() => {
|
|
62
|
+
if (buttonPosition) {
|
|
63
|
+
devtools.setButtonPosition(buttonPosition);
|
|
64
|
+
}
|
|
65
|
+
}, [buttonPosition, devtools]);
|
|
66
|
+
(0, import_react.useEffect)(() => {
|
|
67
|
+
if (position) {
|
|
68
|
+
devtools.setPosition(position);
|
|
69
|
+
}
|
|
70
|
+
}, [position, devtools]);
|
|
71
|
+
(0, import_react.useEffect)(() => {
|
|
72
|
+
devtools.setInitialIsOpen(initialIsOpen || false);
|
|
73
|
+
}, [initialIsOpen, devtools]);
|
|
74
|
+
(0, import_react.useEffect)(() => {
|
|
75
|
+
devtools.setErrorTypes(errorTypes || []);
|
|
76
|
+
}, [errorTypes, devtools]);
|
|
77
|
+
(0, import_react.useEffect)(() => {
|
|
78
|
+
if (ref.current) {
|
|
79
|
+
devtools.mount(ref.current);
|
|
80
|
+
}
|
|
81
|
+
return () => {
|
|
82
|
+
devtools.unmount();
|
|
83
|
+
};
|
|
84
|
+
}, [devtools]);
|
|
85
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", { ref });
|
|
86
|
+
}
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {
|
|
89
|
+
ReactQueryDevtools
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=devtools.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/devtools.tsx"],"sourcesContent":["'use client'\nimport { useEffect, useRef, useState } from 'react'\nimport { onlineManager, useQueryClient } from '@tanstack/react-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport React from 'react'\nimport type {\n DevToolsErrorType,\n DevtoolsButtonPosition,\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-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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA4C;AAC5C,yBAA8C;AAC9C,4BAAsC;AACtC,IAAAA,gBAAkB;AAmCX,SAAS,mBACd,OAC2B;AAC3B,QAAM,kBAAc,mCAAe;AACnC,QAAM,SAAS,MAAM,UAAU;AAC/B,QAAM,UAAM,qBAAuB,IAAI;AACvC,QAAM,EAAE,gBAAgB,UAAU,eAAe,WAAW,IAAI;AAChE,QAAM,CAAC,QAAQ,QAAI;AAAA,IACjB,IAAI,4CAAsB;AAAA,MACxB;AAAA,MACA,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,8BAAU,MAAM;AACd,aAAS,UAAU,MAAM;AAAA,EAC3B,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,8BAAU,MAAM;AACd,QAAI,gBAAgB;AAClB,eAAS,kBAAkB,cAAc;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,gBAAgB,QAAQ,CAAC;AAE7B,8BAAU,MAAM;AACd,QAAI,UAAU;AACZ,eAAS,YAAY,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,8BAAU,MAAM;AACd,aAAS,iBAAiB,iBAAiB,KAAK;AAAA,EAClD,GAAG,CAAC,eAAe,QAAQ,CAAC;AAE5B,8BAAU,MAAM;AACd,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,8BAAU,MAAM;AACd,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,8BAAAC,QAAA,cAAC,SAAI,KAAU;AACxB;","names":["import_react","React"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/devtools.tsx
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { onlineManager, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { TanstackQueryDevtools } from "@tanstack/query-devtools";
|
|
7
|
+
import React from "react";
|
|
8
|
+
function ReactQueryDevtools(props) {
|
|
9
|
+
const queryClient = useQueryClient();
|
|
10
|
+
const client = props.client || queryClient;
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const { buttonPosition, position, initialIsOpen, errorTypes } = props;
|
|
13
|
+
const [devtools] = useState(
|
|
14
|
+
new TanstackQueryDevtools({
|
|
15
|
+
client,
|
|
16
|
+
queryFlavor: "React Query",
|
|
17
|
+
version: "5",
|
|
18
|
+
onlineManager,
|
|
19
|
+
buttonPosition,
|
|
20
|
+
position,
|
|
21
|
+
initialIsOpen,
|
|
22
|
+
errorTypes
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
devtools.setClient(client);
|
|
27
|
+
}, [client, devtools]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (buttonPosition) {
|
|
30
|
+
devtools.setButtonPosition(buttonPosition);
|
|
31
|
+
}
|
|
32
|
+
}, [buttonPosition, devtools]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (position) {
|
|
35
|
+
devtools.setPosition(position);
|
|
36
|
+
}
|
|
37
|
+
}, [position, devtools]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
devtools.setInitialIsOpen(initialIsOpen || false);
|
|
40
|
+
}, [initialIsOpen, devtools]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
devtools.setErrorTypes(errorTypes || []);
|
|
43
|
+
}, [errorTypes, devtools]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (ref.current) {
|
|
46
|
+
devtools.mount(ref.current);
|
|
47
|
+
}
|
|
48
|
+
return () => {
|
|
49
|
+
devtools.unmount();
|
|
50
|
+
};
|
|
51
|
+
}, [devtools]);
|
|
52
|
+
return /* @__PURE__ */ React.createElement("div", { ref });
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
ReactQueryDevtools
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=devtools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/devtools.tsx"],"sourcesContent":["'use client'\nimport { useEffect, useRef, useState } from 'react'\nimport { onlineManager, useQueryClient } from '@tanstack/react-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport React from 'react'\nimport type {\n DevToolsErrorType,\n DevtoolsButtonPosition,\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-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"],"mappings":";;;AACA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,eAAe,sBAAsB;AAC9C,SAAS,6BAA6B;AACtC,OAAO,WAAW;AAmCX,SAAS,mBACd,OAC2B;AAC3B,QAAM,cAAc,eAAe;AACnC,QAAM,SAAS,MAAM,UAAU;AAC/B,QAAM,MAAM,OAAuB,IAAI;AACvC,QAAM,EAAE,gBAAgB,UAAU,eAAe,WAAW,IAAI;AAChE,QAAM,CAAC,QAAQ,IAAI;AAAA,IACjB,IAAI,sBAAsB;AAAA,MACxB;AAAA,MACA,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,YAAU,MAAM;AACd,aAAS,UAAU,MAAM;AAAA,EAC3B,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,YAAU,MAAM;AACd,QAAI,gBAAgB;AAClB,eAAS,kBAAkB,cAAc;AAAA,IAC3C;AAAA,EACF,GAAG,CAAC,gBAAgB,QAAQ,CAAC;AAE7B,YAAU,MAAM;AACd,QAAI,UAAU;AACZ,eAAS,YAAY,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,CAAC;AAEvB,YAAU,MAAM;AACd,aAAS,iBAAiB,iBAAiB,KAAK;AAAA,EAClD,GAAG,CAAC,eAAe,QAAQ,CAAC;AAE5B,YAAU,MAAM;AACd,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,YAAU,MAAM;AACd,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,oCAAC,SAAI,KAAU;AACxB;","names":[]}
|