declare namespace JSX { export type IntrinsicElements = { [index: string]: any } type ElementType = Fragment | string | Component type Element = DLElement interface ElementAttributesProperty { props: {} } interface ElementChildrenAttribute { children: {} } } declare function h( type: string, props?: { [index: string]: any } | null, ...children: (HTMLElement | string)[] ): Node declare function $if( condition: DLPointer | any, then?: Element, otherwise?: Element ): HTMLElement type DLPointer = { readonly __symbol: unique symbol readonly __signature: T } declare function use(sink: T, mapping?: (arg: T) => any): DLPointer declare function useValue(trap: DLPointer): T type Stateful = T & { readonly symbol: unique symbol } declare function stateful(target: T): Stateful declare function $state(target: T): Stateful declare function $store( target: T, ident: string, backing: 'localstorage' ): Stateful declare function handle( references: DLPointer, callback: (value: T) => void ): void declare function css(strings: TemplateStringsArray, ...values: any): string declare function rule(strings: TemplateStringsArray, ...values: any): string declare var styled: { new: typeof css; rule: typeof rule } type DLCSS = string declare var $el: HTMLElement type Fragment = { readonly fragment: unique symbol } declare var Fragment: Fragment interface Element { $: OuterComponentTypes & { [index: string | symbol]: any } } interface DLElement extends HTMLElement { $: T & OuterComponentTypes } type ComponentElement any> = ReturnType type OuterComponentTypes = { root: Element children: Element[] } type InnerComponentTypes = { css: DLCSS mount?: () => void } type ComponentTypes = OuterComponentTypes & InnerComponentTypes type ArrayOrSingular = T | T[keyof T] type Component< Public, Private, Constructed extends string | symbol | number = never, > = ( this: Public & Private & ComponentTypes, props: ([Constructed] extends [never] ? Public : Omit) & { children?: ArrayOrSingular< Private extends { children: any } ? Private['children'] : never > [index: `${'bind:'}${string}`]: any } ) => DLElement