import { LGraphNode } from '../LGraphNode'; import { IBaseWidget, IBooleanWidget, IButtonWidget, IComboWidget, ICustomWidget, IKnobWidget, INumericWidget, ISliderWidget, IStringWidget, IWidget } from '../types/widgets'; import { BaseWidget } from './BaseWidget'; import { BooleanWidget } from './BooleanWidget'; import { ButtonWidget } from './ButtonWidget'; import { ComboWidget } from './ComboWidget'; import { KnobWidget } from './KnobWidget'; import { LegacyWidget } from './LegacyWidget'; import { NumberWidget } from './NumberWidget'; import { SliderWidget } from './SliderWidget'; import { TextWidget } from './TextWidget'; export type WidgetTypeMap = { button: ButtonWidget; toggle: BooleanWidget; slider: SliderWidget; knob: KnobWidget; combo: ComboWidget; number: NumberWidget; string: TextWidget; text: TextWidget; custom: LegacyWidget; [key: string]: BaseWidget; }; /** * Convert a widget POJO to a proper widget instance. * @param widget The POJO to convert. * @param node The node the widget belongs to. * @param wrapLegacyWidgets Whether to wrap legacy widgets in a `LegacyWidget` instance. * @returns A concrete widget instance. */ export declare function toConcreteWidget(widget: TWidget, node: LGraphNode, wrapLegacyWidgets?: true): WidgetTypeMap[TWidget["type"]]; export declare function toConcreteWidget(widget: TWidget, node: LGraphNode, wrapLegacyWidgets: false): WidgetTypeMap[TWidget["type"]] | undefined; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link IButtonWidget}. */ export declare function isButtonWidget(widget: IBaseWidget): widget is IButtonWidget; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link IBooleanWidget}. */ export declare function isBooleanWidget(widget: IBaseWidget): widget is IBooleanWidget; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link ISliderWidget}. */ export declare function isSliderWidget(widget: IBaseWidget): widget is ISliderWidget; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link IKnobWidget}. */ export declare function isKnobWidget(widget: IBaseWidget): widget is IKnobWidget; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link IComboWidget}. */ export declare function isComboWidget(widget: IBaseWidget): widget is IComboWidget; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link INumericWidget}. */ export declare function isNumberWidget(widget: IBaseWidget): widget is INumericWidget; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link IStringWidget}. */ export declare function isStringWidget(widget: IBaseWidget): widget is IStringWidget; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link ITextWidget}. */ export declare function isTextWidget(widget: IBaseWidget): widget is IStringWidget; /** Type guard: Narrow **from {@link IBaseWidget}** to {@link ICustomWidget}. */ export declare function isCustomWidget(widget: IBaseWidget): widget is ICustomWidget;