import { api , h , svg } from 'haptic/dom' ; import type { Component , El , Tag } from 'haptic/dom' ; import type { Wire } from 'haptic/state' ; import type { GenericEventAttrs , HTMLAttrs , SVGAttrs , HTMLElements , SVGElements } from './jsx' ; api . patch = ( value , patchDOM ) => { const $wire = ( value && ! ! ( value as Wire ) . $wire ) as boolean ; if ( $wire && patchDOM ) { ( value as Wire ) . tasks . add ( patchDOM ) ; ( value as Wire ) ( ) ; } return $wire ; } ; export { api , h , svg } ; export type { Component , El , Tag } ; type DistributeWire < T > = T extends any ? Wire < T > : never ; declare namespace h { export namespace JSX { type MaybeWire < T > = T | DistributeWire < T > ; type AllowWireForProperties < T > = { [ K in keyof T ] : MaybeWire < T [ K ] > ; } ; type Element = HTMLElement | SVGElement | DocumentFragment ; interface ElementAttributesProperty { props : unknown ; } interface ElementChildrenAttribute { children : unknown ; } interface IntrinsicAttributes { children ? : never ; } type DOMAttributes < Target extends EventTarget > = GenericEventAttrs < Target > & { children ? : unknown ; } ; type HTMLAttributes < Target extends EventTarget > = AllowWireForProperties < Omit < HTMLAttrs , 'style' > > & { style ? : MaybeWire < string > | { [ key ] : MaybeWire < string | number > ; } ; } & DOMAttributes < Target > ; type SVGAttributes < Target extends EventTarget > = AllowWireForProperties < SVGAttrs > & HTMLAttributes < Target > ; type IntrinsicElements = { [ El in keyof HTMLElements ] : HTMLAttributes < HTMLElements [ El ] > ; } & { [ El in keyof SVGElements ] : SVGAttributes < SVGElements [ El ] > ; } ; } }