UNPKG

caper-preact

Version:

A library for building declarative, stateful user interfaces.

52 lines 2.26 kB
import { Mailbox, ActorCreator, ComponentMailbox, Process, createMount } from '@matthewp/caper'; import { type VNode } from 'preact'; export { spawn, send, tools, type StartMessage, type PropsMessage, type Process } from '@matthewp/caper'; export declare const createComponent: <M extends Mailbox>(fn: ActorCreator<ComponentMailbox<M>>) => { new (props: any): { url: Process<Mailbox>; setUI: (ui: VNode) => void; componentWillMount(): void; componentDidUpdate(prevProps: any, prevState: any): void; render(): VNode<{}> | null; componentDidMount?(): void; componentWillUnmount?(): void; getChildContext?(): object; componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void; shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<{ ui: VNode | null; }>, nextContext: any): boolean; componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{ ui: VNode | null; }>, nextContext: any): void; getSnapshotBeforeUpdate?(oldProps: Readonly<any>, oldState: Readonly<{ ui: VNode | null; }>): any; componentDidCatch?(error: any, errorInfo: import("preact").ErrorInfo): void; state: Readonly<{ ui: VNode | null; }>; props: any; context: any; base?: Element | Text; setState<K extends "ui">(state: ((prevState: Readonly<{ ui: VNode | null; }>, props: Readonly<any>) => Pick<{ ui: VNode | null; }, K> | Partial<{ ui: VNode | null; }> | null) | Pick<{ ui: VNode | null; }, K> | Partial<{ ui: VNode | null; }> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; }; displayName?: string; defaultProps?: any; contextType?: import("preact").Context<any>; getDerivedStateFromProps?(props: Readonly<object>, state: Readonly<object>): object | null; getDerivedStateFromError?(error: any): object | null; }; type Mount = ReturnType<typeof createMount<VNode>>; export declare const mount: Mount; //# sourceMappingURL=main.d.ts.map