import { VNode, VNodeTypes } from "./common"; import { ComponentInstance } from "./component"; export type TInitialValue = GType | ((oldValue?: GType) => GType); export declare const _prepareInitialValue: (initialValue: TInitialValue, oldValue?: GType) => GType; export type IAtom = { readonly type: VNodeTypes; toString(): string; value: GType; }; export type IState = IAtom & { set(newValue: TInitialValue): Promise; peek(): GType; sneak(value: GType): void; update(): void; register(): void; dispose(): void; }; export interface IComputeState extends IState { update(): void; } export type TDisposeHandler = () => void; export type TEffectHandler = (...rest: GArguments) => TDisposeHandler | void | Promise; type TCheckEffect = () => GCheck; export type TComputed = () => GType; /** * Invalidate a component instance. * Will batch components in a microtask to avoid unnecessary renders. */ export declare const invalidateComponent: (element: ComponentInstance, resolve?: () => any) => void; export declare function updateDomFromState(node: VNode, value: any): void; /** * TODO : DOC * @param initialValue */ export declare function state(initialValue?: TInitialValue): IState; export declare function effect(handler: TEffectHandler, check?: TCheckEffect): TDisposeHandler; export declare function changed(handler: TEffectHandler, check?: TCheckEffect): TDisposeHandler; export declare function compute(handler: TComputed): IComputeState; export {};