UNPKG

@tanstack/devtools-utils

Version:

TanStack Devtools utilities for creating your own devtools.

25 lines (24 loc) • 1.28 kB
import { TanStackDevtoolsPluginProps } from '@tanstack/devtools'; export interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps { } /** * Creates a Preact component that dynamically imports and mounts a devtools panel. SSR friendly. * @param devtoolsPackageName The name of the devtools package to be imported, e.g., '@tanstack/devtools-preact' * @param importName The name of the export to be imported from the devtools package (e.g., 'default' or 'DevtoolsCore') * @returns A Preact component that mounts the devtools * @example * ```tsx * // if the export is default * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact') * ``` * * @example * ```tsx * // if the export is named differently * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact', 'DevtoolsCore') * ``` */ export declare function createPreactPanel<TComponentProps extends DevtoolsPanelProps, TCoreDevtoolsClass extends { mount: (el: HTMLElement, props: TanStackDevtoolsPluginProps) => void; unmount: () => void; }>(CoreClass: new () => TCoreDevtoolsClass): readonly [(props: TComponentProps) => import("preact").JSX.Element, (_props: TComponentProps) => import("preact").JSX.Element];