@tanstack/vue-query-devtools 5.90.2 → 6.0.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.
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const vueQuery = require("@tanstack/vue-query");
4
+ const queryDevtools = require("@tanstack/query-devtools");
5
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
6
+ __name: "devtoolsPanel",
7
+ props: {
8
+ client: {},
9
+ errorTypes: {},
10
+ styleNonce: {},
11
+ shadowDOMTarget: {},
12
+ style: {},
13
+ onClose: { type: Function },
14
+ hideDisabledQueries: { type: Boolean }
15
+ },
16
+ setup(__props) {
17
+ const props = __props;
18
+ const style = vue.computed(() => {
19
+ return {
20
+ height: "500px",
21
+ ...props.style
22
+ };
23
+ });
24
+ const div = vue.ref();
25
+ const client = props.client || vueQuery.useQueryClient();
26
+ const devtools = new queryDevtools.TanstackQueryDevtoolsPanel({
27
+ client,
28
+ queryFlavor: "Vue Query",
29
+ version: "5",
30
+ onlineManager: vueQuery.onlineManager,
31
+ buttonPosition: "bottom-left",
32
+ position: "bottom",
33
+ initialIsOpen: true,
34
+ errorTypes: props.errorTypes,
35
+ styleNonce: props.styleNonce,
36
+ shadowDOMTarget: props.shadowDOMTarget,
37
+ hideDisabledQueries: props.hideDisabledQueries,
38
+ onClose: props.onClose
39
+ });
40
+ vue.watchEffect(() => {
41
+ devtools.setOnClose(props.onClose ?? (() => {
42
+ }));
43
+ devtools.setErrorTypes(props.errorTypes || []);
44
+ });
45
+ vue.onMounted(() => {
46
+ devtools.mount(div.value);
47
+ });
48
+ vue.onScopeDispose(() => {
49
+ devtools.unmount();
50
+ });
51
+ return (_ctx, _cache) => {
52
+ return vue.openBlock(), vue.createElementBlock("div", {
53
+ style: vue.normalizeStyle(style.value),
54
+ className: "tsqd-parent-container",
55
+ ref_key: "div",
56
+ ref: div
57
+ }, null, 4);
58
+ };
59
+ }
60
+ });
61
+ module.exports = _sfc_main;
62
+ //# sourceMappingURL=devtoolsPanel.vue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtoolsPanel.vue.cjs","sources":["../../src/devtoolsPanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, onScopeDispose, ref, watchEffect } from 'vue'\nimport { onlineManager, useQueryClient } from '@tanstack/vue-query'\nimport { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'\nimport type { StyleValue } from 'vue'\nimport type { DevtoolsPanelOptions } from './types'\n\nconst props = defineProps<DevtoolsPanelOptions>()\nconst style = computed<StyleValue>(() => {\n return {\n height: '500px',\n ...props.style,\n }\n})\n\nconst div = ref<HTMLElement>()\nconst client = props.client || useQueryClient()\nconst devtools = new TanstackQueryDevtoolsPanel({\n client,\n queryFlavor: 'Vue Query',\n version: '5',\n onlineManager,\n buttonPosition: 'bottom-left',\n position: 'bottom',\n initialIsOpen: true,\n errorTypes: props.errorTypes,\n styleNonce: props.styleNonce,\n shadowDOMTarget: props.shadowDOMTarget,\n hideDisabledQueries: props.hideDisabledQueries,\n onClose: props.onClose,\n})\n\nwatchEffect(() => {\n devtools.setOnClose(props.onClose ?? (() => {}))\n devtools.setErrorTypes(props.errorTypes || [])\n})\n\nonMounted(() => {\n devtools.mount(div.value as HTMLElement)\n})\n\nonScopeDispose(() => {\n devtools.unmount()\n})\n</script>\n\n<template>\n <div :style=\"style\" className=\"tsqd-parent-container\" ref=\"div\"></div>\n</template>\n"],"names":["computed","ref","useQueryClient","TanstackQueryDevtoolsPanel","onlineManager","watchEffect","onMounted","onScopeDispose"],"mappings":";;;;;;;;;;;;;;;;AAOA,UAAM,QAAQ;AACR,UAAA,QAAQA,IAAAA,SAAqB,MAAM;AAChC,aAAA;AAAA,QACL,QAAQ;AAAA,QACR,GAAG,MAAM;AAAA,MACX;AAAA,IAAA,CACD;AAED,UAAM,MAAMC,IAAAA,IAAiB;AACvB,UAAA,SAAS,MAAM,UAAUC,wBAAe;AACxC,UAAA,WAAW,IAAIC,yCAA2B;AAAA,MAC9C;AAAA,MACA,aAAa;AAAA,MACb,SAAS;AAAA,MAAA,eACTC,SAAA;AAAA,MACA,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,eAAe;AAAA,MACf,YAAY,MAAM;AAAA,MAClB,YAAY,MAAM;AAAA,MAClB,iBAAiB,MAAM;AAAA,MACvB,qBAAqB,MAAM;AAAA,MAC3B,SAAS,MAAM;AAAA,IAAA,CAChB;AAEDC,QAAAA,YAAY,MAAM;AACP,eAAA,WAAW,MAAM,YAAY,MAAM;AAAA,MAAA,EAAG;AAC/C,eAAS,cAAc,MAAM,cAAc,CAAA,CAAE;AAAA,IAAA,CAC9C;AAEDC,QAAAA,UAAU,MAAM;AACL,eAAA,MAAM,IAAI,KAAoB;AAAA,IAAA,CACxC;AAEDC,QAAAA,eAAe,MAAM;AACnB,eAAS,QAAQ;AAAA,IAAA,CAClB;;;;;;;;;;;;"}
@@ -0,0 +1,12 @@
1
+ import { DevtoolsPanelOptions } from './types.cjs';
2
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<DevtoolsPanelOptions>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<DevtoolsPanelOptions>>>, {}, {}>;
3
+ export default _default;
4
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
5
+ type __VLS_TypePropsToOption<T> = {
6
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
7
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
8
+ } : {
9
+ type: import('vue').PropType<T[K]>;
10
+ required: true;
11
+ };
12
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ const devtoolsPanel_vue_vue_type_script_setup_true_lang = require("./devtoolsPanel.vue.cjs");
3
+ module.exports = devtoolsPanel_vue_vue_type_script_setup_true_lang;
4
+ //# sourceMappingURL=devtoolsPanel.vue2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtoolsPanel.vue2.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const devtools_vue_vue_type_script_setup_true_lang = require("./devtools.vue.cjs");
4
+ const devtoolsPanel_vue_vue_type_script_setup_true_lang = require("./devtoolsPanel.vue.cjs");
4
5
  const VueQueryDevtools = process.env.NODE_ENV !== "development" ? function() {
5
6
  return null;
6
7
  } : devtools_vue_vue_type_script_setup_true_lang;
