| 5 | import type { TanStackDevtoolsPluginProps } from '@tanstack/devtools' |
| 6 | |
| 7 | export function createSolidPlugin({ |
| 8 | Component, |
| 9 | ...config |
| 10 | }: { |
| 11 | name: string |
| 12 | id?: string |
| 13 | defaultOpen?: boolean |
| 14 | Component: (props: DevtoolsPanelProps) => JSX.Element |
| 15 | }) { |
| 16 | function Plugin() { |
| 17 | return { |
| 18 | ...config, |
| 19 | render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => { |
| 20 | return <Component {...props} /> |
| 21 | }, |
| 22 | } |
| 23 | } |
| 24 | function NoOpPlugin() { |
| 25 | return { |
| 26 | ...config, |
| 27 | render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => <></>, |
| 28 | } |
| 29 | } |
| 30 | return [Plugin, NoOpPlugin] as const |
| 31 | } |