import * as router from "./router" // tslint:disable-next-line declare namespace hyperdom { export interface VdomFragment { children: any[] } abstract class HyperdomComponent { public refreshImmediately (): void public refreshComponent (): void public refresh (): void } export abstract class RenderComponent extends HyperdomComponent { public abstract render (): VdomFragment | Component } export abstract class RoutesComponent extends HyperdomComponent { public abstract routes (): router.Route[] protected renderLayout (content: any): VdomFragment | Component } export type Component = RoutesComponent | RenderComponent interface DomAttachement { remove (): void detach (): void } export interface MountOpts { requestRender?: (render: () => void) => void window?: Window document?: Document router?: typeof router } export interface ObjectBinding { get (): string set (value: string): void } export type SimpleBinding = [object, string] | [object, string, (param: string) => any] export type Binding = ObjectBinding | SimpleBinding export type FnComponent = (model?: any) => VdomFragment export function append (root: HTMLElement, component: Component | FnComponent, opts?: MountOpts): DomAttachement export function replace (root: HTMLElement, component: Component | FnComponent, opts?: MountOpts): DomAttachement interface ModelMeta { error: { message: string, } } export interface HtmlNodeProps { [key: string]: string | number | object | boolean | undefined | null } export interface HyperdomNodeProps { binding?: Binding key?: string | number class?: string | string[] | object tabindex?: number onclick? (e?: Event): void } export type NodeProps = HtmlNodeProps & HyperdomNodeProps export interface HTMLLabelProps { for?: string } // TODO Date? export type Renderable = string | number | boolean | undefined | null | VdomFragment | Component const html: { (tag: string, nodeProps: NodeProps, ...children: Renderable[]): VdomFragment, (tag: string, ...children: Renderable[]): VdomFragment, rawHtml (tag: string, ...children: Renderable[]): VdomFragment, refresh (component?: object): void refreshAfter (promise?: Promise): void meta (model: object, property: string): ModelMeta, } export {html} export function rawHtml (tag: string, ...children: Renderable[]): VdomFragment export function rawHtml (tag: string, nodeProps: NodeProps, ...children: Renderable[]): VdomFragment export function viewComponent (component: Component): VdomFragment export function appendVDom (root: VdomFragment, component: Component | FnComponent): DomAttachement const jsx: ( tag: string | { new(props: T, children: Renderable[]): Component }, nodeProps: NodeProps | undefined, children?: Renderable | Renderable[], ) => VdomFragment export {jsx} export function norefresh (): void export function refreshify (fn: () => void, opts?: object): () => void export function binding (opts: object): void } export = hyperdom declare global { namespace JSX { interface WebViewHTMLAttributes extends HTMLElement { allowFullScreen?: boolean allowpopups?: boolean autoFocus?: boolean autosize?: boolean blinkfeatures?: string disableblinkfeatures?: string disableguestresize?: boolean disablewebsecurity?: boolean guestinstance?: string httpreferrer?: string nodeintegration?: boolean partition?: string plugins?: boolean preload?: string src?: string useragent?: string webpreferences?: string } interface SVGAttributes { // Attributes which also defined in HTMLAttributes // See comment in SVGDOMPropertyConfig.js className?: string color?: string height?: number | string id?: string lang?: string max?: number | string media?: string method?: string min?: number | string name?: string target?: string type?: string width?: number | string // Other HTML properties supported by SVG elements in browsers role?: string tabIndex?: number // SVG Specific attributes accentHeight?: number | string accumulate?: "none" | "sum" additive?: "replace" | "sum" alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" allowReorder?: "no" | "yes" alphabetic?: number | string amplitude?: number | string arabicForm?: "initial" | "medial" | "terminal" | "isolated" ascent?: number | string attributeName?: string attributeType?: string autoReverse?: number | string azimuth?: number | string baseFrequency?: number | string baselineShift?: number | string baseProfile?: number | string bbox?: number | string begin?: number | string bias?: number | string by?: number | string calcMode?: number | string capHeight?: number | string clip?: number | string clipPath?: string clipPathUnits?: number | string clipRule?: number | string colorInterpolation?: number | string colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" colorProfile?: number | string colorRendering?: number | string contentScriptType?: number | string contentStyleType?: number | string cursor?: number | string cx?: number | string cy?: number | string d?: string decelerate?: number | string descent?: number | string diffuseConstant?: number | string direction?: number | string display?: number | string divisor?: number | string dominantBaseline?: number | string dur?: number | string dx?: number | string dy?: number | string edgeMode?: number | string elevation?: number | string enableBackground?: number | string end?: number | string exponent?: number | string externalResourcesRequired?: number | string fill?: string fillOpacity?: number | string fillRule?: "nonzero" | "evenodd" | "inherit" filter?: string filterRes?: number | string filterUnits?: number | string floodColor?: number | string floodOpacity?: number | string focusable?: number | string fontFamily?: string fontSize?: number | string fontSizeAdjust?: number | string fontStretch?: number | string fontStyle?: number | string fontVariant?: number | string fontWeight?: number | string format?: number | string from?: number | string fx?: number | string fy?: number | string g1?: number | string g2?: number | string glyphName?: number | string glyphOrientationHorizontal?: number | string glyphOrientationVertical?: number | string glyphRef?: number | string gradientTransform?: string gradientUnits?: string hanging?: number | string horizAdvX?: number | string horizOriginX?: number | string href?: string ideographic?: number | string imageRendering?: number | string in2?: number | string in?: string intercept?: number | string k1?: number | string k2?: number | string k3?: number | string k4?: number | string k?: number | string kernelMatrix?: number | string kernelUnitLength?: number | string kerning?: number | string keyPoints?: number | string keySplines?: number | string keyTimes?: number | string lengthAdjust?: number | string letterSpacing?: number | string lightingColor?: number | string limitingConeAngle?: number | string local?: number | string markerEnd?: string markerHeight?: number | string markerMid?: string markerStart?: string markerUnits?: number | string markerWidth?: number | string mask?: string maskContentUnits?: number | string maskUnits?: number | string mathematical?: number | string mode?: number | string numOctaves?: number | string offset?: number | string opacity?: number | string operator?: number | string order?: number | string orient?: number | string orientation?: number | string origin?: number | string overflow?: number | string overlinePosition?: number | string overlineThickness?: number | string paintOrder?: number | string panose1?: number | string pathLength?: number | string patternContentUnits?: string patternTransform?: number | string patternUnits?: string pointerEvents?: number | string points?: string pointsAtX?: number | string pointsAtY?: number | string pointsAtZ?: number | string preserveAlpha?: number | string preserveAspectRatio?: string primitiveUnits?: number | string r?: number | string radius?: number | string refX?: number | string refY?: number | string renderingIntent?: number | string repeatCount?: number | string repeatDur?: number | string requiredExtensions?: number | string requiredFeatures?: number | string restart?: number | string result?: string rotate?: number | string rx?: number | string ry?: number | string scale?: number | string seed?: number | string shapeRendering?: number | string slope?: number | string spacing?: number | string specularConstant?: number | string specularExponent?: number | string speed?: number | string spreadMethod?: string startOffset?: number | string stdDeviation?: number | string stemh?: number | string stemv?: number | string stitchTiles?: number | string stopColor?: string stopOpacity?: number | string strikethroughPosition?: number | string strikethroughThickness?: number | string string?: number | string stroke?: string strokeDasharray?: string | number strokeDashoffset?: string | number strokeLinecap?: "butt" | "round" | "square" | "inherit" strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" strokeMiterlimit?: number | string strokeOpacity?: number | string strokeWidth?: number | string surfaceScale?: number | string systemLanguage?: number | string tableValues?: number | string targetX?: number | string targetY?: number | string textAnchor?: string textDecoration?: number | string textLength?: number | string textRendering?: number | string to?: number | string transform?: string u1?: number | string u2?: number | string underlinePosition?: number | string underlineThickness?: number | string unicode?: number | string unicodeBidi?: number | string unicodeRange?: number | string unitsPerEm?: number | string vAlphabetic?: number | string values?: string vectorEffect?: number | string version?: string vertAdvY?: number | string vertOriginX?: number | string vertOriginY?: number | string vHanging?: number | string vIdeographic?: number | string viewBox?: string viewTarget?: number | string visibility?: number | string vMathematical?: number | string widths?: number | string wordSpacing?: number | string writingMode?: number | string x1?: number | string x2?: number | string x?: number | string xChannelSelector?: string xHeight?: number | string xlinkActuate?: string xlinkArcrole?: string xlinkHref?: string xlinkRole?: string xlinkShow?: string xlinkTitle?: string xlinkType?: string xmlBase?: string xmlLang?: string xmlns?: string xmlnsXlink?: string xmlSpace?: string y1?: number | string y2?: number | string y?: number | string yChannelSelector?: string z?: number | string zoomAndPan?: string } type HyperdomSVGAttributes = SVGAttributes & Exclude & hyperdom.HyperdomNodeProps interface IntrinsicElements { // HTML & hyperdom.HyperdomNodeProps a: Partial & hyperdom.HyperdomNodeProps abbr: Partial & hyperdom.HyperdomNodeProps address: Partial & hyperdom.HyperdomNodeProps area: Partial & hyperdom.HyperdomNodeProps article: Partial & hyperdom.HyperdomNodeProps aside: Partial & hyperdom.HyperdomNodeProps audio: Partial & hyperdom.HyperdomNodeProps b: Partial & hyperdom.HyperdomNodeProps base: Partial & hyperdom.HyperdomNodeProps bdi: Partial & hyperdom.HyperdomNodeProps bdo: Partial & hyperdom.HyperdomNodeProps big: Partial & hyperdom.HyperdomNodeProps blockquote: Partial & hyperdom.HyperdomNodeProps body: Partial & hyperdom.HyperdomNodeProps br: Partial & hyperdom.HyperdomNodeProps button: Partial & hyperdom.HyperdomNodeProps canvas: Partial & hyperdom.HyperdomNodeProps caption: Partial & hyperdom.HyperdomNodeProps cite: Partial & hyperdom.HyperdomNodeProps code: Partial & hyperdom.HyperdomNodeProps col: Partial & hyperdom.HyperdomNodeProps colgroup: Partial & hyperdom.HyperdomNodeProps data: Partial & hyperdom.HyperdomNodeProps datalist: Partial & hyperdom.HyperdomNodeProps dd: Partial & hyperdom.HyperdomNodeProps del: Partial & hyperdom.HyperdomNodeProps details: Partial & hyperdom.HyperdomNodeProps dfn: Partial & hyperdom.HyperdomNodeProps dialog: Partial & hyperdom.HyperdomNodeProps div: Partial & hyperdom.HyperdomNodeProps dl: Partial & hyperdom.HyperdomNodeProps dt: Partial & hyperdom.HyperdomNodeProps em: Partial & hyperdom.HyperdomNodeProps embed: Partial & hyperdom.HyperdomNodeProps fieldset: Partial & hyperdom.HyperdomNodeProps figcaption: Partial & hyperdom.HyperdomNodeProps figure: Partial & hyperdom.HyperdomNodeProps footer: Partial & hyperdom.HyperdomNodeProps form: Partial & hyperdom.HyperdomNodeProps h1: Partial & hyperdom.HyperdomNodeProps h2: Partial & hyperdom.HyperdomNodeProps h3: Partial & hyperdom.HyperdomNodeProps h4: Partial & hyperdom.HyperdomNodeProps h5: Partial & hyperdom.HyperdomNodeProps h6: Partial & hyperdom.HyperdomNodeProps head: Partial & hyperdom.HyperdomNodeProps header: Partial & hyperdom.HyperdomNodeProps hgroup: Partial & hyperdom.HyperdomNodeProps hr: Partial & hyperdom.HyperdomNodeProps html: Partial & hyperdom.HyperdomNodeProps i: Partial & hyperdom.HyperdomNodeProps iframe: Partial & hyperdom.HyperdomNodeProps img: Partial & hyperdom.HyperdomNodeProps input: Partial & hyperdom.HyperdomNodeProps ins: Partial & hyperdom.HyperdomNodeProps kbd: Partial & hyperdom.HyperdomNodeProps keygen: Partial & hyperdom.HyperdomNodeProps label: Partial & hyperdom.HyperdomNodeProps & hyperdom.HTMLLabelProps legend: Partial & hyperdom.HyperdomNodeProps li: Partial & hyperdom.HyperdomNodeProps link: Partial & hyperdom.HyperdomNodeProps main: Partial & hyperdom.HyperdomNodeProps map: Partial & hyperdom.HyperdomNodeProps mark: Partial & hyperdom.HyperdomNodeProps menu: Partial & hyperdom.HyperdomNodeProps menuitem: Partial & hyperdom.HyperdomNodeProps meta: Partial & hyperdom.HyperdomNodeProps meter: Partial & hyperdom.HyperdomNodeProps nav: Partial & hyperdom.HyperdomNodeProps noindex: Partial & hyperdom.HyperdomNodeProps noscript: Partial & hyperdom.HyperdomNodeProps object: Partial & hyperdom.HyperdomNodeProps ol: Partial & hyperdom.HyperdomNodeProps optgroup: Partial & hyperdom.HyperdomNodeProps option: Partial & hyperdom.HyperdomNodeProps output: Partial & hyperdom.HyperdomNodeProps p: Partial & hyperdom.HyperdomNodeProps param: Partial & hyperdom.HyperdomNodeProps picture: Partial & hyperdom.HyperdomNodeProps pre: Partial & hyperdom.HyperdomNodeProps progress: Partial & hyperdom.HyperdomNodeProps q: Partial & hyperdom.HyperdomNodeProps rp: Partial & hyperdom.HyperdomNodeProps rt: Partial & hyperdom.HyperdomNodeProps ruby: Partial & hyperdom.HyperdomNodeProps s: Partial & hyperdom.HyperdomNodeProps samp: Partial & hyperdom.HyperdomNodeProps script: Partial & hyperdom.HyperdomNodeProps section: Partial & hyperdom.HyperdomNodeProps select: Partial & hyperdom.HyperdomNodeProps small: Partial & hyperdom.HyperdomNodeProps source: Partial & hyperdom.HyperdomNodeProps span: Partial & hyperdom.HyperdomNodeProps strong: Partial & hyperdom.HyperdomNodeProps style: Partial & hyperdom.HyperdomNodeProps sub: Partial & hyperdom.HyperdomNodeProps summary: Partial & hyperdom.HyperdomNodeProps sup: Partial & hyperdom.HyperdomNodeProps table: Partial & hyperdom.HyperdomNodeProps tbody: Partial & hyperdom.HyperdomNodeProps td: Partial & hyperdom.HyperdomNodeProps textarea: Partial & hyperdom.HyperdomNodeProps tfoot: Partial & hyperdom.HyperdomNodeProps th: Partial & hyperdom.HyperdomNodeProps thead: Partial & hyperdom.HyperdomNodeProps time: Partial & hyperdom.HyperdomNodeProps title: Partial & hyperdom.HyperdomNodeProps tr: Partial & hyperdom.HyperdomNodeProps track: Partial & hyperdom.HyperdomNodeProps u: Partial & hyperdom.HyperdomNodeProps ul: Partial & hyperdom.HyperdomNodeProps "var": Partial & hyperdom.HyperdomNodeProps video: Partial & hyperdom.HyperdomNodeProps wbr: Partial & hyperdom.HyperdomNodeProps webview: Partial & hyperdom.HyperdomNodeProps // SVG svg: HyperdomSVGAttributes animate: HyperdomSVGAttributes animateTransform: HyperdomSVGAttributes circle: HyperdomSVGAttributes clipPath: HyperdomSVGAttributes defs: HyperdomSVGAttributes desc: HyperdomSVGAttributes ellipse: HyperdomSVGAttributes feBlend: HyperdomSVGAttributes feColorMatrix: HyperdomSVGAttributes feComponentTransfer: HyperdomSVGAttributes feComposite: HyperdomSVGAttributes feConvolveMatrix: HyperdomSVGAttributes feDiffuseLighting: HyperdomSVGAttributes feDisplacementMap: HyperdomSVGAttributes feDistantLight: HyperdomSVGAttributes feFlood: HyperdomSVGAttributes feFuncA: HyperdomSVGAttributes feFuncB: HyperdomSVGAttributes feFuncG: HyperdomSVGAttributes feFuncR: HyperdomSVGAttributes feGaussianBlur: HyperdomSVGAttributes feImage: HyperdomSVGAttributes feMerge: HyperdomSVGAttributes feMergeNode: HyperdomSVGAttributes feMorphology: HyperdomSVGAttributes feOffset: HyperdomSVGAttributes fePointLight: HyperdomSVGAttributes feSpecularLighting: HyperdomSVGAttributes feSpotLight: HyperdomSVGAttributes feTile: HyperdomSVGAttributes feTurbulence: HyperdomSVGAttributes filter: HyperdomSVGAttributes foreignObject: HyperdomSVGAttributes g: HyperdomSVGAttributes image: HyperdomSVGAttributes line: HyperdomSVGAttributes linearGradient: HyperdomSVGAttributes marker: HyperdomSVGAttributes mask: HyperdomSVGAttributes metadata: HyperdomSVGAttributes path: HyperdomSVGAttributes pattern: HyperdomSVGAttributes polygon: HyperdomSVGAttributes polyline: HyperdomSVGAttributes radialGradient: HyperdomSVGAttributes rect: HyperdomSVGAttributes stop: HyperdomSVGAttributes switch: HyperdomSVGAttributes symbol: HyperdomSVGAttributes text: HyperdomSVGAttributes textPath: HyperdomSVGAttributes tspan: HyperdomSVGAttributes use: HyperdomSVGAttributes view: HyperdomSVGAttributes } } }