8
+ const VueQueryDevtoolsPanel = process.env.NODE_ENV !== "development" ? function() {
9
+ return null;
10
+ } : devtoolsPanel_vue_vue_type_script_setup_true_lang;
7
11
  exports.VueQueryDevtools = VueQueryDevtools;
12
+ exports.VueQueryDevtoolsPanel = VueQueryDevtoolsPanel;
8
13
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import devtools from './devtools.vue'\nimport type { DefineComponent } from 'vue'\nimport type { DevtoolsOptions } from './types'\n\nexport const VueQueryDevtools = (\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtools\n) as DefineComponent<DevtoolsOptions, {}, unknown>\n"],"names":["devtools"],"mappings":";;;AAIO,MAAM,mBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAA;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import devtools from './devtools.vue'\nimport devtoolsPanel from './devtoolsPanel.vue'\nimport type { DefineComponent } from 'vue'\nimport type { DevtoolsOptions, DevtoolsPanelOptions } from './types'\n\nexport const VueQueryDevtools = (\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtools\n) as DefineComponent<DevtoolsOptions, {}, unknown>\n\nexport const VueQueryDevtoolsPanel = (\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtoolsPanel\n) as DefineComponent<DevtoolsPanelOptions, {}, unknown>\n"],"names":["devtools","devtoolsPanel"],"mappings":";;;;AAKO,MAAM,mBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAA;AAGC,MAAM,wBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAC;;;"}
@@ -1,3 +1,4 @@
1
1
  import { DefineComponent } from 'vue';
