Repository URL to install this package:
|
Version:
0.2.3 ▾
|
/// <reference types="react" />
import { ICompositeComponent } from './compositeComponent';
import { IDecoratorFunction } from './decoratorFunction';
import { IElementProps } from './elementProps';
import { ResolvedExports } from './exports';
import { IExtension } from './extension';
import { IHybridExport, IHybridHandlers } from './hybridHandlers';
import { IMiddlewareHook, IMiddlewareProvider } from './middleware';
import { IPropInjectionMap } from './propInjectionMap';
import { IReactComponent } from './reactComponent';
import { ISingletonProp } from './singletonProp';
import { IStateExportedUpdaters, IStateWrappedUpdaters } from './stateUpdaters';
import { IType } from './type';
import { ITypeTranslatedProps } from './typeTranslatedProps';
import { UnionToIntersection } from './utils';
/**
*
*
* @typeparam P Inner props
* @typeparam S Style identities
* @typeparam OP Outer props
* @typeparam EX Composer extensions
* @typeparam SX Style extensions
*/
export interface IComponent<P, S, OP, EX, SX, XP> {
compile(): IReactComponent<OP>;
decorate<XIP = {}, XS = {}, XOP = {}>(decorator: IDecoratorFunction): TComponent<P & XIP, S & XS, OP & XOP, EX, SX, XP>;
extends<T extends IComponent<any, any, any, any, SX, XP>>(component: T): T;
extract(): IComponentOptions;
export(): ResolvedExports<OP, XP>;
hybrid<T extends {
[index: string]: IType<any>;
}, U extends IHybridHandlers<T>>(props: T, handlers: U): TComponent<P & IHybridExport<T, U>, S, OP & Partial<IHybridExport<T, U>>, EX, SX, XP>;
inject<Q extends {
[index: string]: any;
}>(props: IPropInjectionMap<Q>): TComponent<P & Q, S, OP, EX, SX, XP>;
inject<T, I extends string = string>(propName: I, idenfitier: symbol | string): TComponent<P & ISingletonProp<I, T>, S, OP, EX, SX, XP>;
props<Q extends {
[index: string]: IType<any>;
}>(props: Q): TComponent<P & ITypeTranslatedProps<Q>, S, OP & ITypeTranslatedProps<Q>, EX, SX, XP>;
provide(props: IPropInjectionMap<Partial<P>>): TComponent<P, S, OP, EX, SX, XP>;
provide<I extends keyof P>(propName: I, identifier: symbol | string): TComponent<P, S, OP, EX, SX, XP>;
reduce<XIP>(reducer: (props: P) => XIP): TComponent<XIP, S, OP, EX, SX, XP>;
render(fn: (props: P & IElementProps<S, SX>) => React.ReactElement<any> | null): TComponent<P, S, OP, EX, SX, XP>;
state<T extends {
[index: string]: IType<any>;
}, U extends IStateWrappedUpdaters<T, P>>(state: T, handlers: U): TComponent<P & ITypeTranslatedProps<T> & IStateExportedUpdaters<U>, S, OP, EX, SX, XP>;
use<I extends string, T>(hook: IMiddlewareHook<I, T, any>): TComponent<P & ISingletonProp<I, T>, S, OP, EX, SX, XP>;
use(provider: IMiddlewareProvider<any>): TComponent<P, S, OP, EX, SX, XP>;
use<F extends (self: ICompositeComponent<P, S, OP, EX, SX, XP>) => IExtension<P, S, OP, EX, SX, XP>>(extender: F): TComponent<P, S, OP, AddExToStack<EX, F>, SX, XP>;
}
export declare type AddExToStack<EX, F> = EX extends (self: ICompositeComponent<any, any, any, any, any, any>) => any ? (EX | F) : F;
export declare type TComponent<P = any, S = any, OP = any, EX = any, SX = any, XP = any> = IComponent<P, S, OP, EX, SX, XP> & UnionToIntersection<(EX extends (self: ICompositeComponent<any, any, any, any, any, any>) => infer R ? R : {}), {}>;
export interface IComponentOptions {
decorators: IDecoratorFunction[];
injectors: {
[index: string]: string;
};
renderFn: (props: any) => React.ReactElement<any> | null;
}