@meonode/ui
Version:
A structured approach to component composition with built-in theming, prop separation, and dynamic children handling.
28 lines • 1.09 kB
TypeScript
import type { ComponentNode, NodeElement } from '../node.type';
import type { ReactNode } from 'react';
/**
* Higher-order component wrapper that converts BaseNode components into React components.
* This wrapper ensures proper theme propagation and component rendering in the React ecosystem.
*
* Key features:
* - Converts BaseNode instances to React elements via render()
* - Handles theme inheritance and merging
* - Preserves component props
* - Type-safe with generic prop types
* @template P - The props type for the wrapped component
* @param component Component function that returns a BaseNode or ReactNode
* @returns A React function component that handles BaseNode conversion and theme propagation
* @example
* ```ts
* // Basic usage
* const App = Component(() => {
* return Div({
* theme: { color: 'blue' }
* })
* })
* ```
*/
export declare function Component<P extends Record<string, any>>(component: (props: P & {
children?: NodeElement;
}) => ComponentNode): (props?: Partial<P>) => ReactNode;
//# sourceMappingURL=component.hoc.d.ts.map