2
- import { DevtoolsOptions } from './types.cjs';
2
+ import { DevtoolsOptions, DevtoolsPanelOptions } from './types.cjs';
3
3
  export declare const VueQueryDevtools: DefineComponent<DevtoolsOptions, {}, unknown>;
4
+ export declare const VueQueryDevtoolsPanel: DefineComponent<DevtoolsPanelOptions, {}, unknown>;
@@ -38,3 +38,36 @@ export interface DevtoolsOptions {
38
38
  */
39
39
  hideDisabledQueries?: boolean;
40
40
  }
41
+ export interface DevtoolsPanelOptions {
42
+ /**
43
+ * Custom instance of QueryClient
44
+ */
45
+ client?: QueryClient;
46
+ /**
47
+ * Use this so you can define custom errors that can be shown in the devtools.
48
+ */
49
+ errorTypes?: Array<DevtoolsErrorType>;
50
+ /**
51
+ * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
52
+ */
53
+ styleNonce?: string;
54
+ /**
55
+ * Use this so you can attach the devtool's styles to specific element in the DOM.
56
+ */
57
+ shadowDOMTarget?: ShadowRoot;
58
+ /**
59
+ * Custom styles for the devtools panel
60
+ * @default { height: '500px' }
61
+ * @example { height: '100%' }
62
+ * @example { height: '100%', width: '100%' }
63
+ */
64
+ style?: React.CSSProperties;
65
+ /**
66
+ * Callback function that is called when the devtools panel is closed
67
+ */
68
+ onClose?: () => unknown;
69
+ /**
70
+ * Set this to true to hide disabled queries from the devtools panel.
71
+ */
72
+ hideDisabledQueries?: boolean;
73
+ }
@@ -0,0 +1,12 @@
1
+ import { DevtoolsPanelOptions } from './types.js';
2
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<DevtoolsPanelOptions>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<DevtoolsPanelOptions>>>, {}, {}>;
3
+ export default _default;
4
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
5
+ type __VLS_TypePropsToOption<T> = {
6
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
7
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
8
+ } : {
9
+ type: import('vue').PropType<T[K]>;
10
+ required: true;
11
+ };
12
+ };
@@ -0,0 +1,63 @@
1
+ import { defineComponent, computed, ref, watchEffect, onMounted, onScopeDispose, createElementBlock, openBlock, normalizeStyle } from "vue";
2
+ import { useQueryClient, onlineManager } from "@tanstack/vue-query";
3
+ import { TanstackQueryDevtoolsPanel } from "@tanstack/query-devtools";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "devtoolsPanel",
6
+ props: {
7
+ client: {},
8
+ errorTypes: {},
9
+ styleNonce: {},
10
+ shadowDOMTarget: {},
11
+ style: {},
12
+ onClose: { type: Function },
13
+ hideDisabledQueries: { type: Boolean }
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ const style = computed(() => {
18
+ return {
19
+ height: "500px",
20
+ ...props.style
21
+ };
22
+ });
23
+ const div = ref();
24
+ const client = props.client || useQueryClient();
25
+ const devtools = new TanstackQueryDevtoolsPanel({
26
+ client,
27
+ queryFlavor: "Vue Query",
28
+ version: "5",
29
+ onlineManager,
30
+ buttonPosition: "bottom-left",
31
+ position: "bottom",
32
+ initialIsOpen: true,
33
+ errorTypes: props.errorTypes,
34
+ styleNonce: props.styleNonce,
35
+ shadowDOMTarget: props.shadowDOMTarget,
36
+ hideDisabledQueries: props.hideDisabledQueries,
37
+ onClose: props.onClose
38
+ });
39
+ watchEffect(() => {
40
+ devtools.setOnClose(props.onClose ?? (() => {
41
+ }));
42
+ devtools.setErrorTypes(props.errorTypes || []);
43
+ });
44
+ onMounted(() => {
45
+ devtools.mount(div.value);
46
+ });
47
+ onScopeDispose(() => {
48
+ devtools.unmount();
49
+ });
50
+ return (_ctx, _cache) => {
51
+ return openBlock(), createElementBlock("div", {
52
+ style: normalizeStyle(style.value),
53
+ className: "tsqd-parent-container",
54
+ ref_key: "div",
55
+ ref: div
56
+ }, null, 4);
57
+ };
58
+ }
59
+ });
60
+ export {
61
+ _sfc_main as default
62
+ };
63
+ //# sourceMappingURL=devtoolsPanel.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtoolsPanel.vue.js","sources":["../../src/devtoolsPanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, onScopeDispose, ref, watchEffect } from 'vue'\nimport { onlineManager, useQueryClient } from '@tanstack/vue-query'\nimport { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'\nimport type { StyleValue } from 'vue'\nimport type { DevtoolsPanelOptions } from './types'\n\nconst props = defineProps<DevtoolsPanelOptions>()\nconst style = computed<StyleValue>(() => {\n return {\n height: '500px',\n ...props.style,\n }\n})\n\nconst div = ref<HTMLElement>()\nconst client = props.client || useQueryClient()\nconst devtools = new TanstackQueryDevtoolsPanel({\n client,\n queryFlavor: 'Vue Query',\n version: '5',\n onlineManager,\n buttonPosition: 'bottom-left',\n position: 'bottom',\n initialIsOpen: true,\n errorTypes: props.errorTypes,\n styleNonce: props.styleNonce,\n shadowDOMTarget: props.shadowDOMTarget,\n hideDisabledQueries: props.hideDisabledQueries,\n onClose: props.onClose,\n})\n\nwatchEffect(() => {\n devtools.setOnClose(props.onClose ?? (() => {}))\n devtools.setErrorTypes(props.errorTypes || [])\n})\n\nonMounted(() => {\n devtools.mount(div.value as HTMLElement)\n})\n\nonScopeDispose(() => {\n devtools.unmount()\n})\n</script>\n\n<template>\n <div :style=\"style\" className=\"tsqd-parent-container\" ref=\"div\"></div>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA,UAAM,QAAQ;AACR,UAAA,QAAQ,SAAqB,MAAM;AAChC,aAAA;AAAA,QACL,QAAQ;AAAA,QACR,GAAG,MAAM;AAAA,MACX;AAAA,IAAA,CACD;AAED,UAAM,MAAM,IAAiB;AACvB,UAAA,SAAS,MAAM,UAAU,eAAe;AACxC,UAAA,WAAW,IAAI,2BAA2B;AAAA,MAC9C;AAAA,MACA,aAAa;AAAA,MACb,SAAS;AAAA,MACT;AAAA,MACA,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,eAAe;AAAA,MACf,YAAY,MAAM;AAAA,MAClB,YAAY,MAAM;AAAA,MAClB,iBAAiB,MAAM;AAAA,MACvB,qBAAqB,MAAM;AAAA,MAC3B,SAAS,MAAM;AAAA,IAAA,CAChB;AAED,gBAAY,MAAM;AACP,eAAA,WAAW,MAAM,YAAY,MAAM;AAAA,MAAA,EAAG;AAC/C,eAAS,cAAc,MAAM,cAAc,CAAA,CAAE;AAAA,IAAA,CAC9C;AAED,cAAU,MAAM;AACL,eAAA,MAAM,IAAI,KAAoB;AAAA,IAAA,CACxC;AAED,mBAAe,MAAM;AACnB,eAAS,QAAQ;AAAA,IAAA,CAClB;;;;;;;;;;;"}
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./devtoolsPanel.vue.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
5
+ //# sourceMappingURL=devtoolsPanel.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtoolsPanel.vue2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +1,4 @@
1
1
  import { DefineComponent } from 'vue';
