import { Static } from '@sinclair/typebox';
import { RuntimeApplication, RuntimeComponentSchema, RuntimeComponent, SlotSpec } from '@sunmao-ui/core';
import React from 'react';
import { UIServices, ComponentParamsFromApp } from './application';
import { TraitResult } from './trait';
export declare type ImplWrapperProps<KSlot extends string = string> = {
    component: RuntimeComponentSchema;
    childrenMap: ChildrenMap<KSlot>;
    services: UIServices;
    isInModule: boolean;
    app?: RuntimeApplication;
    slotProps?: unknown;
} & ComponentParamsFromApp;
export declare type ComponentImplProps<TState, TMethods, TSlots extends Record<string, SlotSpec>, KStyleSlot extends string, KEvent extends string> = ImplWrapperProps & TraitResult<KStyleSlot, KEvent>['props'] & RuntimeFunctions<TState, TMethods, TSlots> & {
    elementRef?: React.Ref<any>;
    getElement?: (ele: HTMLElement) => void;
};
export declare type ComponentImpl<TProps = any, TState = any, TMethods = Record<string, any>, TSlots extends Record<string, SlotSpec> = Record<string, any>, KStyleSlot extends string = string, KEvent extends string = string> = React.FC<TProps & ComponentImplProps<TState, TMethods, TSlots, KStyleSlot, KEvent>>;
export declare type ImplementedRuntimeComponent<KMethodName extends string, KStyleSlot extends string, KSlot extends string, KEvent extends string> = RuntimeComponent<KMethodName, KStyleSlot, KSlot, KEvent> & {
    impl: ComponentImpl;
};
export declare type ChildrenMap<KSlot extends string> = Record<string, Record<KSlot, RuntimeComponentSchema[]> & {
    _grandChildren?: RuntimeComponentSchema[];
    _allChildren: RuntimeComponentSchema[];
}>;
declare type SubscribeMethods<U> = (map: {
    [K in keyof U]: (parameters: U[K]) => void;
}) => void;
declare type MergeState<T> = (partialState: Partial<T>) => void;
export declare type SlotsElements<U extends Record<string, SlotSpec>> = {
    [K in keyof U]?: (props: Static<U[K]['slotProps']>) => React.ReactNode;
};
export declare type RuntimeFunctions<TState, TMethods, TSlots extends Record<string, SlotSpec>> = {
    mergeState: MergeState<TState>;
    subscribeMethods: SubscribeMethods<TMethods>;
    slotsElements: SlotsElements<TSlots>;
};
export {};
