import { type Data } from '../common/types'; export type ControlMessage = { [key: string]: Data; } & { type: string; payload?: Payload; }; export type ControlInstanceKey = { elementKey: string; propPath: string; }; export type ControlInstanceArgs = { instanceKey: ControlInstanceKey; sendMessage: SendMessage; }; export type SendMessage = (message: M) => void; export declare abstract class ControlInstance { readonly instanceKey: ControlInstanceKey; protected readonly sendMessage: SendMessage; constructor({ instanceKey, sendMessage }: ControlInstanceArgs); get elementKey(): string; get propPath(): string; abstract recv(message: M): void; /** * Subscribe to changes to the instance state; returns an unsubscribe function. */ abstract subscribe(listener: () => void): () => void; /** * Returns true if the control represents a composite prop value (a prop that contains other props). * * In contrast with `children()`, this return value doesn't change over the control lifetime. */ abstract isCompositeProp(): boolean; /** * Returns a list of child control instances for this control's immediate nested props. */ abstract children(): ControlInstance[]; /** * Returns the control instance for the nested prop identified by `key`. * * For list controls, `key` is a stringified item index. */ abstract child(key: string): ControlInstance | undefined; /** * Returns true if the control resolves to a renderable node. * * In React, that means the resolved value is a `ReactNode`. In other renderers, it is the equivalent * renderable node type. */ abstract resolvesToRenderableNode(): boolean; } export declare class DefaultControlInstance extends ControlInstance { recv(_message: ControlMessage): void; subscribe(_listener: () => void): () => void; isCompositeProp(): boolean; children(): ControlInstance[]; child(_key: string): undefined; resolvesToRenderableNode(): boolean; } export type SendMessageType = I extends ControlInstance ? M : never; //# sourceMappingURL=instance.d.ts.map