2
- import { DevtoolsOptions } from './types.js';
2
+ import { DevtoolsOptions, DevtoolsPanelOptions } from './types.js';
3
3
  export declare const VueQueryDevtools: DefineComponent<DevtoolsOptions, {}, unknown>;
4
+ export declare const VueQueryDevtoolsPanel: DefineComponent<DevtoolsPanelOptions, {}, unknown>;
package/dist/esm/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  import _sfc_main from "./devtools.vue.js";
2
+ import _sfc_main$1 from "./devtoolsPanel.vue.js";
2
3
  const VueQueryDevtools = process.env.NODE_ENV !== "development" ? function() {
3
4
  return null;
4
5
  } : _sfc_main;
6
+ const VueQueryDevtoolsPanel = process.env.NODE_ENV !== "development" ? function() {
7
+ return null;
8
+ } : _sfc_main$1;
5
9
  export {
6
- VueQueryDevtools
10
+ VueQueryDevtools,
11
+ VueQueryDevtoolsPanel
7
12
  };
8
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import devtools from './devtools.vue'\nimport type { DefineComponent } from 'vue'\nimport type { DevtoolsOptions } from './types'\n\nexport const VueQueryDevtools = (\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtools\n) as DefineComponent<DevtoolsOptions, {}, unknown>\n"],"names":["devtools"],"mappings":";AAIO,MAAM,mBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import devtools from './devtools.vue'\nimport devtoolsPanel from './devtoolsPanel.vue'\nimport type { DefineComponent } from 'vue'\nimport type { DevtoolsOptions, DevtoolsPanelOptions } from './types'\n\nexport const VueQueryDevtools = (\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtools\n) as DefineComponent<DevtoolsOptions, {}, unknown>\n\nexport const VueQueryDevtoolsPanel = (\n process.env.NODE_ENV !== 'development'\n ? function () {\n return null\n }\n : devtoolsPanel\n) as DefineComponent<DevtoolsPanelOptions, {}, unknown>\n"],"names":["devtools","devtoolsPanel"],"mappings":";;AAKO,MAAM,mBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAA;AAGC,MAAM,wBACX,QAAQ,IAAI,aAAa,gBACrB,WAAY;AACH,SAAA;AACT,IACAC;"}
@@ -38,3 +38,36 @@ export interface DevtoolsOptions {
38
38
  */
39
39
  hideDisabledQueries?: boolean;
40
40
  }
