import { Renderable, type RenderableOptions } from "../../Renderable";
import type { RenderContext } from "../../types";
export type VChild = VNode | Renderable | VChild[] | null | undefined | false;
export interface PendingCall {
method: string;
args: any[];
isProperty?: boolean;
}
declare const BrandedVNode: unique symbol;
export interface VNode
{
[BrandedVNode]: true;
type: Construct
;
props?: P;
children?: C;
__delegateMap?: Record;
__pendingCalls?: PendingCall[];
}
export type ProxiedVNode> = VNode ? P : any> & {
[K in keyof InstanceType]: InstanceType[K] extends (...args: infer Args) => any ? (...args: Args) => ProxiedVNode : InstanceType[K];
};
export interface RenderableConstructor = RenderableOptions> {
new (ctx: RenderContext, options: P): Renderable;
}
export type FunctionalConstruct = (props: P, children?: VChild[]) => VNode;
export type Construct
= RenderableConstructor
? P : never> | FunctionalConstruct
;
export declare function h>(type: TCtor, props?: TCtor extends RenderableConstructor ? P : never, ...children: VChild[]): ProxiedVNode;
export declare function h(type: FunctionalConstruct
, props?: P, ...children: VChild[]): VNode
;
export declare function h
(type: Construct
, props?: P, ...children: VChild[]): VNode
| ProxiedVNode;
export declare function isVNode(node: any): node is VNode;
export declare function maybeMakeRenderable(ctx: RenderContext, node: Renderable | VNode | unknown): Renderable | null;
export declare function wrapWithDelegates>(instance: T, delegateMap: Record | undefined): T;
export type InstantiateFn = Renderable & {
__node?: NodeType;
};
export declare function instantiate(ctx: RenderContext, node: NodeType): InstantiateFn;
export type DelegateMap = Partial>;
export type ValidateShape = {
[K in keyof Given]: K extends keyof AllowedKeys ? NonNullable : never;
};
type InferNode = T extends InstantiateFn ? U : never;
export declare function delegate, InnerNode extends InferNode, TargetMap extends Record, const Mapping extends Partial>(mapping: ValidateShape, vnode: Factory): Renderable;
export declare function delegate, TargetMap extends Record, string>, const Mapping extends Partial>(mapping: ValidateShape, vnode: ProxiedVNode): ProxiedVNode;
export declare function delegate, const Mapping extends DelegateMap>>(mapping: ValidateShape, vnode: VNode & {
type: ConstructorType;
}): VNode;
export {};