import { LifecycleHandler, MountHandler, RenderFunction, VNode } from "./common"; import { IState } from "./states"; export type TShouldUpdate = (newProps: GProps, oldProps: GProps) => boolean; export interface ComponentInstance { vnode: VNode; isMounted: boolean; children: VNode; _shouldUpdate: TShouldUpdate; _defaultProps?: Partial; _proxy: object; _propState: IState; _render: RenderFunction; _mountHandlers: MountHandler[]; _renderHandlers: LifecycleHandler[]; _beforeNextRenderHandlers: (() => any)[]; _afterNextRenderHandlers: (() => any)[]; _unmountHandlers: LifecycleHandler[]; } /** * FACTORY COMPONENTS ONLY EXTENSION * Handler is called when component is mounted, rendered, and added to the DOM. * Can return an unmount handler, or a list of unmount handler. * Can be asynchronous but without return. * @param handler */ export declare function mounted(handler: MountHandler): void; /** * FACTORY COMPONENTS ONLY EXTENSION * Handler is called when component is unmounted, just before removed from the DOM. * Can be asynchronous. */ export declare function unmounted(handler: LifecycleHandler): LifecycleHandler>; /** * FACTORY COMPONENTS ONLY EXTENSION * Handler is called just after component is rendered. * Can be asynchronous. */ export declare function rendered(handler: LifecycleHandler): void; /** * UNIVERSAL EXTENSION * Set default props * TODO : OPTIMIZE - 0% * @param props Props object from first argument. * @param defaults Defaults to inject into props. */ export declare function defaultProps>(props: GProps, defaults: GDefaults): void; /** * UNIVERSAL EXTENSION * Optimize rendering by providing a shouldUpdate handler. * This handler will have old and new props as argument, and should return : * - false to keep current step and skip next rendering * - true to re-render the component with the new props. * Set handler to false as a shorthand to never update this component again when props changes. * @param handler */ export declare function shouldUpdate(handler: TShouldUpdate | boolean): TShouldUpdate; /** * Default compare props function. * Will only check for first level strict equality between objects A and B. * @see performances-helpers.ts advancedPropsCompare() to compare deeply */ export declare const shallowPropsCompare: (a: object, b: object) => boolean;