41
+ export interface DevtoolsPanelOptions {
42
+ /**
43
+ * Custom instance of QueryClient
44
+ */
45
+ client?: QueryClient;
46
+ /**
47
+ * Use this so you can define custom errors that can be shown in the devtools.
48
+ */
49
+ errorTypes?: Array<DevtoolsErrorType>;
50
+ /**
51
+ * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
52
+ */
53
+ styleNonce?: string;
54
+ /**
55
+ * Use this so you can attach the devtool's styles to specific element in the DOM.
56
+ */
57
+ shadowDOMTarget?: ShadowRoot;
58
+ /**
59
+ * Custom styles for the devtools panel
60
+ * @default { height: '500px' }
61
+ * @example { height: '100%' }
62
+ * @example { height: '100%', width: '100%' }
63
+ */
64
+ style?: React.CSSProperties;
65
+ /**
66
+ * Callback function that is called when the devtools panel is closed
67
+ */
68
+ onClose?: () => unknown;
69
+ /**
70
+ * Set this to true to hide disabled queries from the devtools panel.
71
+ */
72
+ hideDisabledQueries?: boolean;
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/vue-query-devtools",
3
- "version": "5.90.2",
3
+ "version": "6.0.0",
4
4
  "description": "Developer tools to interact with and visualize the TanStack/vue-query cache",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -46,16 +46,16 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@vitejs/plugin-vue": "^5.2.4",
49
- "eslint-plugin-vue": "^9.27.0",
49
+ "eslint-plugin-vue": "^10.5.0",
50
50
  "typescript": "5.8.3",
51
51
  "vite": "^6.3.6",
52
52
  "vue": "^3.4.27",
53
53
  "vue-tsc": "^2.2.8",
54
- "@tanstack/vue-query": "5.90.2"
54
+ "@tanstack/vue-query": "5.91.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "vue": "^3.3.0",
58
- "@tanstack/vue-query": "^5.90.2"
58
+ "@tanstack/vue-query": "^5.91.0"
59
59
  },
