fractal-core
Version:
A minimalist and well crafted app, content or component is our conviction
68 lines (67 loc) • 2.61 kB
TypeScript
import { Context, InputData, EventOptions, EventData, State } from './core';
import { HandlerMsg } from './handler';
import { CtxStateOf } from './input';
export interface InterfaceHelpers<S> {
ctx: Context<S>;
interfaceOf?: CtxInterfaceOf;
stateOf: CtxStateOf<any>;
in: CtxIn;
act: CtxAct;
inFn: CtxInFn;
actFn: CtxActFn;
vw?: CtxVw;
vws?: CtxVws;
group?: CtxGroup;
}
export declare const makeInterfaceHelpers: <S extends State>(ctx: Context<S>) => InterfaceHelpers<S>;
export interface CtxInterfaceOf {
(name: string, interfaceName: string): Promise<any>;
}
export declare const _interfaceOf: <S>(ctx: Context<S>) => (name: string, interfaceName: any) => Promise<any>;
export interface CtxIn {
(inputName: string, context?: any, param?: any, options?: EventOptions): InputData;
}
export declare const _in: <S>(ctx: Context<S>) => CtxIn;
export interface CtxAct {
(actionName: string, context?: any, param?: any, options?: EventOptions): InputData;
}
export declare const _act: <S>(ctx: Context<S>) => CtxAct;
export interface CtxInFn {
(inputName: string, context?: any, param?: any, options?: EventOptions): void;
}
export declare const _inFn: <S>(ctx: Context<S>) => CtxInFn;
export interface CtxActFn {
(actionName: string, context?: any, param?: any, options?: EventOptions): void;
}
export declare const _actFn: <S>(ctx: Context<S>) => CtxActFn;
export interface CtxVw {
(componentName: string): Promise<HandlerMsg>;
}
export declare const _vw: <S>(ctx: Context<S>) => CtxVw;
export interface CtxVws {
(names: string[]): Promise<HandlerMsg[]>;
}
export declare const _vws: <S>(ctx: Context<S>) => CtxVws;
export interface CtxGroup {
(groupName: string): Promise<HandlerMsg[]>;
}
export declare const _group: <S extends State>(ctx: Context<S>) => CtxGroup;
export declare function computeEvent(eventData: any, iData: InputData): EventData;
export declare const dispatchEv: <S>(ctx: Context<S>) => (event: any, iData: InputData) => Promise<void>;
export interface DispatchCtx {
(eventData: EventData): Promise<any>;
}
export declare const dispatch: <S>(ctx: Context<S>) => DispatchCtx;
/**
* Executes an input of aa certain component, passing to some data to him
*/
export interface CtxToComp {
(id: string, inputName: string, data?: any): any;
}
/**
* toComp function factory
* @param ctx
* @returns CtxToComp
*/
export declare const toComp: <S>(ctx: Context<S>) => CtxToComp;
export declare const invokeHandler: (error: any, dispatchCtx: DispatchCtx, handler: InputData | InputData[] | "ignore", event: Event) => void;