import type { Renderable } from '@tempots/dom';
import type { Controller } from '../../form';
import type { SchemaContext, JSONSchemaDefinition } from '../schema-context';
import type { WidgetFactory } from './widget-customization';
/**
 * Widget composition configuration
 */
export interface WidgetComposition {
    /** Layout type for composition */
    layout: 'horizontal' | 'vertical' | 'grid' | 'tabs' | 'accordion' | 'custom';
    /** Widgets to compose */
    widgets: ComposedWidget[];
    /** Layout-specific options */
    layoutOptions?: {
        /** Grid columns (for grid layout) */
        columns?: number;
        /** Gap between widgets */
        gap?: string;
        /** Alignment */
        align?: 'start' | 'center' | 'end' | 'stretch';
        /** Custom CSS classes */
        className?: string;
    };
    /** Conditional composition rules */
    conditions?: CompositionCondition[];
}
/**
 * Individual widget in a composition
 */
export interface ComposedWidget {
    /** Widget type/name */
    type: string;
    /** Widget-specific configuration */
    config?: Record<string, unknown>;
    /** Widget label/title */
    label?: string;
    /** Widget description */
    description?: string;
    /** Conditional visibility */
    condition?: string | ((value: unknown, formData: unknown) => boolean);
    /** Layout constraints */
    layout?: {
        /** Grid column span */
        colSpan?: number;
        /** Grid row span */
        rowSpan?: number;
        /** Flex grow factor */
        grow?: number;
        /** Flex shrink factor */
        shrink?: number;
        /** Minimum width */
        minWidth?: string;
        /** Maximum width */
        maxWidth?: string;
    };
    /** Custom styling */
    style?: Record<string, string>;
    /** Custom CSS classes */
    className?: string;
}
/**
 * Composition condition for dynamic widget selection
 */
export interface CompositionCondition {
    /** Condition to evaluate */
    condition: string | ((value: unknown, formData: unknown) => boolean);
    /** Composition to use when condition is true */
    then: WidgetComposition;
    /** Composition to use when condition is false */
    else?: WidgetComposition;
}
/**
 * Widget composition renderer
 */
export declare class WidgetComposer {
    private widgetFactories;
    /**
     * Register a widget factory for composition
     */
    registerWidget(name: string, factory: WidgetFactory): void;
    /**
     * Unregister a widget factory
     */
    unregisterWidget(name: string): void;
    /**
     * Render a composed widget
     */
    renderComposition(composition: WidgetComposition, controller: Controller<unknown>, ctx: SchemaContext): Renderable;
    /**
     * Evaluate composition conditions
     */
    private evaluateConditions;
    /**
     * Evaluate widget visibility condition
     */
    private evaluateWidgetCondition;
    /**
     * Evaluate a condition
     */
    private evaluateCondition;
    /**
     * Render an individual widget
     */
    private renderWidget;
    /**
     * Wrap widget with layout constraints and styling
     */
    private wrapWidget;
    /**
     * Apply layout to rendered widgets
     */
    private applyLayout;
}
/**
 * Global widget composer instance
 */
export declare const globalWidgetComposer: WidgetComposer;
/**
 * Extract widget composition from schema x:ui
 */
export declare function getWidgetComposition(schema: JSONSchemaDefinition): WidgetComposition | undefined;
/**
 * Helper to create a simple horizontal composition
 */
export declare function createHorizontalComposition(widgets: Array<{
    type: string;
    config?: Record<string, unknown>;
    label?: string;
}>, options?: {
    gap?: string;
    align?: 'start' | 'center' | 'end' | 'stretch';
}): WidgetComposition;
/**
 * Helper to create a simple grid composition
 */
export declare function createGridComposition(widgets: Array<{
    type: string;
    config?: Record<string, unknown>;
    label?: string;
    colSpan?: number;
    rowSpan?: number;
}>, columns: number, options?: {
    gap?: string;
}): WidgetComposition;
