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

types.ts

118 lines3.8 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 * @deprecated The devtools no longer add a `<style>` element, so they need no
39 * nonce. This option does nothing.
40 */
41 styleNonce?: string
42 /**
43 * The shadow root to add the devtools styles to. By default, the styles are
44 * added to the shadow root the devtools render in, or to the document when
45 * they do not render in a shadow root.
46 */
47 shadowDOMTarget?: ShadowRoot
48 /**
49 * The Trusted Types policy the devtools use to create their HTML templates.
50 * Pass one when your page enforces `require-trusted-types-for 'script'`.
51 * The devtools only pass it their own markup.
52 */
53 trustedTypesPolicy?: { createHTML: (html: string) => unknown }
54 /**
55 * Set this to true to hide disabled queries from the devtools panel.
56 */
57 hideDisabledQueries?: boolean
58 /**
59 * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
60 * This overrides the theme selected in the devtools Settings menu. When omitted, the
61 * selected theme is used, or `'system'` if none is selected.
62 */
63 theme?: Theme
65​
66/**
67 * The props of `VueQueryDevtoolsPanel`, which renders the devtools panel inline.
68 */
69export interface DevtoolsPanelOptions {
70 /**
71 * Custom instance of QueryClient
72 */
73 client?: QueryClient
74 /**
75 * Use this so you can define custom errors that can be shown in the devtools.
76 */
77 errorTypes?: Array<DevtoolsErrorType>
78 /**
79 * @deprecated The devtools no longer add a `<style>` element, so they need no
80 * nonce. This option does nothing.
81 */
82 styleNonce?: string
83 /**
84 * The shadow root to add the devtools styles to. By default, the styles are
85 * added to the shadow root the devtools render in, or to the document when
86 * they do not render in a shadow root.
87 */
88 shadowDOMTarget?: ShadowRoot
89 /**
90 * The Trusted Types policy the devtools use to create their HTML templates.
91 * Pass one when your page enforces `require-trusted-types-for 'script'`.
92 * The devtools only pass it their own markup.
93 */
94 trustedTypesPolicy?: { createHTML: (html: string) => unknown }
95​
96 /**
97 * Custom styles for the devtools panel
98 * @default { height: '100%', display: 'flex', flexDirection: 'column' }
99 * @example { height: '100%' }
100 * @example { height: '100%', width: '100%' }
101 */
102 style?: Partial<CSSStyleDeclaration>
103​
104 /**
105 * Callback function that is called when the devtools panel is closed
106 */
107 onClose?: () => void
108 /**
109 * Set this to true to hide disabled queries from the devtools panel.
110 */
111 hideDisabledQueries?: boolean
112 /**
113 * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
114 * This overrides the theme selected in the devtools Settings menu. When omitted, the
115 * selected theme is used, or `'system'` if none is selected.
116 */
117 theme?: Theme