60
60
  "scripts": {
61
61
  "clean": "premove ./build ./coverage ./dist-ts",
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import { computed, onMounted, onScopeDispose, ref, watchEffect } from 'vue'
3
+ import { onlineManager, useQueryClient } from '@tanstack/vue-query'
4
+ import { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'
5
+ import type { StyleValue } from 'vue'
6
+ import type { DevtoolsPanelOptions } from './types'
7
+
8
+ const props = defineProps<DevtoolsPanelOptions>()
9
+ const style = computed<StyleValue>(() => {
10
+ return {
11
+ height: '500px',
12
+ ...props.style,
13
+ }
14
+ })
15
+
16
+ const div = ref<HTMLElement>()
17
+ const client = props.client || useQueryClient()
18
+ const devtools = new TanstackQueryDevtoolsPanel({
19
+ client,
20
+ queryFlavor: 'Vue Query',
21
+ version: '5',
22
+ onlineManager,
23
+ buttonPosition: 'bottom-left',
24
+ position: 'bottom',
25
+ initialIsOpen: true,
26
+ errorTypes: props.errorTypes,
27
+ styleNonce: props.styleNonce,
28
+ shadowDOMTarget: props.shadowDOMTarget,
29
+ hideDisabledQueries: props.hideDisabledQueries,
30
+ onClose: props.onClose,
31
+ })
32
+
33
+ watchEffect(() => {
34
+ devtools.setOnClose(props.onClose ?? (() => {}))
35
+ devtools.setErrorTypes(props.errorTypes || [])
36
+ })
37
+
38
+ onMounted(() => {
39
+ devtools.mount(div.value as HTMLElement)
40
+ })
41
+
42
+ onScopeDispose(() => {
43
+ devtools.unmount()
44
+ })
45
+ </script>
46
+
47
+ <template>
48
+ <div :style="style" className="tsqd-parent-container" ref="div"></div>
49
+ </template>
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import devtools from './devtools.vue'
2
+ import devtoolsPanel from './devtoolsPanel.vue'
2
3
  import type { DefineComponent } from 'vue'
3
- import type { DevtoolsOptions } from './types'
4
+ import type { DevtoolsOptions, DevtoolsPanelOptions } from './types'
4
5
 
5
6
  export const VueQueryDevtools = (
6
7
  process.env.NODE_ENV !== 'development'
@@ -9,3 +10,11 @@ export const VueQueryDevtools = (
9
10
  }
10
11
  : devtools
11
12
  ) as DefineComponent<DevtoolsOptions, {}, unknown>
13
+
14
+ export const VueQueryDevtoolsPanel = (
15
+ process.env.NODE_ENV !== 'development'
16
+ ? function () {
17
+ return null
18
+ }
19
+ : devtoolsPanel
20
+ ) as DefineComponent<DevtoolsPanelOptions, {}, unknown>
package/src/types.ts CHANGED
@@ -43,3 +43,39 @@ export interface DevtoolsOptions {
43
43
  */
44
44
  hideDisabledQueries?: boolean
45
45
  }
46
+
47
+ export interface DevtoolsPanelOptions {
48
+ /**
49
+ * Custom instance of QueryClient
50
+ */
51
+ client?: QueryClient
52
+ /**
53
+ * Use this so you can define custom errors that can be shown in the devtools.
54
+ */
55
+ errorTypes?: Array<DevtoolsErrorType>
56
+ /**
57
+ * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
58
+ */
59
+ styleNonce?: string
60
+ /**
61
+ * Use this so you can attach the devtool's styles to specific element in the DOM.
62
+ */
63
+ shadowDOMTarget?: ShadowRoot
64
+
65
+ /**
66
+ * Custom styles for the devtools panel
67
+ * @default { height: '500px' }
68
+ * @example { height: '100%' }
69
+ * @example { height: '100%', width: '100%' }
70
+ */
71
+ style?: React.CSSProperties
72
+
73
+ /**
74
+ * Callback function that is called when the devtools panel is closed
75
+ */
76
+ onClose?: () => unknown
77
+ /**
78
+ * Set this to true to hide disabled queries from the devtools panel.
79
+ */
80
+ hideDisabledQueries?: boolean
81
+ }