@tanstack/preact-query-devtools 0.0.1 → 5.92.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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/build/legacy/PreactQueryDevtools-BKJv-YAr.d.cts +57 -0
  3. package/build/legacy/PreactQueryDevtools-BKJv-YAr.d.ts +57 -0
  4. package/build/legacy/PreactQueryDevtools.cjs +95 -0
  5. package/build/legacy/PreactQueryDevtools.cjs.map +1 -0
  6. package/build/legacy/PreactQueryDevtools.d.cts +4 -0
  7. package/build/legacy/PreactQueryDevtools.d.ts +4 -0
  8. package/build/legacy/PreactQueryDevtools.js +70 -0
  9. package/build/legacy/PreactQueryDevtools.js.map +1 -0
  10. package/build/legacy/PreactQueryDevtoolsPanel-tSWW-AUr.d.cts +51 -0
  11. package/build/legacy/PreactQueryDevtoolsPanel-tSWW-AUr.d.ts +51 -0
  12. package/build/legacy/PreactQueryDevtoolsPanel.cjs +91 -0
  13. package/build/legacy/PreactQueryDevtoolsPanel.cjs.map +1 -0
  14. package/build/legacy/PreactQueryDevtoolsPanel.d.cts +4 -0
  15. package/build/legacy/PreactQueryDevtoolsPanel.d.ts +4 -0
  16. package/build/legacy/PreactQueryDevtoolsPanel.js +66 -0
  17. package/build/legacy/PreactQueryDevtoolsPanel.js.map +1 -0
  18. package/build/legacy/index.cjs +50 -0
  19. package/build/legacy/index.cjs.map +1 -0
  20. package/build/legacy/index.d.cts +11 -0
  21. package/build/legacy/index.d.ts +11 -0
  22. package/build/legacy/index.js +14 -0
  23. package/build/legacy/index.js.map +1 -0
  24. package/build/legacy/production.cjs +46 -0
  25. package/build/legacy/production.cjs.map +1 -0
  26. package/build/legacy/production.d.cts +10 -0
  27. package/build/legacy/production.d.ts +10 -0
  28. package/build/legacy/production.js +10 -0
  29. package/build/legacy/production.js.map +1 -0
  30. package/build/modern/PreactQueryDevtools-BKJv-YAr.d.cts +57 -0
  31. package/build/modern/PreactQueryDevtools-BKJv-YAr.d.ts +57 -0
  32. package/build/modern/PreactQueryDevtools.cjs +95 -0
  33. package/build/modern/PreactQueryDevtools.cjs.map +1 -0
  34. package/build/modern/PreactQueryDevtools.d.cts +4 -0
  35. package/build/modern/PreactQueryDevtools.d.ts +4 -0
  36. package/build/modern/PreactQueryDevtools.js +70 -0
  37. package/build/modern/PreactQueryDevtools.js.map +1 -0
  38. package/build/modern/PreactQueryDevtoolsPanel-tSWW-AUr.d.cts +51 -0
  39. package/build/modern/PreactQueryDevtoolsPanel-tSWW-AUr.d.ts +51 -0
  40. package/build/modern/PreactQueryDevtoolsPanel.cjs +91 -0
  41. package/build/modern/PreactQueryDevtoolsPanel.cjs.map +1 -0
  42. package/build/modern/PreactQueryDevtoolsPanel.d.cts +4 -0
  43. package/build/modern/PreactQueryDevtoolsPanel.d.ts +4 -0
  44. package/build/modern/PreactQueryDevtoolsPanel.js +66 -0
  45. package/build/modern/PreactQueryDevtoolsPanel.js.map +1 -0
  46. package/build/modern/index.cjs +50 -0
  47. package/build/modern/index.cjs.map +1 -0
  48. package/build/modern/index.d.cts +11 -0
  49. package/build/modern/index.d.ts +11 -0
  50. package/build/modern/index.js +14 -0
  51. package/build/modern/index.js.map +1 -0
  52. package/build/modern/production.cjs +46 -0
  53. package/build/modern/production.cjs.map +1 -0
  54. package/build/modern/production.d.cts +10 -0
  55. package/build/modern/production.d.ts +10 -0
  56. package/build/modern/production.js +10 -0
  57. package/build/modern/production.js.map +1 -0
  58. package/package.json +93 -8
  59. package/src/PreactQueryDevtools.tsx +127 -0
  60. package/src/PreactQueryDevtoolsPanel.tsx +110 -0
  61. package/src/index.ts +18 -0
  62. package/src/production.ts +5 -0
  63. package/README.md +0 -45
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
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");
30
+ function PreactQueryDevtoolsPanel(props) {
31
+ const queryClient = (0, import_preact_query.useQueryClient)(props.client);
32
+ const ref = (0, import_hooks.useRef)(null);
33
+ const {
34
+ errorTypes,
35
+ styleNonce,
36
+ shadowDOMTarget,
37
+ hideDisabledQueries,
38
+ theme
39
+ } = props;
40
+ const [devtools] = (0, import_hooks.useState)(
41
+ () => new import_query_devtools.TanstackQueryDevtoolsPanel({
42
+ client: queryClient,
43
+ queryFlavor: "Preact Query",
44
+ version: "5",
45
+ onlineManager: import_preact_query.onlineManager,
46
+ buttonPosition: "bottom-left",
47
+ position: "bottom",
48
+ initialIsOpen: true,
49
+ errorTypes,
50
+ styleNonce,
51
+ shadowDOMTarget,
52
+ onClose: props.onClose,
53
+ hideDisabledQueries,
54
+ theme
55
+ })
56
+ );
57
+ (0, import_hooks.useEffect)(() => {
58
+ devtools.setClient(queryClient);
59
+ }, [queryClient, devtools]);
60
+ (0, import_hooks.useEffect)(() => {
61
+ devtools.setOnClose(props.onClose ?? (() => {
62
+ }));
63
+ }, [props.onClose, devtools]);
64
+ (0, import_hooks.useEffect)(() => {
65
+ devtools.setErrorTypes(errorTypes || []);
66
+ }, [errorTypes, devtools]);
67
+ (0, import_hooks.useEffect)(() => {
68
+ devtools.setTheme(theme);
69
+ }, [theme, devtools]);
70
+ (0, import_hooks.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
+ PreactQueryDevtoolsPanel
90
+ });
91
+ //# sourceMappingURL=PreactQueryDevtoolsPanel.cjs.map
@@ -0,0 +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 { JSX, 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?: JSX.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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4C;AAC5C,0BAA8C;AAC9C,4BAA2C;AAqGvC;AAzDG,SAAS,yBACd,OACc;AACd,QAAM,kBAAc,oCAAe,MAAM,MAAM;AAC/C,QAAM,UAAM,qBAAuB,IAAI;AACvC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,QAAQ,QAAI;AAAA,IACjB,MACE,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,MACf;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACL;AAEA,8BAAU,MAAM;AACd,aAAS,UAAU,WAAW;AAAA,EAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;AAE1B,8BAAU,MAAM;AACd,aAAS,WAAW,MAAM,YAAY,MAAM;AAAA,IAAC,EAAE;AAAA,EACjD,GAAG,CAAC,MAAM,SAAS,QAAQ,CAAC;AAE5B,8BAAU,MAAM;AACd,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,8BAAU,MAAM;AACd,aAAS,SAAS,KAAK;AAAA,EACzB,GAAG,CAAC,OAAO,QAAQ,CAAC;AAEpB,8BAAU,MAAM;AACd,QAAI,IAAI,SAAS;AACf,eAAS,MAAM,IAAI,OAAO;AAAA,IAC5B;AACA,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,EACF;AAEJ;","names":[]}
@@ -0,0 +1,4 @@
1
+ import '@tanstack/query-devtools';
2
+ import '@tanstack/preact-query';
3
+ import 'preact';
4
+ export { D as DevtoolsPanelOptions, P as PreactQueryDevtoolsPanel } from './PreactQueryDevtoolsPanel-tSWW-AUr.cjs';
@@ -0,0 +1,4 @@
1
+ import '@tanstack/query-devtools';
2
+ import '@tanstack/preact-query';
3
+ import 'preact';
4
+ export { D as DevtoolsPanelOptions, P as PreactQueryDevtoolsPanel } from './PreactQueryDevtoolsPanel-tSWW-AUr.js';
@@ -0,0 +1,66 @@
1
+ // src/PreactQueryDevtoolsPanel.tsx
2
+ import { useRef, useState, useEffect } from "preact/hooks";
3
+ import { onlineManager, useQueryClient } from "@tanstack/preact-query";
4
+ import { TanstackQueryDevtoolsPanel } from "@tanstack/query-devtools";
5
+ import { jsx } from "preact/jsx-runtime";
6
+ function PreactQueryDevtoolsPanel(props) {
7
+ const queryClient = useQueryClient(props.client);
8
+ const ref = useRef(null);
9
+ const {
10
+ errorTypes,
11
+ styleNonce,
12
+ shadowDOMTarget,
13
+ hideDisabledQueries,
14
+ theme
15
+ } = props;
16
+ const [devtools] = useState(
17
+ () => new TanstackQueryDevtoolsPanel({
18
+ client: queryClient,
19
+ queryFlavor: "Preact Query",
20
+ version: "5",
21
+ onlineManager,
22
+ buttonPosition: "bottom-left",
23
+ position: "bottom",
24
+ initialIsOpen: true,
25
+ errorTypes,
26
+ styleNonce,
27
+ shadowDOMTarget,
28
+ onClose: props.onClose,
29
+ hideDisabledQueries,
30
+ theme
31
+ })
32
+ );
33
+ useEffect(() => {
34
+ devtools.setClient(queryClient);
35
+ }, [queryClient, devtools]);
36
+ useEffect(() => {
37
+ devtools.setOnClose(props.onClose ?? (() => {
38
+ }));
39
+ }, [props.onClose, devtools]);
40
+ useEffect(() => {
41
+ devtools.setErrorTypes(errorTypes || []);
42
+ }, [errorTypes, devtools]);
43
+ useEffect(() => {
44
+ devtools.setTheme(theme);
45
+ }, [theme, devtools]);
46
+ useEffect(() => {
47
+ if (ref.current) {
48
+ devtools.mount(ref.current);
49
+ }
50
+ return () => {
51
+ devtools.unmount();
52
+ };
53
+ }, [devtools]);
54
+ return /* @__PURE__ */ jsx(
55
+ "div",
56
+ {
57
+ style: { height: "500px", ...props.style },
58
+ className: "tsqd-parent-container",
59
+ ref
60
+ }
61
+ );
62
+ }
63
+ export {
64
+ PreactQueryDevtoolsPanel
65
+ };
66
+ //# sourceMappingURL=PreactQueryDevtoolsPanel.js.map
@@ -0,0 +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 { JSX, 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?: JSX.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":";AAAA,SAAS,QAAQ,UAAU,iBAAiB;AAC5C,SAAS,eAAe,sBAAsB;AAC9C,SAAS,kCAAkC;AAqGvC;AAzDG,SAAS,yBACd,OACc;AACd,QAAM,cAAc,eAAe,MAAM,MAAM;AAC/C,QAAM,MAAM,OAAuB,IAAI;AACvC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,QAAQ,IAAI;AAAA,IACjB,MACE,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,MACf;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACL;AAEA,YAAU,MAAM;AACd,aAAS,UAAU,WAAW;AAAA,EAChC,GAAG,CAAC,aAAa,QAAQ,CAAC;AAE1B,YAAU,MAAM;AACd,aAAS,WAAW,MAAM,YAAY,MAAM;AAAA,IAAC,EAAE;AAAA,EACjD,GAAG,CAAC,MAAM,SAAS,QAAQ,CAAC;AAE5B,YAAU,MAAM;AACd,aAAS,cAAc,cAAc,CAAC,CAAC;AAAA,EACzC,GAAG,CAAC,YAAY,QAAQ,CAAC;AAEzB,YAAU,MAAM;AACd,aAAS,SAAS,KAAK;AAAA,EACzB,GAAG,CAAC,OAAO,QAAQ,CAAC;AAEpB,YAAU,MAAM;AACd,QAAI,IAAI,SAAS;AACf,eAAS,MAAM,IAAI,OAAO;AAAA,IAC5B;AACA,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,EACF;AAEJ;","names":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ PreactQueryDevtools: () => PreactQueryDevtools2,
34
+ PreactQueryDevtoolsPanel: () => PreactQueryDevtoolsPanel2
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+ var Devtools = __toESM(require("./PreactQueryDevtools.cjs"), 1);
38
+ var DevtoolsPanel = __toESM(require("./PreactQueryDevtoolsPanel.cjs"), 1);
39
+ var PreactQueryDevtools2 = process.env.NODE_ENV !== "development" ? function() {
40
+ return null;
41
+ } : Devtools.PreactQueryDevtools;
42
+ var PreactQueryDevtoolsPanel2 = process.env.NODE_ENV !== "development" ? function() {
43
+ return null;
44
+ } : DevtoolsPanel.PreactQueryDevtoolsPanel;
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ PreactQueryDevtools,
48
+ PreactQueryDevtoolsPanel
49
+ });
50
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import * as Devtools from './PreactQueryDevtools'\nimport * as DevtoolsPanel from './PreactQueryDevtoolsPanel'\n\nexport const PreactQueryDevtools: (typeof Devtools)['PreactQueryDevtools'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : Devtools.PreactQueryDevtools\n\nexport const PreactQueryDevtoolsPanel: (typeof DevtoolsPanel)['PreactQueryDevtoolsPanel'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : DevtoolsPanel.PreactQueryDevtoolsPanel\n\nexport type DevtoolsPanelOptions = DevtoolsPanel.DevtoolsPanelOptions\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,6BAAAA;AAAA,EAAA,gCAAAC;AAAA;AAAA;AAAA,eAA0B;AAC1B,oBAA+B;AAExB,IAAMD,uBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACS;AAER,IAAMC,4BACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACc;","names":["PreactQueryDevtools","PreactQueryDevtoolsPanel"]}
@@ -0,0 +1,11 @@
1
+ import { D as Devtools } from './PreactQueryDevtools-BKJv-YAr.cjs';
2
+ import { D as DevtoolsPanelOptions$1, a as DevtoolsPanel } from './PreactQueryDevtoolsPanel-tSWW-AUr.cjs';
3
+ import '@tanstack/query-devtools';
4
+ import '@tanstack/preact-query';
5
+ import 'preact';
6
+
7
+ declare const PreactQueryDevtools: (typeof Devtools)['PreactQueryDevtools'];
8
+ declare const PreactQueryDevtoolsPanel: (typeof DevtoolsPanel)['PreactQueryDevtoolsPanel'];
9
+ type DevtoolsPanelOptions = DevtoolsPanelOptions$1;
10
+
11
+ export { type DevtoolsPanelOptions, PreactQueryDevtools, PreactQueryDevtoolsPanel };
@@ -0,0 +1,11 @@
1
+ import { D as Devtools } from './PreactQueryDevtools-BKJv-YAr.js';
2
+ import { D as DevtoolsPanelOptions$1, a as DevtoolsPanel } from './PreactQueryDevtoolsPanel-tSWW-AUr.js';
3
+ import '@tanstack/query-devtools';
4
+ import '@tanstack/preact-query';
5
+ import 'preact';
6
+
7
+ declare const PreactQueryDevtools: (typeof Devtools)['PreactQueryDevtools'];
8
+ declare const PreactQueryDevtoolsPanel: (typeof DevtoolsPanel)['PreactQueryDevtoolsPanel'];
9
+ type DevtoolsPanelOptions = DevtoolsPanelOptions$1;
10
+
11
+ export { type DevtoolsPanelOptions, PreactQueryDevtools, PreactQueryDevtoolsPanel };
@@ -0,0 +1,14 @@
1
+ // src/index.ts
2
+ import * as Devtools from "./PreactQueryDevtools.js";
3
+ import * as DevtoolsPanel from "./PreactQueryDevtoolsPanel.js";
4
+ var PreactQueryDevtools2 = process.env.NODE_ENV !== "development" ? function() {
5
+ return null;
6
+ } : Devtools.PreactQueryDevtools;
7
+ var PreactQueryDevtoolsPanel2 = process.env.NODE_ENV !== "development" ? function() {
8
+ return null;
9
+ } : DevtoolsPanel.PreactQueryDevtoolsPanel;
10
+ export {
11
+ PreactQueryDevtools2 as PreactQueryDevtools,
12
+ PreactQueryDevtoolsPanel2 as PreactQueryDevtoolsPanel
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import * as Devtools from './PreactQueryDevtools'\nimport * as DevtoolsPanel from './PreactQueryDevtoolsPanel'\n\nexport const PreactQueryDevtools: (typeof Devtools)['PreactQueryDevtools'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : Devtools.PreactQueryDevtools\n\nexport const PreactQueryDevtoolsPanel: (typeof DevtoolsPanel)['PreactQueryDevtoolsPanel'] =\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : DevtoolsPanel.PreactQueryDevtoolsPanel\n\nexport type DevtoolsPanelOptions = DevtoolsPanel.DevtoolsPanelOptions\n"],"mappings":";AAAA,YAAY,cAAc;AAC1B,YAAY,mBAAmB;AAExB,IAAMA,uBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACS;AAER,IAAMC,4BACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACV,SAAO;AACT,IACc;","names":["PreactQueryDevtools","PreactQueryDevtoolsPanel"]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/production.ts
31
+ var production_exports = {};
32
+ __export(production_exports, {
33
+ PreactQueryDevtools: () => PreactQueryDevtools2,
34
+ PreactQueryDevtoolsPanel: () => PreactQueryDevtoolsPanel2
35
+ });
36
+ module.exports = __toCommonJS(production_exports);
37
+ var Devtools = __toESM(require("./PreactQueryDevtools.cjs"), 1);
38
+ var DevtoolsPanel = __toESM(require("./PreactQueryDevtoolsPanel.cjs"), 1);
39
+ var PreactQueryDevtools2 = Devtools.PreactQueryDevtools;
40
+ var PreactQueryDevtoolsPanel2 = DevtoolsPanel.PreactQueryDevtoolsPanel;
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ PreactQueryDevtools,
44
+ PreactQueryDevtoolsPanel
45
+ });
46
+ //# sourceMappingURL=production.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/production.ts"],"sourcesContent":["import * as Devtools from './PreactQueryDevtools'\nimport * as DevtoolsPanel from './PreactQueryDevtoolsPanel'\n\nexport const PreactQueryDevtools = Devtools.PreactQueryDevtools\nexport const PreactQueryDevtoolsPanel = DevtoolsPanel.PreactQueryDevtoolsPanel\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,6BAAAA;AAAA,EAAA,gCAAAC;AAAA;AAAA;AAAA,eAA0B;AAC1B,oBAA+B;AAExB,IAAMD,uBAA+B;AACrC,IAAMC,4BAAyC;","names":["PreactQueryDevtools","PreactQueryDevtoolsPanel"]}
@@ -0,0 +1,10 @@
1
+ import { P as PreactQueryDevtools$1 } from './PreactQueryDevtools-BKJv-YAr.cjs';
2
+ import { P as PreactQueryDevtoolsPanel$1 } from './PreactQueryDevtoolsPanel-tSWW-AUr.cjs';
3
+ import '@tanstack/query-devtools';
4
+ import '@tanstack/preact-query';
5
+ import 'preact';
6
+
7
+ declare const PreactQueryDevtools: typeof PreactQueryDevtools$1;
8
+ declare const PreactQueryDevtoolsPanel: typeof PreactQueryDevtoolsPanel$1;
9
+
10
+ export { PreactQueryDevtools, PreactQueryDevtoolsPanel };
@@ -0,0 +1,10 @@
1
+ import { P as PreactQueryDevtools$1 } from './PreactQueryDevtools-BKJv-YAr.js';
2
+ import { P as PreactQueryDevtoolsPanel$1 } from './PreactQueryDevtoolsPanel-tSWW-AUr.js';
3
+ import '@tanstack/query-devtools';
4
+ import '@tanstack/preact-query';
5
+ import 'preact';
6
+
7
+ declare const PreactQueryDevtools: typeof PreactQueryDevtools$1;
8
+ declare const PreactQueryDevtoolsPanel: typeof PreactQueryDevtoolsPanel$1;
9
+
10
+ export { PreactQueryDevtools, PreactQueryDevtoolsPanel };
@@ -0,0 +1,10 @@
1
+ // src/production.ts
2
+ import * as Devtools from "./PreactQueryDevtools.js";
3
+ import * as DevtoolsPanel from "./PreactQueryDevtoolsPanel.js";
4
+ var PreactQueryDevtools2 = Devtools.PreactQueryDevtools;
5
+ var PreactQueryDevtoolsPanel2 = DevtoolsPanel.PreactQueryDevtoolsPanel;
6
+ export {
7
+ PreactQueryDevtools2 as PreactQueryDevtools,
8
+ PreactQueryDevtoolsPanel2 as PreactQueryDevtoolsPanel
9
+ };
10
+ //# sourceMappingURL=production.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/production.ts"],"sourcesContent":["import * as Devtools from './PreactQueryDevtools'\nimport * as DevtoolsPanel from './PreactQueryDevtoolsPanel'\n\nexport const PreactQueryDevtools = Devtools.PreactQueryDevtools\nexport const PreactQueryDevtoolsPanel = DevtoolsPanel.PreactQueryDevtoolsPanel\n"],"mappings":";AAAA,YAAY,cAAc;AAC1B,YAAY,mBAAmB;AAExB,IAAMA,uBAA+B;AACrC,IAAMC,4BAAyC;","names":["PreactQueryDevtools","PreactQueryDevtoolsPanel"]}
package/package.json CHANGED
@@ -1,10 +1,95 @@
1
1
  {
2
2
  "name": "@tanstack/preact-query-devtools",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @tanstack/preact-query-devtools",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
10
- }
3
+ "version": "5.92.0",
4
+ "description": "Developer tools to interact with and visualize the TanStack/preact-query cache",
5
+ "author": "tannerlinsley",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/TanStack/query.git",
10
+ "directory": "packages/preact-query-devtools"
11
+ },
12
+ "homepage": "https://tanstack.com/query",
13
+ "funding": {
14
+ "type": "github",
15
+ "url": "https://github.com/sponsors/tannerlinsley"
16
+ },
17
+ "type": "module",
18
+ "types": "build/legacy/index.d.ts",
19
+ "main": "build/legacy/index.cjs",
20
+ "module": "build/legacy/index.js",
21
+ "exports": {
22
+ ".": {
23
+ "@tanstack/custom-condition": "./src/index.ts",
24
+ "import": {
25
+ "types": "./build/modern/index.d.ts",
26
+ "default": "./build/modern/index.js"
27
+ },
28
+ "require": {
29
+ "types": "./build/modern/index.d.cts",
30
+ "default": "./build/modern/index.cjs"
31
+ }
32
+ },
33
+ "./production": {
34
+ "import": {
35
+ "types": "./build/modern/production.d.ts",
36
+ "default": "./build/modern/production.js"
37
+ },
38
+ "require": {
39
+ "types": "./build/modern/production.d.cts",
40
+ "default": "./build/modern/production.cjs"
41
+ }
42
+ },
43
+ "./build/modern/production.js": {
44
+ "import": {
45
+ "types": "./build/modern/production.d.ts",
46
+ "default": "./build/modern/production.js"
47
+ },
48
+ "require": {
49
+ "types": "./build/modern/production.d.cts",
50
+ "default": "./build/modern/production.cjs"
51
+ }
52
+ },
53
+ "./package.json": "./package.json"
54
+ },
55
+ "sideEffects": false,
56
+ "files": [
57
+ "build",
58
+ "src",
59
+ "!src/__tests__"
60
+ ],
61
+ "dependencies": {
62
+ "@tanstack/query-devtools": "5.93.0"
63
+ },
64
+ "devDependencies": {
65
+ "@preact/preset-vite": "^2.10.2",
66
+ "@testing-library/preact": "^3.2.4",
67
+ "eslint-config-preact": "^2.0.0",
68
+ "npm-run-all2": "^5.0.0",
69
+ "preact": "^10.28.0",
70
+ "typescript-eslint": "^8.54.0",
71
+ "@tanstack/preact-query": "5.93.0"
72
+ },
73
+ "peerDependencies": {
74
+ "preact": "^10.0.0",
75
+ "@tanstack/preact-query": "^5.93.0"
76
+ },
77
+ "scripts": {
78
+ "clean": "premove ./build ./coverage ./dist-ts",
79
+ "compile": "tsc --build",
80
+ "test:eslint": "eslint --concurrency=auto ./src",
81
+ "test:types": "npm-run-all --serial test:types:*",
82
+ "test:types:ts50": "node ../../node_modules/typescript50/lib/tsc.js --build tsconfig.legacy.json",
83
+ "test:types:ts51": "node ../../node_modules/typescript51/lib/tsc.js --build tsconfig.legacy.json",
84
+ "test:types:ts52": "node ../../node_modules/typescript52/lib/tsc.js --build tsconfig.legacy.json",
85
+ "test:types:ts53": "node ../../node_modules/typescript53/lib/tsc.js --build tsconfig.legacy.json",
86
+ "test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js --build tsconfig.legacy.json",
87
+ "test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js --build tsconfig.legacy.json",
88
+ "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js --build tsconfig.legacy.json",
89
+ "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js --build tsconfig.legacy.json",
90
+ "test:types:tscurrent": "tsc --build",
91
+ "test:build": "publint --strict && attw --pack",
92
+ "build": "tsup --tsconfig tsconfig.prod.json",
93
+ "build:dev": "tsup --watch"
94
+ }
95
+ }
@@ -0,0 +1,127 @@
1
+ import { useRef, useState, useEffect } from 'preact/hooks'
2
+ import { onlineManager, useQueryClient } from '@tanstack/preact-query'
3
+ import { TanstackQueryDevtools } from '@tanstack/query-devtools'
4
+ import type {
5
+ DevtoolsButtonPosition,
6
+ DevtoolsErrorType,
7
+ DevtoolsPosition,
8
+ Theme,
9
+ } from '@tanstack/query-devtools'
10
+ import type { QueryClient } from '@tanstack/preact-query'
11
+ import type { VNode } from 'preact'
12
+
13
+ export interface DevtoolsOptions {
14
+ /**
15
+ * Set this true if you want the dev tools to default to being open
16
+ */
17
+ initialIsOpen?: boolean
18
+ /**
19
+ * The position of the TanStack logo to open and close the devtools panel.
20
+ * Defaults to 'bottom-right'.
21
+ */
22
+ buttonPosition?: DevtoolsButtonPosition
23
+ /**
24
+ * The position of the Preact Query devtools panel.
25
+ * Defaults to 'bottom'.
26
+ */
27
+ position?: DevtoolsPosition
28
+ /**
29
+ * Use this to provide a custom QueryClient. Otherwise, the one from the
30
+ * nearest QueryClientProvider will be used.
31
+ */
32
+ client?: QueryClient
33
+ /**
34
+ * Use this to provide custom error type handlers for the devtools panel.
35
+ */
36
+ errorTypes?: Array<DevtoolsErrorType>
37
+ /**
38
+ * Use this to pass a nonce to the style tag that is added to the document
39
+ * head. This is useful if you are using a Content Security Policy (CSP)
40
+ * nonce to allow inline styles.
41
+ */
42
+ styleNonce?: string
43
+ /**
44
+ * Use this to render the devtools inside a Shadow DOM.
45
+ */
46
+ shadowDOMTarget?: ShadowRoot
47
+ /**
48
+ * Use this to hide disabled queries from the devtools panel.
49
+ */
50
+ hideDisabledQueries?: boolean
51
+ /**
52
+ * Use this to set the theme of the devtools panel.
53
+ * Defaults to 'system'.
54
+ */
55
+ theme?: Theme
56
+ }
57
+
58
+ export function PreactQueryDevtools(props: DevtoolsOptions): VNode | null {
59
+ const queryClient = useQueryClient(props.client)
60
+ const ref = useRef<HTMLDivElement>(null)
61
+ const {
62
+ buttonPosition,
63
+ position,
64
+ initialIsOpen,
65
+ errorTypes,
66
+ styleNonce,
67
+ shadowDOMTarget,
68
+ hideDisabledQueries,
69
+ theme,
70
+ } = props
71
+ const [devtools] = useState(
72
+ () =>
73
+ new TanstackQueryDevtools({
74
+ client: queryClient,
75
+ queryFlavor: 'Preact Query',
76
+ version: '5',
77
+ onlineManager,
78
+ buttonPosition,
79
+ position,
80
+ initialIsOpen,
81
+ errorTypes,
82
+ styleNonce,
83
+ shadowDOMTarget,
84
+ hideDisabledQueries,
85
+ theme,
86
+ }),
87
+ )
88
+
89
+ useEffect(() => {
90
+ devtools.setClient(queryClient)
91
+ }, [queryClient, devtools])
92
+
93
+ useEffect(() => {
94
+ if (buttonPosition) {
95
+ devtools.setButtonPosition(buttonPosition)
96
+ }
97
+ }, [buttonPosition, devtools])
98
+
99
+ useEffect(() => {
100
+ if (position) {
101
+ devtools.setPosition(position)
102
+ }
103
+ }, [position, devtools])
104
+
105
+ useEffect(() => {
106
+ devtools.setInitialIsOpen(initialIsOpen || false)
107
+ }, [initialIsOpen, devtools])
108
+
109
+ useEffect(() => {
110
+ devtools.setErrorTypes(errorTypes || [])
111
+ }, [errorTypes, devtools])
112
+
113
+ useEffect(() => {
114
+ devtools.setTheme(theme)
115
+ }, [theme, devtools])
116
+
117
+ useEffect(() => {
118
+ if (ref.current) {
119
+ devtools.mount(ref.current)
120
+ }
121
+ return () => {
122
+ devtools.unmount()
123
+ }
124
+ }, [devtools])
125
+
126
+ return <div dir="ltr" className="tsqd-parent-container" ref={ref} />
127
+ }