@tanstack/preact-query-devtools 5.101.4 → 5.102.1
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/PreactQueryDevtools.cjs +55 -92
- package/build/legacy/PreactQueryDevtools.cjs.map +1 -1
- package/build/legacy/PreactQueryDevtools.d.cts +56 -2
- package/build/legacy/PreactQueryDevtools.d.cts.map +1 -0
- package/build/legacy/PreactQueryDevtools.d.ts +56 -2
- package/build/legacy/PreactQueryDevtools.d.ts.map +1 -0
- package/build/legacy/PreactQueryDevtools.js +51 -64
- package/build/legacy/PreactQueryDevtools.js.map +1 -1
- package/build/legacy/PreactQueryDevtoolsPanel.cjs +53 -88
- package/build/legacy/PreactQueryDevtoolsPanel.cjs.map +1 -1
- package/build/legacy/PreactQueryDevtoolsPanel.d.cts +48 -2
- package/build/legacy/PreactQueryDevtoolsPanel.d.cts.map +1 -0
- package/build/legacy/PreactQueryDevtoolsPanel.d.ts +48 -2
- package/build/legacy/PreactQueryDevtoolsPanel.d.ts.map +1 -0
- package/build/legacy/PreactQueryDevtoolsPanel.js +49 -60
- package/build/legacy/PreactQueryDevtoolsPanel.js.map +1 -1
- package/build/legacy/index.cjs +13 -48
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +9 -3
- package/build/legacy/index.d.cts.map +1 -0
- package/build/legacy/index.d.ts +9 -3
- package/build/legacy/index.d.ts.map +1 -0
- package/build/legacy/index.js +12 -13
- package/build/legacy/index.js.map +1 -1
- package/build/legacy/production.cjs +9 -44
- package/build/legacy/production.cjs.map +1 -1
- package/build/legacy/production.d.cts +8 -2
- package/build/legacy/production.d.cts.map +1 -0
- package/build/legacy/production.d.ts +8 -2
- package/build/legacy/production.d.ts.map +1 -0
- package/build/legacy/production.js +8 -9
- package/build/legacy/production.js.map +1 -1
- package/build/legacy/rolldown-runtime-D7D4PA-g.js +13 -0
- package/build/modern/PreactQueryDevtools.cjs +55 -92
- package/build/modern/PreactQueryDevtools.cjs.map +1 -1
- package/build/modern/PreactQueryDevtools.d.cts +56 -2
- package/build/modern/PreactQueryDevtools.d.cts.map +1 -0
- package/build/modern/PreactQueryDevtools.d.ts +56 -2
- package/build/modern/PreactQueryDevtools.d.ts.map +1 -0
- package/build/modern/PreactQueryDevtools.js +51 -64
- package/build/modern/PreactQueryDevtools.js.map +1 -1
- package/build/modern/PreactQueryDevtoolsPanel.cjs +53 -88
- package/build/modern/PreactQueryDevtoolsPanel.cjs.map +1 -1
- package/build/modern/PreactQueryDevtoolsPanel.d.cts +48 -2
- package/build/modern/PreactQueryDevtoolsPanel.d.cts.map +1 -0
- package/build/modern/PreactQueryDevtoolsPanel.d.ts +48 -2
- package/build/modern/PreactQueryDevtoolsPanel.d.ts.map +1 -0
- package/build/modern/PreactQueryDevtoolsPanel.js +49 -60
- package/build/modern/PreactQueryDevtoolsPanel.js.map +1 -1
- package/build/modern/index.cjs +13 -48
- package/build/modern/index.cjs.map +1 -1
- package/build/modern/index.d.cts +9 -3
- package/build/modern/index.d.cts.map +1 -0
- package/build/modern/index.d.ts +9 -3
- package/build/modern/index.d.ts.map +1 -0
- package/build/modern/index.js +12 -13
- package/build/modern/index.js.map +1 -1
- package/build/modern/production.cjs +9 -44
- package/build/modern/production.cjs.map +1 -1
- package/build/modern/production.d.cts +8 -2
- package/build/modern/production.d.cts.map +1 -0
- package/build/modern/production.d.ts +8 -2
- package/build/modern/production.d.ts.map +1 -0
- package/build/modern/production.js +8 -9
- package/build/modern/production.js.map +1 -1
- package/build/modern/rolldown-runtime-D7D4PA-g.js +13 -0
- package/package.json +8 -10
- package/build/legacy/_tsup-dts-rollup.d.cts +0 -123
- package/build/legacy/_tsup-dts-rollup.d.ts +0 -123
- package/build/modern/_tsup-dts-rollup.d.cts +0 -123
- package/build/modern/_tsup-dts-rollup.d.ts +0 -123
|
@@ -1,95 +1,58 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/PreactQueryDevtools.tsx
|
|
21
|
-
var PreactQueryDevtools_exports = {};
|
|
22
|
-
__export(PreactQueryDevtools_exports, {
|
|
23
|
-
PreactQueryDevtools: () => PreactQueryDevtools
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(PreactQueryDevtools_exports);
|
|
26
|
-
var import_hooks = require("preact/hooks");
|
|
27
|
-
var import_preact_query = require("@tanstack/preact-query");
|
|
28
|
-
var import_query_devtools = require("@tanstack/query-devtools");
|
|
29
|
-
var import_jsx_runtime = require("preact/jsx-runtime");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let preact_hooks = require("preact/hooks");
|
|
3
|
+
let _tanstack_preact_query = require("@tanstack/preact-query");
|
|
4
|
+
let _tanstack_query_devtools = require("@tanstack/query-devtools");
|
|
5
|
+
let preact_jsx_runtime = require("preact/jsx-runtime");
|
|
6
|
+
//#region src/PreactQueryDevtools.tsx
|
|
30
7
|
function PreactQueryDevtools(props) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}, [errorTypes, devtools]);
|
|
78
|
-
(0, import_hooks.useEffect)(() => {
|
|
79
|
-
devtools.setTheme(theme);
|
|
80
|
-
}, [theme, devtools]);
|
|
81
|
-
(0, import_hooks.useEffect)(() => {
|
|
82
|
-
if (ref.current) {
|
|
83
|
-
devtools.mount(ref.current);
|
|
84
|
-
}
|
|
85
|
-
return () => {
|
|
86
|
-
devtools.unmount();
|
|
87
|
-
};
|
|
88
|
-
}, [devtools]);
|
|
89
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { dir: "ltr", className: "tsqd-parent-container", ref });
|
|
8
|
+
const queryClient = (0, _tanstack_preact_query.useQueryClient)(props.client);
|
|
9
|
+
const ref = (0, preact_hooks.useRef)(null);
|
|
10
|
+
const { buttonPosition, position, initialIsOpen, errorTypes, styleNonce, shadowDOMTarget, hideDisabledQueries, theme } = props;
|
|
11
|
+
const [devtools] = (0, preact_hooks.useState)(() => new _tanstack_query_devtools.TanstackQueryDevtools({
|
|
12
|
+
client: queryClient,
|
|
13
|
+
queryFlavor: "Preact Query",
|
|
14
|
+
version: "5",
|
|
15
|
+
onlineManager: _tanstack_preact_query.onlineManager,
|
|
16
|
+
buttonPosition,
|
|
17
|
+
position,
|
|
18
|
+
initialIsOpen,
|
|
19
|
+
errorTypes,
|
|
20
|
+
styleNonce,
|
|
21
|
+
shadowDOMTarget,
|
|
22
|
+
hideDisabledQueries,
|
|
23
|
+
theme
|
|
24
|
+
}));
|
|
25
|
+
(0, preact_hooks.useEffect)(() => {
|
|
26
|
+
devtools.setClient(queryClient);
|
|
27
|
+
}, [queryClient, devtools]);
|
|
28
|
+
(0, preact_hooks.useEffect)(() => {
|
|
29
|
+
if (buttonPosition) devtools.setButtonPosition(buttonPosition);
|
|
30
|
+
}, [buttonPosition, devtools]);
|
|
31
|
+
(0, preact_hooks.useEffect)(() => {
|
|
32
|
+
if (position) devtools.setPosition(position);
|
|
33
|
+
}, [position, devtools]);
|
|
34
|
+
(0, preact_hooks.useEffect)(() => {
|
|
35
|
+
devtools.setInitialIsOpen(initialIsOpen || false);
|
|
36
|
+
}, [initialIsOpen, devtools]);
|
|
37
|
+
(0, preact_hooks.useEffect)(() => {
|
|
38
|
+
devtools.setErrorTypes(errorTypes || []);
|
|
39
|
+
}, [errorTypes, devtools]);
|
|
40
|
+
(0, preact_hooks.useEffect)(() => {
|
|
41
|
+
devtools.setTheme(theme);
|
|
42
|
+
}, [theme, devtools]);
|
|
43
|
+
(0, preact_hooks.useEffect)(() => {
|
|
44
|
+
if (ref.current) devtools.mount(ref.current);
|
|
45
|
+
return () => {
|
|
46
|
+
devtools.unmount();
|
|
47
|
+
};
|
|
48
|
+
}, [devtools]);
|
|
49
|
+
return /* @__PURE__ */ (0, preact_jsx_runtime.jsx)("div", {
|
|
50
|
+
dir: "ltr",
|
|
51
|
+
className: "tsqd-parent-container",
|
|
52
|
+
ref
|
|
53
|
+
});
|
|
90
54
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.PreactQueryDevtools = PreactQueryDevtools;
|
|
57
|
+
|
|
95
58
|
//# sourceMappingURL=PreactQueryDevtools.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/PreactQueryDevtools.tsx"],"sourcesContent":["import { useRef, useState, useEffect } from 'preact/hooks'\nimport { onlineManager, useQueryClient } from '@tanstack/preact-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n Theme,\n} from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/preact-query'\nimport type { VNode } from 'preact'\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 TanStack logo to open and close the devtools panel.\n * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'\n * Defaults to 'bottom-right'.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the Preact Query devtools panel.\n * 'top' | 'bottom' | 'left' | 'right'\n * Defaults to 'bottom'.\n */\n position?: DevtoolsPosition\n /**\n * Use this to provide a custom QueryClient. Otherwise, the one from the\n * nearest QueryClientProvider will be used.\n */\n client?: QueryClient\n /**\n * Use this to provide custom error type handlers for the devtools panel.\n */\n errorTypes?: Array<DevtoolsErrorType>\n /**\n * Use this to pass a nonce to the style tag that is added to the document\n * head. This is useful if you are using a Content Security Policy (CSP)\n * nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this to render the devtools inside a Shadow DOM.\n */\n shadowDOMTarget?: ShadowRoot\n /**\n * Use this to hide disabled queries from the devtools panel.\n */\n hideDisabledQueries?: boolean\n /**\n * Use this to set the theme of the devtools panel.\n * Defaults to 'system'.\n */\n theme?: Theme\n}\n\nexport function PreactQueryDevtools(props: DevtoolsOptions): VNode | null {\n const queryClient = useQueryClient(props.client)\n const ref = useRef<HTMLDivElement>(null)\n const {\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n } = props\n const [devtools] = useState(\n () =>\n new TanstackQueryDevtools({\n client: queryClient,\n queryFlavor: 'Preact Query',\n version: '5',\n onlineManager,\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n }),\n )\n\n useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, 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 devtools.setTheme(theme)\n }, [theme, devtools])\n\n useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return <div dir=\"ltr\" className=\"tsqd-parent-container\" ref={ref} />\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreactQueryDevtools.cjs","names":["useQueryClient","useRef","useState","TanstackQueryDevtools"],"sources":["../../src/PreactQueryDevtools.tsx"],"sourcesContent":["import { useRef, useState, useEffect } from 'preact/hooks'\nimport { onlineManager, useQueryClient } from '@tanstack/preact-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n Theme,\n} from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/preact-query'\nimport type { VNode } from 'preact'\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 TanStack logo to open and close the devtools panel.\n * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'\n * Defaults to 'bottom-right'.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the Preact Query devtools panel.\n * 'top' | 'bottom' | 'left' | 'right'\n * Defaults to 'bottom'.\n */\n position?: DevtoolsPosition\n /**\n * Use this to provide a custom QueryClient. Otherwise, the one from the\n * nearest QueryClientProvider will be used.\n */\n client?: QueryClient\n /**\n * Use this to provide custom error type handlers for the devtools panel.\n */\n errorTypes?: Array<DevtoolsErrorType>\n /**\n * Use this to pass a nonce to the style tag that is added to the document\n * head. This is useful if you are using a Content Security Policy (CSP)\n * nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this to render the devtools inside a Shadow DOM.\n */\n shadowDOMTarget?: ShadowRoot\n /**\n * Use this to hide disabled queries from the devtools panel.\n */\n hideDisabledQueries?: boolean\n /**\n * Use this to set the theme of the devtools panel.\n * Defaults to 'system'.\n */\n theme?: Theme\n}\n\nexport function PreactQueryDevtools(props: DevtoolsOptions): VNode | null {\n const queryClient = useQueryClient(props.client)\n const ref = useRef<HTMLDivElement>(null)\n const {\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n } = props\n const [devtools] = useState(\n () =>\n new TanstackQueryDevtools({\n client: queryClient,\n queryFlavor: 'Preact Query',\n version: '5',\n onlineManager,\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n }),\n )\n\n useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, 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 devtools.setTheme(theme)\n }, [theme, devtools])\n\n useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return <div dir=\"ltr\" className=\"tsqd-parent-container\" ref={ref} />\n}\n"],"mappings":";;;;;;AA2DA,SAAgB,oBAAoB,OAAsC;CACxE,MAAM,eAAA,GAAcA,uBAAAA,eAAAA,CAAe,MAAM,MAAM;CAC/C,MAAM,OAAA,GAAMC,aAAAA,OAAAA,CAAuB,IAAI;CACvC,MAAM,EACJ,gBACA,UACA,eACA,YACA,YACA,iBACA,qBACA,UACE;CACJ,MAAM,CAAC,aAAA,GAAYC,aAAAA,SAAAA,OAEf,IAAIC,yBAAAA,sBAAsB;EACxB,QAAQ;EACR,aAAa;EACb,SAAS;EACT,eAAA,uBAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CACL;CAEA,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,UAAU,WAAW;CAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;CAE1B,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,gBACF,SAAS,kBAAkB,cAAc;CAE7C,GAAG,CAAC,gBAAgB,QAAQ,CAAC;CAE7B,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,UACF,SAAS,YAAY,QAAQ;CAEjC,GAAG,CAAC,UAAU,QAAQ,CAAC;CAEvB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,iBAAiB,iBAAiB,KAAK;CAClD,GAAG,CAAC,eAAe,QAAQ,CAAC;CAE5B,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,cAAc,cAAc,CAAC,CAAC;CACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;CAEzB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,SAAS,KAAK;CACzB,GAAG,CAAC,OAAO,QAAQ,CAAC;CAEpB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,IAAI,SACN,SAAS,MAAM,IAAI,OAAO;EAE5B,aAAa;GACX,SAAS,QAAQ;EACnB;CACF,GAAG,CAAC,QAAQ,CAAC;CAEb,OAAO,iBAAA,GAAA,mBAAA,IAAA,CAAC,OAAD;EAAK,KAAI;EAAM,WAAU;EAA6B;CAAM,CAAA;AACrE"}
|
|
@@ -1,2 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { DevtoolsButtonPosition, DevtoolsErrorType, DevtoolsPosition, Theme } from "@tanstack/query-devtools";
|
|
2
|
+
import { QueryClient } from "@tanstack/preact-query";
|
|
3
|
+
import { VNode } from "preact";
|
|
4
|
+
declare namespace PreactQueryDevtools_d_exports {
|
|
5
|
+
export { DevtoolsOptions, PreactQueryDevtools };
|
|
6
|
+
}
|
|
7
|
+
interface DevtoolsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Set this true if you want the dev tools to default to being open
|
|
10
|
+
*/
|
|
11
|
+
initialIsOpen?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The position of the TanStack logo to open and close the devtools panel.
|
|
14
|
+
* 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'
|
|
15
|
+
* Defaults to 'bottom-right'.
|
|
16
|
+
*/
|
|
17
|
+
buttonPosition?: DevtoolsButtonPosition;
|
|
18
|
+
/**
|
|
19
|
+
* The position of the Preact Query devtools panel.
|
|
20
|
+
* 'top' | 'bottom' | 'left' | 'right'
|
|
21
|
+
* Defaults to 'bottom'.
|
|
22
|
+
*/
|
|
23
|
+
position?: DevtoolsPosition;
|
|
24
|
+
/**
|
|
25
|
+
* Use this to provide a custom QueryClient. Otherwise, the one from the
|
|
26
|
+
* nearest QueryClientProvider will be used.
|
|
27
|
+
*/
|
|
28
|
+
client?: QueryClient;
|
|
29
|
+
/**
|
|
30
|
+
* Use this to provide custom error type handlers for the devtools panel.
|
|
31
|
+
*/
|
|
32
|
+
errorTypes?: Array<DevtoolsErrorType>;
|
|
33
|
+
/**
|
|
34
|
+
* Use this to pass a nonce to the style tag that is added to the document
|
|
35
|
+
* head. This is useful if you are using a Content Security Policy (CSP)
|
|
36
|
+
* nonce to allow inline styles.
|
|
37
|
+
*/
|
|
38
|
+
styleNonce?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Use this to render the devtools inside a Shadow DOM.
|
|
41
|
+
*/
|
|
42
|
+
shadowDOMTarget?: ShadowRoot;
|
|
43
|
+
/**
|
|
44
|
+
* Use this to hide disabled queries from the devtools panel.
|
|
45
|
+
*/
|
|
46
|
+
hideDisabledQueries?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Use this to set the theme of the devtools panel.
|
|
49
|
+
* Defaults to 'system'.
|
|
50
|
+
*/
|
|
51
|
+
theme?: Theme;
|
|
52
|
+
}
|
|
53
|
+
declare function PreactQueryDevtools(props: DevtoolsOptions): VNode | null;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { DevtoolsOptions, PreactQueryDevtools, PreactQueryDevtools_d_exports as t };
|
|
56
|
+
//# sourceMappingURL=PreactQueryDevtools.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreactQueryDevtools.d.cts","names":[],"sources":["../../src/PreactQueryDevtools.tsx"],"mappings":";;;;;;UAYiB;;;;EAIf;;;;;;EAMA,iBAAiB;;;;;;EAMjB,WAAW;;;;;EAKX,SAAS;;;;EAIT,aAAa,MAAM;;;;;;EAMnB;;;;EAIA,kBAAkB;;;;EAIlB;;;;;EAKA,QAAQ;;iBAGM,oBAAoB,OAAO,kBAAkB"}
|
|
@@ -1,2 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { QueryClient } from "@tanstack/preact-query";
|
|
2
|
+
import { DevtoolsButtonPosition, DevtoolsErrorType, DevtoolsPosition, Theme } from "@tanstack/query-devtools";
|
|
3
|
+
import { VNode } from "preact";
|
|
4
|
+
declare namespace PreactQueryDevtools_d_exports {
|
|
5
|
+
export { DevtoolsOptions, PreactQueryDevtools };
|
|
6
|
+
}
|
|
7
|
+
interface DevtoolsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Set this true if you want the dev tools to default to being open
|
|
10
|
+
*/
|
|
11
|
+
initialIsOpen?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The position of the TanStack logo to open and close the devtools panel.
|
|
14
|
+
* 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'
|
|
15
|
+
* Defaults to 'bottom-right'.
|
|
16
|
+
*/
|
|
17
|
+
buttonPosition?: DevtoolsButtonPosition;
|
|
18
|
+
/**
|
|
19
|
+
* The position of the Preact Query devtools panel.
|
|
20
|
+
* 'top' | 'bottom' | 'left' | 'right'
|
|
21
|
+
* Defaults to 'bottom'.
|
|
22
|
+
*/
|
|
23
|
+
position?: DevtoolsPosition;
|
|
24
|
+
/**
|
|
25
|
+
* Use this to provide a custom QueryClient. Otherwise, the one from the
|
|
26
|
+
* nearest QueryClientProvider will be used.
|
|
27
|
+
*/
|
|
28
|
+
client?: QueryClient;
|
|
29
|
+
/**
|
|
30
|
+
* Use this to provide custom error type handlers for the devtools panel.
|
|
31
|
+
*/
|
|
32
|
+
errorTypes?: Array<DevtoolsErrorType>;
|
|
33
|
+
/**
|
|
34
|
+
* Use this to pass a nonce to the style tag that is added to the document
|
|
35
|
+
* head. This is useful if you are using a Content Security Policy (CSP)
|
|
36
|
+
* nonce to allow inline styles.
|
|
37
|
+
*/
|
|
38
|
+
styleNonce?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Use this to render the devtools inside a Shadow DOM.
|
|
41
|
+
*/
|
|
42
|
+
shadowDOMTarget?: ShadowRoot;
|
|
43
|
+
/**
|
|
44
|
+
* Use this to hide disabled queries from the devtools panel.
|
|
45
|
+
*/
|
|
46
|
+
hideDisabledQueries?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Use this to set the theme of the devtools panel.
|
|
49
|
+
* Defaults to 'system'.
|
|
50
|
+
*/
|
|
51
|
+
theme?: Theme;
|
|
52
|
+
}
|
|
53
|
+
declare function PreactQueryDevtools(props: DevtoolsOptions): VNode | null;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { DevtoolsOptions, PreactQueryDevtools, PreactQueryDevtools_d_exports as t };
|
|
56
|
+
//# sourceMappingURL=PreactQueryDevtools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreactQueryDevtools.d.ts","names":[],"sources":["../../src/PreactQueryDevtools.tsx"],"mappings":";;;;;;UAYiB;;;;EAIf;;;;;;EAMA,iBAAiB;;;;;;EAMjB,WAAW;;;;;EAKX,SAAS;;;;EAIT,aAAa,MAAM;;;;;;EAMnB;;;;EAIA,kBAAkB;;;;EAIlB;;;;;EAKA,QAAQ;;iBAGM,oBAAoB,OAAO,kBAAkB"}
|
|
@@ -1,70 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
import { useRef, useState, useEffect } from "preact/hooks";
|
|
1
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
3
2
|
import { onlineManager, useQueryClient } from "@tanstack/preact-query";
|
|
4
3
|
import { TanstackQueryDevtools } from "@tanstack/query-devtools";
|
|
5
4
|
import { jsx } from "preact/jsx-runtime";
|
|
5
|
+
//#region src/PreactQueryDevtools.tsx
|
|
6
6
|
function PreactQueryDevtools(props) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [errorTypes, devtools]);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
devtools.setTheme(theme);
|
|
56
|
-
}, [theme, devtools]);
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (ref.current) {
|
|
59
|
-
devtools.mount(ref.current);
|
|
60
|
-
}
|
|
61
|
-
return () => {
|
|
62
|
-
devtools.unmount();
|
|
63
|
-
};
|
|
64
|
-
}, [devtools]);
|
|
65
|
-
return /* @__PURE__ */ jsx("div", { dir: "ltr", className: "tsqd-parent-container", ref });
|
|
7
|
+
const queryClient = useQueryClient(props.client);
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
const { buttonPosition, position, initialIsOpen, errorTypes, styleNonce, shadowDOMTarget, hideDisabledQueries, theme } = props;
|
|
10
|
+
const [devtools] = useState(() => new TanstackQueryDevtools({
|
|
11
|
+
client: queryClient,
|
|
12
|
+
queryFlavor: "Preact Query",
|
|
13
|
+
version: "5",
|
|
14
|
+
onlineManager,
|
|
15
|
+
buttonPosition,
|
|
16
|
+
position,
|
|
17
|
+
initialIsOpen,
|
|
18
|
+
errorTypes,
|
|
19
|
+
styleNonce,
|
|
20
|
+
shadowDOMTarget,
|
|
21
|
+
hideDisabledQueries,
|
|
22
|
+
theme
|
|
23
|
+
}));
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
devtools.setClient(queryClient);
|
|
26
|
+
}, [queryClient, devtools]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (buttonPosition) devtools.setButtonPosition(buttonPosition);
|
|
29
|
+
}, [buttonPosition, devtools]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (position) devtools.setPosition(position);
|
|
32
|
+
}, [position, devtools]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
devtools.setInitialIsOpen(initialIsOpen || false);
|
|
35
|
+
}, [initialIsOpen, devtools]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
devtools.setErrorTypes(errorTypes || []);
|
|
38
|
+
}, [errorTypes, devtools]);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
devtools.setTheme(theme);
|
|
41
|
+
}, [theme, devtools]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (ref.current) devtools.mount(ref.current);
|
|
44
|
+
return () => {
|
|
45
|
+
devtools.unmount();
|
|
46
|
+
};
|
|
47
|
+
}, [devtools]);
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
dir: "ltr",
|
|
50
|
+
className: "tsqd-parent-container",
|
|
51
|
+
ref
|
|
52
|
+
});
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
export { PreactQueryDevtools };
|
|
56
|
+
|
|
70
57
|
//# sourceMappingURL=PreactQueryDevtools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/PreactQueryDevtools.tsx"],"sourcesContent":["import { useRef, useState, useEffect } from 'preact/hooks'\nimport { onlineManager, useQueryClient } from '@tanstack/preact-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n Theme,\n} from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/preact-query'\nimport type { VNode } from 'preact'\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 TanStack logo to open and close the devtools panel.\n * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'\n * Defaults to 'bottom-right'.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the Preact Query devtools panel.\n * 'top' | 'bottom' | 'left' | 'right'\n * Defaults to 'bottom'.\n */\n position?: DevtoolsPosition\n /**\n * Use this to provide a custom QueryClient. Otherwise, the one from the\n * nearest QueryClientProvider will be used.\n */\n client?: QueryClient\n /**\n * Use this to provide custom error type handlers for the devtools panel.\n */\n errorTypes?: Array<DevtoolsErrorType>\n /**\n * Use this to pass a nonce to the style tag that is added to the document\n * head. This is useful if you are using a Content Security Policy (CSP)\n * nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this to render the devtools inside a Shadow DOM.\n */\n shadowDOMTarget?: ShadowRoot\n /**\n * Use this to hide disabled queries from the devtools panel.\n */\n hideDisabledQueries?: boolean\n /**\n * Use this to set the theme of the devtools panel.\n * Defaults to 'system'.\n */\n theme?: Theme\n}\n\nexport function PreactQueryDevtools(props: DevtoolsOptions): VNode | null {\n const queryClient = useQueryClient(props.client)\n const ref = useRef<HTMLDivElement>(null)\n const {\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n } = props\n const [devtools] = useState(\n () =>\n new TanstackQueryDevtools({\n client: queryClient,\n queryFlavor: 'Preact Query',\n version: '5',\n onlineManager,\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n }),\n )\n\n useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, 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 devtools.setTheme(theme)\n }, [theme, devtools])\n\n useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return <div dir=\"ltr\" className=\"tsqd-parent-container\" ref={ref} />\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreactQueryDevtools.js","names":[],"sources":["../../src/PreactQueryDevtools.tsx"],"sourcesContent":["import { useRef, useState, useEffect } from 'preact/hooks'\nimport { onlineManager, useQueryClient } from '@tanstack/preact-query'\nimport { TanstackQueryDevtools } from '@tanstack/query-devtools'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n Theme,\n} from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/preact-query'\nimport type { VNode } from 'preact'\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 TanStack logo to open and close the devtools panel.\n * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'\n * Defaults to 'bottom-right'.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the Preact Query devtools panel.\n * 'top' | 'bottom' | 'left' | 'right'\n * Defaults to 'bottom'.\n */\n position?: DevtoolsPosition\n /**\n * Use this to provide a custom QueryClient. Otherwise, the one from the\n * nearest QueryClientProvider will be used.\n */\n client?: QueryClient\n /**\n * Use this to provide custom error type handlers for the devtools panel.\n */\n errorTypes?: Array<DevtoolsErrorType>\n /**\n * Use this to pass a nonce to the style tag that is added to the document\n * head. This is useful if you are using a Content Security Policy (CSP)\n * nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this to render the devtools inside a Shadow DOM.\n */\n shadowDOMTarget?: ShadowRoot\n /**\n * Use this to hide disabled queries from the devtools panel.\n */\n hideDisabledQueries?: boolean\n /**\n * Use this to set the theme of the devtools panel.\n * Defaults to 'system'.\n */\n theme?: Theme\n}\n\nexport function PreactQueryDevtools(props: DevtoolsOptions): VNode | null {\n const queryClient = useQueryClient(props.client)\n const ref = useRef<HTMLDivElement>(null)\n const {\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n } = props\n const [devtools] = useState(\n () =>\n new TanstackQueryDevtools({\n client: queryClient,\n queryFlavor: 'Preact Query',\n version: '5',\n onlineManager,\n buttonPosition,\n position,\n initialIsOpen,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n }),\n )\n\n useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, 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 devtools.setTheme(theme)\n }, [theme, devtools])\n\n useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\n }\n return () => {\n devtools.unmount()\n }\n }, [devtools])\n\n return <div dir=\"ltr\" className=\"tsqd-parent-container\" ref={ref} />\n}\n"],"mappings":";;;;;AA2DA,SAAgB,oBAAoB,OAAsC;CACxE,MAAM,cAAc,eAAe,MAAM,MAAM;CAC/C,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,EACJ,gBACA,UACA,eACA,YACA,YACA,iBACA,qBACA,UACE;CACJ,MAAM,CAAC,YAAY,eAEf,IAAI,sBAAsB;EACxB,QAAQ;EACR,aAAa;EACb,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CACL;CAEA,gBAAgB;EACd,SAAS,UAAU,WAAW;CAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;CAE1B,gBAAgB;EACd,IAAI,gBACF,SAAS,kBAAkB,cAAc;CAE7C,GAAG,CAAC,gBAAgB,QAAQ,CAAC;CAE7B,gBAAgB;EACd,IAAI,UACF,SAAS,YAAY,QAAQ;CAEjC,GAAG,CAAC,UAAU,QAAQ,CAAC;CAEvB,gBAAgB;EACd,SAAS,iBAAiB,iBAAiB,KAAK;CAClD,GAAG,CAAC,eAAe,QAAQ,CAAC;CAE5B,gBAAgB;EACd,SAAS,cAAc,cAAc,CAAC,CAAC;CACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;CAEzB,gBAAgB;EACd,SAAS,SAAS,KAAK;CACzB,GAAG,CAAC,OAAO,QAAQ,CAAC;CAEpB,gBAAgB;EACd,IAAI,IAAI,SACN,SAAS,MAAM,IAAI,OAAO;EAE5B,aAAa;GACX,SAAS,QAAQ;EACnB;CACF,GAAG,CAAC,QAAQ,CAAC;CAEb,OAAO,oBAAC,OAAD;EAAK,KAAI;EAAM,WAAU;EAA6B;CAAM,CAAA;AACrE"}
|
|
@@ -1,91 +1,56 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/PreactQueryDevtoolsPanel.tsx
|
|
21
|
-
var PreactQueryDevtoolsPanel_exports = {};
|
|
22
|
-
__export(PreactQueryDevtoolsPanel_exports, {
|
|
23
|
-
PreactQueryDevtoolsPanel: () => PreactQueryDevtoolsPanel
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(PreactQueryDevtoolsPanel_exports);
|
|
26
|
-
var import_hooks = require("preact/hooks");
|
|
27
|
-
var import_preact_query = require("@tanstack/preact-query");
|
|
28
|
-
var import_query_devtools = require("@tanstack/query-devtools");
|
|
29
|
-
var import_jsx_runtime = require("preact/jsx-runtime");
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let preact_hooks = require("preact/hooks");
|
|
3
|
+
let _tanstack_preact_query = require("@tanstack/preact-query");
|
|
4
|
+
let _tanstack_query_devtools = require("@tanstack/query-devtools");
|
|
5
|
+
let preact_jsx_runtime = require("preact/jsx-runtime");
|
|
6
|
+
//#region src/PreactQueryDevtoolsPanel.tsx
|
|
30
7
|
function PreactQueryDevtoolsPanel(props) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
);
|
|
8
|
+
const queryClient = (0, _tanstack_preact_query.useQueryClient)(props.client);
|
|
9
|
+
const ref = (0, preact_hooks.useRef)(null);
|
|
10
|
+
const { errorTypes, styleNonce, shadowDOMTarget, hideDisabledQueries, theme } = props;
|
|
11
|
+
const [devtools] = (0, preact_hooks.useState)(() => new _tanstack_query_devtools.TanstackQueryDevtoolsPanel({
|
|
12
|
+
client: queryClient,
|
|
13
|
+
queryFlavor: "Preact Query",
|
|
14
|
+
version: "5",
|
|
15
|
+
onlineManager: _tanstack_preact_query.onlineManager,
|
|
16
|
+
buttonPosition: "bottom-left",
|
|
17
|
+
position: "bottom",
|
|
18
|
+
initialIsOpen: true,
|
|
19
|
+
errorTypes,
|
|
20
|
+
styleNonce,
|
|
21
|
+
shadowDOMTarget,
|
|
22
|
+
onClose: props.onClose,
|
|
23
|
+
hideDisabledQueries,
|
|
24
|
+
theme
|
|
25
|
+
}));
|
|
26
|
+
(0, preact_hooks.useEffect)(() => {
|
|
27
|
+
devtools.setClient(queryClient);
|
|
28
|
+
}, [queryClient, devtools]);
|
|
29
|
+
(0, preact_hooks.useEffect)(() => {
|
|
30
|
+
devtools.setOnClose(props.onClose ?? (() => {}));
|
|
31
|
+
}, [props.onClose, devtools]);
|
|
32
|
+
(0, preact_hooks.useEffect)(() => {
|
|
33
|
+
devtools.setErrorTypes(errorTypes || []);
|
|
34
|
+
}, [errorTypes, devtools]);
|
|
35
|
+
(0, preact_hooks.useEffect)(() => {
|
|
36
|
+
devtools.setTheme(theme);
|
|
37
|
+
}, [theme, devtools]);
|
|
38
|
+
(0, preact_hooks.useEffect)(() => {
|
|
39
|
+
if (ref.current) devtools.mount(ref.current);
|
|
40
|
+
return () => {
|
|
41
|
+
devtools.unmount();
|
|
42
|
+
};
|
|
43
|
+
}, [devtools]);
|
|
44
|
+
return /* @__PURE__ */ (0, preact_jsx_runtime.jsx)("div", {
|
|
45
|
+
style: {
|
|
46
|
+
height: "500px",
|
|
47
|
+
...props.style
|
|
48
|
+
},
|
|
49
|
+
className: "tsqd-parent-container",
|
|
50
|
+
ref
|
|
51
|
+
});
|
|
86
52
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.PreactQueryDevtoolsPanel = PreactQueryDevtoolsPanel;
|
|
55
|
+
|
|
91
56
|
//# sourceMappingURL=PreactQueryDevtoolsPanel.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/PreactQueryDevtoolsPanel.tsx"],"sourcesContent":["import { useRef, useState, useEffect } from 'preact/hooks'\nimport { onlineManager, useQueryClient } from '@tanstack/preact-query'\nimport { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'\nimport type { DevtoolsErrorType, Theme } from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/preact-query'\nimport type { CSSProperties, VNode } from 'preact'\n\nexport interface DevtoolsPanelOptions {\n /**\n * Use this to provide a custom QueryClient. Otherwise, the one from the\n * nearest QueryClientProvider will be used.\n */\n client?: QueryClient\n /**\n * Custom error types to 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\n * head. This is useful if you are using a Content Security Policy (CSP)\n * nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this to render the devtools inside a Shadow DOM.\n */\n shadowDOMTarget?: ShadowRoot\n /**\n * Custom styles for the devtools panel container.\n */\n style?: CSSProperties\n /**\n * Callback function when the devtools panel is closed.\n */\n onClose?: () => unknown\n /**\n * Use this to hide disabled queries from the devtools panel.\n */\n hideDisabledQueries?: boolean\n /**\n * Use this to set the theme of the devtools panel.\n * Defaults to 'system'.\n */\n theme?: Theme\n}\n\nexport function PreactQueryDevtoolsPanel(\n props: DevtoolsPanelOptions,\n): VNode | null {\n const queryClient = useQueryClient(props.client)\n const ref = useRef<HTMLDivElement>(null)\n const {\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n } = props\n const [devtools] = useState(\n () =>\n new TanstackQueryDevtoolsPanel({\n client: queryClient,\n queryFlavor: 'Preact 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 hideDisabledQueries,\n theme,\n }),\n )\n\n useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, devtools])\n\n useEffect(() => {\n devtools.setOnClose(props.onClose ?? (() => {}))\n }, [props.onClose, devtools])\n\n useEffect(() => {\n devtools.setErrorTypes(errorTypes || [])\n }, [errorTypes, devtools])\n\n useEffect(() => {\n devtools.setTheme(theme)\n }, [theme, devtools])\n\n useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\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 />\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PreactQueryDevtoolsPanel.cjs","names":["useQueryClient","useRef","useState","TanstackQueryDevtoolsPanel"],"sources":["../../src/PreactQueryDevtoolsPanel.tsx"],"sourcesContent":["import { useRef, useState, useEffect } from 'preact/hooks'\nimport { onlineManager, useQueryClient } from '@tanstack/preact-query'\nimport { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'\nimport type { DevtoolsErrorType, Theme } from '@tanstack/query-devtools'\nimport type { QueryClient } from '@tanstack/preact-query'\nimport type { CSSProperties, VNode } from 'preact'\n\nexport interface DevtoolsPanelOptions {\n /**\n * Use this to provide a custom QueryClient. Otherwise, the one from the\n * nearest QueryClientProvider will be used.\n */\n client?: QueryClient\n /**\n * Custom error types to 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\n * head. This is useful if you are using a Content Security Policy (CSP)\n * nonce to allow inline styles.\n */\n styleNonce?: string\n /**\n * Use this to render the devtools inside a Shadow DOM.\n */\n shadowDOMTarget?: ShadowRoot\n /**\n * Custom styles for the devtools panel container.\n */\n style?: CSSProperties\n /**\n * Callback function when the devtools panel is closed.\n */\n onClose?: () => unknown\n /**\n * Use this to hide disabled queries from the devtools panel.\n */\n hideDisabledQueries?: boolean\n /**\n * Use this to set the theme of the devtools panel.\n * Defaults to 'system'.\n */\n theme?: Theme\n}\n\nexport function PreactQueryDevtoolsPanel(\n props: DevtoolsPanelOptions,\n): VNode | null {\n const queryClient = useQueryClient(props.client)\n const ref = useRef<HTMLDivElement>(null)\n const {\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n hideDisabledQueries,\n theme,\n } = props\n const [devtools] = useState(\n () =>\n new TanstackQueryDevtoolsPanel({\n client: queryClient,\n queryFlavor: 'Preact 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 hideDisabledQueries,\n theme,\n }),\n )\n\n useEffect(() => {\n devtools.setClient(queryClient)\n }, [queryClient, devtools])\n\n useEffect(() => {\n devtools.setOnClose(props.onClose ?? (() => {}))\n }, [props.onClose, devtools])\n\n useEffect(() => {\n devtools.setErrorTypes(errorTypes || [])\n }, [errorTypes, devtools])\n\n useEffect(() => {\n devtools.setTheme(theme)\n }, [theme, devtools])\n\n useEffect(() => {\n if (ref.current) {\n devtools.mount(ref.current)\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 />\n )\n}\n"],"mappings":";;;;;;AA8CA,SAAgB,yBACd,OACc;CACd,MAAM,eAAA,GAAcA,uBAAAA,eAAAA,CAAe,MAAM,MAAM;CAC/C,MAAM,OAAA,GAAMC,aAAAA,OAAAA,CAAuB,IAAI;CACvC,MAAM,EACJ,YACA,YACA,iBACA,qBACA,UACE;CACJ,MAAM,CAAC,aAAA,GAAYC,aAAAA,SAAAA,OAEf,IAAIC,yBAAAA,2BAA2B;EAC7B,QAAQ;EACR,aAAa;EACb,SAAS;EACT,eAAA,uBAAA;EACA,gBAAgB;EAChB,UAAU;EACV,eAAe;EACf;EACA;EACA;EACA,SAAS,MAAM;EACf;EACA;CACF,CAAC,CACL;CAEA,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,UAAU,WAAW;CAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;CAE1B,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,WAAW,MAAM,kBAAkB,CAAC,EAAE;CACjD,GAAG,CAAC,MAAM,SAAS,QAAQ,CAAC;CAE5B,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,cAAc,cAAc,CAAC,CAAC;CACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;CAEzB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,SAAS,SAAS,KAAK;CACzB,GAAG,CAAC,OAAO,QAAQ,CAAC;CAEpB,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,IAAI,IAAI,SACN,SAAS,MAAM,IAAI,OAAO;EAE5B,aAAa;GACX,SAAS,QAAQ;EACnB;CACF,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,iBAAA,GAAA,mBAAA,IAAA,CAAC,OAAD;EACE,OAAO;GAAE,QAAQ;GAAS,GAAG,MAAM;EAAM;EACzC,WAAU;EACL;CACN,CAAA;AAEL"}
|