UNPKG

hswidget

Version:
30 lines (29 loc) 1.09 kB
import m from "mithril"; export declare type Vnode<AttrsType, StateType extends WidgetState> = m.Vnode<AttrsType, StateType>; export declare type ViewResult = m.Children | null | void; export interface WidgetAttrs { id?: string; class?: string; style?: string; onclick?: (...args: any) => void; } interface WidgetState extends m.Lifecycle<WidgetAttrs, m.Lifecycle<WidgetAttrs, WidgetState>> { } export declare abstract class Widget implements m.ClassComponent<WidgetAttrs> { protected attrs<A extends WidgetAttrs>(a: WidgetAttrs, others?: A): A; abstract view(node: Vnode<WidgetAttrs, this>): ViewResult; } export interface MouseEventsAttrs { onclick?: (event: Event) => void; onmousedown?: (event: Event) => void; onmouseup?: (event: Event) => void; } export interface EnabledWidgetAtrrs extends WidgetAttrs { disable?: boolean; } export declare abstract class EnabledWidget extends Widget { enabled: boolean; enable(set: boolean): void; protected attrs<A extends EnabledWidgetAtrrs>(a: EnabledWidgetAtrrs, others?: A): A; } export {};