UNPKG

web-atoms-core

Version:
70 lines 2.57 kB
import Bind from "./Bind"; import { IClassOf } from "./types"; export interface IAttributes { [key: string]: string | number | null | any; } export declare class RootObject { get vsProps(): { [k in keyof this]?: this[k] | Bind; } | { [k: string]: any; } | {}; } declare global { namespace JSX { interface ElementAttributesProperty { vsProps: any; } type HtmlPartial<T> = { [k in keyof T]?: { [tx in keyof T[k]]?: T[k][tx] | any; } | { eventClick?: any; eventBlur?: any; eventFocus?: any; text?: string | any; [key: string]: any; }; }; type IAllHtmlElements = HtmlPartial<HTMLElementTagNameMap>; interface IntrinsicElements extends IAllHtmlElements { } } } export declare type IMergedControl<T, T1> = { [P in keyof (T & T1)]?: (T & T1)[P]; } & { vsProps: { [P in keyof (T & T1)]?: (T & T1)[P]; }; }; export declare type NodeFactory = (a?: any, ...nodes: XNode[]) => XNode; export declare type AttachedNode = (n: any) => { [key: string]: any; }; export default class XNode { name: string | Function; attributes: IAttributes; children: XNode[] | XNode[][] | any[]; isProperty?: boolean; isTemplate?: boolean; static attach<T, T1 extends HTMLElementTagNameMap, K extends keyof T1>(n: IClassOf<T>, tag: K): new (...a: any[]) => IMergedControl<T, T1[K]>; static attach<T, T1>(n: IClassOf<T>, tag: (a?: Partial<T1>, ...nodes: XNode[]) => XNode): new (...a: any[]) => IMergedControl<T, T1>; static prepare<T>(n: any, isProperty?: boolean, isTemplate?: boolean): ((attributes: Partial<T>, ...nodes: XNode[]) => XNode); static template(): NodeFactory; /** * This is only for intellisense... */ static attached(): AttachedNode; static property(): NodeFactory; /** * Declares Root Namespace and Assembly. You can use return function to * to declare the type * @param ns Root Namespace */ static namespace(ns: string, assemblyName: string): (type: string, isTemplate?: boolean) => (c: any) => void; static create(name: string | Function, attributes: IAttributes, ...children: Array<XNode | XNode[] | any>): XNode; constructor(name: string | Function, attributes: IAttributes, children: XNode[] | XNode[][] | any[], isProperty?: boolean, isTemplate?: boolean); toString(): string; } //# sourceMappingURL=XNode.d.ts.map