Open History to see the last commit
1/** @jsxImportSource preact */
2β
3import type { JSX } from 'preact'
4import type { DevtoolsPanelProps } from './panel'
5import type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'
6β
7export function createPreactPlugin({
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 <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}