Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

types.ts

102 lines3.2 KB

1import type {
2 DevtoolsButtonPosition,
3 DevtoolsErrorType,
4 DevtoolsPosition,
5 Theme,
6} from '@tanstack/query-devtools'
7import type { QueryClient } from '@tanstack/vue-query'
8​
9/**
10 * The props of `VueQueryDevtools`, which renders the devtools with a toggle button that opens them.
11 */
12export interface DevtoolsOptions {
13 /**
14 * Set this true if you want the dev tools to default to being open
15 */
16 initialIsOpen?: boolean
17 /**
18 * The position of the TanStack logo to open and close the devtools panel.
19 * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'
20 * @defaultValue bottom-right
21 */
22 buttonPosition?: DevtoolsButtonPosition
23 /**
24 * The position of the Vue Query devtools panel.
25 * 'top' | 'bottom' | 'left' | 'right'
26 * @defaultValue bottom
27 */
28 position?: DevtoolsPosition
29 /**
30 * Custom instance of QueryClient
31 */
32 client?: QueryClient
33 /**
34 * Use this so you can define custom errors that can be shown in the devtools.
35 */
36 errorTypes?: Array<DevtoolsErrorType>
37 /**
38 * 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.
39 */
40 styleNonce?: string
41 /**
42 * Use this to pass a shadow DOM target to the devtools so that the styles will be applied
43 * within the shadow DOM instead of within the head tag in the light DOM.
44 */
45 shadowDOMTarget?: ShadowRoot
46 /**
47 * Set this to true to hide disabled queries from the devtools panel.
48 */
49 hideDisabledQueries?: boolean
50 /**
51 * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
52 * This overrides the theme selected in the devtools Settings menu. When omitted, the
53 * selected theme is used, or `'system'` if none is selected.
54 */
55 theme?: Theme
57​
58/**
59 * The props of `VueQueryDevtoolsPanel`, which renders the devtools panel inline.
60 */
61export interface DevtoolsPanelOptions {
62 /**
63 * Custom instance of QueryClient
64 */
65 client?: QueryClient
66 /**
67 * Use this so you can define custom errors that can be shown in the devtools.
68 */
69 errorTypes?: Array<DevtoolsErrorType>
70 /**
71 * 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.
72 */
73 styleNonce?: string
74 /**
75 * Use this to pass a shadow DOM target to the devtools so that the styles will be applied
76 * within the shadow DOM instead of within the head tag in the light DOM.
77 */
78 shadowDOMTarget?: ShadowRoot
79​
80 /**
81 * Custom styles for the devtools panel
82 * @default { height: '500px' }
83 * @example { height: '100%' }
84 * @example { height: '100%', width: '100%' }
85 */
86 style?: Partial<CSSStyleDeclaration>
87​
88 /**
89 * Callback function that is called when the devtools panel is closed
90 */
91 onClose?: () => void
92 /**
93 * Set this to true to hide disabled queries from the devtools panel.
94 */
95 hideDisabledQueries?: boolean
96 /**
97 * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
98 * This overrides the theme selected in the devtools Settings menu. When omitted, the
99 * selected theme is used, or `'system'` if none is selected.
100 */
101 theme?: Theme