/* @refresh skip */ import { Query, QueryClient, onlineManager } from "@tanstack/query-core"; import "solid-js"; type XPosition = 'left' | 'right'; type YPosition = 'top' | 'bottom'; /** * The side of the screen the devtools panel opens on. */ type DevtoolsPosition = XPosition | YPosition; /** * The corner of the screen the toggle button is placed in, or `'relative'` to place it in the * normal document flow. */ type DevtoolsButtonPosition = `${YPosition}-${XPosition}` | 'relative'; /** * The color theme of the devtools. `'system'` follows the user's color scheme preference. */ type Theme = 'dark' | 'light' | 'system'; /** * A custom error that can be triggered on a query from the devtools. */ interface DevtoolsErrorType { /** * The name of the error. */ name: string; /** * How the error is initialized. */ initializer: (query: Query) => Error; } /** * The options shared by every devtools entry point: the `client` to inspect, the adapter's * `queryFlavor` and `version` shown in the header, and the display options. * `onClose` is only used by the panel entry point. */ interface QueryDevtoolsProps { /** * The `QueryClient` whose caches the devtools inspect. */ readonly client: QueryClient; /** * The adapter name shown next to the logo in the header, e.g. `'React Query'`. */ queryFlavor: string; /** * The adapter version shown next to `queryFlavor` in the header. */ version: string; /** * The `onlineManager` the devtools read and toggle to simulate going offline. */ onlineManager: typeof onlineManager; /** * The position of the TanStack logo to open and close the devtools panel. */ buttonPosition?: DevtoolsButtonPosition; /** * The position of the devtools panel. */ position?: DevtoolsPosition; /** * Set this to `true` if you want the devtools to default to being open. */ initialIsOpen?: boolean; /** * Use this so you can define custom errors that can be shown in the devtools. */ errorTypes?: Array; /** * The shadow root to add the devtools styles to. By default, the styles are added to the shadow * root the devtools render in, or to the document when they do not render in a shadow root. */ shadowDOMTarget?: ShadowRoot; /** * Callback function that is called when the devtools panel is closed. Only used by the panel * entry point. */ onClose?: () => void; /** * Set this to `true` to hide disabled queries from the devtools panel. */ hideDisabledQueries?: boolean; /** * Set this to `'light'`, `'dark'`, or `'system'` to change the theme of the devtools panel. */ theme?: Theme; } /** * The options for `TanstackQueryDevtools`, which mounts the floating devtools. */ interface TanstackQueryDevtoolsConfig extends QueryDevtoolsProps { /** * @deprecated The devtools no longer add a `