import type { ConfigValidator, IsSlotContent, SlotContent, Widget, WidgetFactory, WidgetProps, WidgetSlotContext, WidgetState } from '../types'; /** * Type extending the original Widget props and state with ExtraProps * * @template W - The base widget type to be extended. * @template ExtraProps - Additional properties to be added to the widget. * @template ExtraDirectives - Additional directives to be added to the widget. Defaults to an empty object. */ export type ExtendWidgetProps = Widget, ExtraProps, ExtraDirectives>, ExtendWidgetAdaptSlotWidgetProps, ExtraProps, ExtraDirectives>, W['api'], ExtendWidgetInterfaces>; /** * Combines two interface types into a single type. * * @template Interfaces - The base interface type. * @template ExtraInterfaces - The additional interface type to extend the base interface. * @typedef {Interfaces & ExtraInterfaces} ExtendWidgetInterfaces - The resulting type that includes properties from both Interfaces and ExtraInterfaces. */ export type ExtendWidgetInterfaces = Interfaces & ExtraInterfaces; /** * Type to adapt the slot content properties of a widget by extending its props, extra props, and extra directives. * * @template Props - The original properties of the widget slot context. * @template ExtraProps - Additional properties to extend the widget slot context. * @template ExtraDirectives - Additional directives to extend the widget slot context. * * @remarks * This type conditionally checks if `Props` extends `WidgetSlotContext` and, if so, extends the widget slot context * with additional properties and directives while omitting the original widget slot context properties. */ export type ExtendWidgetAdaptSlotContentProps, ExtraProps extends object, ExtraDirectives extends object> = Props extends WidgetSlotContext ? WidgetSlotContext> & Omit> : Props; /** * Type definition for extending widget properties with additional properties and directives. * * This type takes three generic parameters: * - `Props`: The original properties of the widget. * - `ExtraProps`: Additional properties to be merged with the original properties. * - `ExtraDirectives`: Additional directives to be merged with the original properties. * * The resulting type combines `ExtraProps` with the original `Props`. For each property in `Props`, * if the property is of type `SlotContent`, it will be extended with the additional properties and directives. * * @template Props - The original properties of the widget. * @template ExtraProps - Additional properties to be merged with the original properties. * @template ExtraDirectives - Additional directives to be merged with the original properties. */ export type ExtendWidgetAdaptSlotWidgetProps = ExtraProps & { [K in keyof Props]: IsSlotContent extends SlotContent ? SlotContent> : Props[K]; }; /** * Method to extend the original widget with extra props with validator * * @template W - The type of the widget. * @template ExtraProps - The type of the additional properties. * @template ExtraDirectives - The type of the additional directives (default is an empty object). * * @param factory - original widget factory * @param extraPropsDefaults - object containing default value for each extra prop * @param extraPropsConfig - object verifying the type of each extra prop * @param overrideDefaults - object overriding some default props of the widget to extend * @returns widget factory with the extra props */ export declare const extendWidgetProps: (factory: WidgetFactory, extraPropsDefaults: ExtraProps, extraPropsConfig?: ConfigValidator, overrideDefaults?: Partial>) => WidgetFactory>;