import { Node } from 'headless-json-editor'; import { ReactNode } from 'react'; import { Editor } from './Editor'; type AnyOption = Record; export type WidgetProps = { node: T; editor: Editor; options?: Partial; }; /** * interface of generic json editor component. * it takes the current editor and the current node along with a localized option interface */ export type Widget = (props: WidgetProps) => ReactNode | null; /** * props of your decorated editor */ export type DecoratedWidgetProps = { node: NodeType; editor: Editor; options: NodeType['options']; setValue: (value: ValueType) => void; }; /** * interface to your decorated editor */ export type DecoratedWidget = (props: DecoratedWidgetProps) => ReactNode | null; /** * add setValue helper to editor component and reduce update cycles */ export declare function widget(WidgetComponent: DecoratedWidget): import("react").MemoExoticComponent<(props: WidgetProps) => ReactNode>; export type WidgetPlugin = { readonly id: string; use: (node: Node, options?: AnyOption) => boolean; Widget: Widget; }; export {};