1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | 1× 2× 144× 614× 614× 614× 512× 97× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× | import { ElementEvents, HtmlTagNames, VNode, VNodeEvents, VNodeProps, VNodeProperties } from '../' import { HTMLAnchorElementProperties, HTMLAppletElementProperties, HTMLAreaElementProperties, HTMLAudioElementProperties, HTMLBRElementProperties, HTMLBaseElementProperties, HTMLBaseFontElementProperties, HTMLBodyElementProperties, HTMLButtonElementProperties, HTMLCanvasElementProperties, HTMLDListElementProperties, HTMLDataElementProperties, HTMLDataListElementProperties, HTMLDirectoryElementProperties, HTMLDivElementProperties, HTMLEmbedElementProperties, HTMLFieldSetElementProperties, HTMLFontElementProperties, HTMLFormElementProperties, HTMLFrameElementProperties, HTMLFrameSetElementProperties, HTMLHRElementProperties, HTMLHeadElementProperties, HTMLHeadingElementProperties, HTMLHtmlElementProperties, HTMLIFrameElementProperties, HTMLImageElementProperties, HTMLInputElementProperties, HTMLLIElementProperties, HTMLLabelElementProperties, HTMLLegendElementProperties, HTMLLinkElementProperties, HTMLMapElementProperties, HTMLMarqueeElementProperties, HTMLMenuElementProperties, HTMLMetaElementProperties, HTMLMeterElementProperties, HTMLOListElementProperteis, HTMLObjectElementProperties, HTMLOptGroupElementProperties, HTMLOptionElementProperties, HTMLOutputElementProperties, HTMLParagraphElementProperties, HTMLParamElementProperties, HTMLPictureElementProperties, HTMLPreElementProperties, HTMLProgressElementProperties, HTMLQuoteElementProperties, HTMLScriptElementProperties, HTMLSelectElementProperties, HTMLSourceElementProperties, HTMLSpanElementProperties, HTMLStyleElementProperties, HTMLTableElementProperties, HTMLTableRowElementProperties, HTMLTemplateElementProperties, HTMLTextAreaElementProperties, HTMLTimeElementProperties, HTMLTitleElementProperties, HTMLTrackElementProperties, HTMLUListElementProperties, HTMLVideoElementProperties } from '../types/HtmlProperties' import { HyperscriptChildren, h } from './h' // tslint:disable:max-line-length // tslint:disable:no-shadowed-variable export interface HyperscriptHelperFn< T extends Element, Props extends VNodeProps<T> = VNodeProps<T> > { (): VNode<T, Props> (data: Props): VNode<T, Props & VNodeProps<T>> (data: Props, children: HyperscriptChildren): VNode<T, Props> (children: HyperscriptChildren): VNode<T, Props> } // tslint:enable:max-line-length export function hh<T extends HTMLElement, Props extends VNodeProps<T> = VNodeProps<T>>( tagName: HtmlTagNames ): HyperscriptHelperFn<T, Props> { return function(): VNode<T, Props> { const data = arguments[0] const children = arguments[1] if (Array.isArray(data)) return h(tagName, {}, data) if (typeof data === 'object') return h(tagName, data, children) return h(tagName, data || {}) } } function isValidString(param: any): boolean { return typeof param === 'string' && param.length > 0 } function isSelector(param: any): boolean { return isValidString(param) && (param[0] === '.' || param[0] === '#') } export const a = hh<HTMLAnchorElement, HTMLAnchorElementProperties>('a') export const abbr = hh('abbr') export const acronym = hh('acronym') export const address = hh('address') export const applet = hh<HTMLAppletElement, HTMLAppletElementProperties>('applet') export const area = hh<HTMLAreaElement, HTMLAreaElementProperties>('area') export const article = hh('article') export const aside = hh('aside') export const audio = hh<HTMLAudioElement, HTMLAudioElementProperties>('audio') export const b = hh('b') export const base = hh<HTMLBaseElement, HTMLBaseElementProperties>('base') export const basefont = hh<HTMLBaseFontElement, HTMLBaseFontElementProperties>('basefont') export const bdi = hh('bdi') export const bdo = hh('bdo') export const bgsound = hh('bgsound') export const big = hh('big') export const blink = hh('blink') export const blockquote = hh('blockquote') export const body = hh<HTMLBodyElement, HTMLBodyElementProperties>('body') export const br = hh<HTMLBRElement, HTMLBRElementProperties>('br') export const button = hh<HTMLButtonElement, HTMLButtonElementProperties>('button') export const canvas = hh<HTMLCanvasElement, HTMLCanvasElementProperties>('canvas') export const caption = hh('caption') export const center = hh('center') export const cite = hh('cite') export const code = hh('code') export const col = hh('col') export const colgroup = hh('colgroup') export const command = hh('command') export const content = hh('content') export const data = hh<HTMLDataElement, HTMLDataElementProperties>('data') export const datalist = hh<HTMLDataListElement, HTMLDataListElementProperties>('datalist') export const dd = hh('dd') export const del = hh('del') export const details = hh('details') export const dfn = hh('dfn') export const dialog = hh('dialog') export const dir = hh<HTMLDirectoryElement, HTMLDirectoryElementProperties>('dir') export const div = hh<HTMLDivElement, HTMLDivElementProperties>('div') export const dl = hh<HTMLDListElement, HTMLDListElementProperties>('dl') export const dt = hh('dt') export const element = hh('element') export const em = hh('em') export const embed = hh<HTMLEmbedElement, HTMLEmbedElementProperties>('embed') export const fieldset = hh<HTMLFieldSetElement, HTMLFieldSetElementProperties>('fieldset') export const figcaption = hh('figcaption') export const figure = hh('figure') export const font = hh<HTMLFontElement, HTMLFontElementProperties>('font') export const form = hh<HTMLFormElement, HTMLFormElementProperties>('form') export const footer = hh('footer') export const frame = hh<HTMLFrameElement, HTMLFrameElementProperties>('frame') export const frameset = hh<HTMLFrameSetElement, HTMLFrameSetElementProperties>('frameset') export const h1 = hh<HTMLHeadingElement, HTMLHeadingElementProperties>('h1') export const h2 = hh<HTMLHeadingElement, HTMLHeadingElementProperties>('h2') export const h3 = hh<HTMLHeadingElement, HTMLHeadingElementProperties>('h3') export const h4 = hh<HTMLHeadingElement, HTMLHeadingElementProperties>('h4') export const h5 = hh<HTMLHeadingElement, HTMLHeadingElementProperties>('h5') export const h6 = hh<HTMLHeadingElement, HTMLHeadingElementProperties>('h6') export const head = hh<HTMLHeadElement, HTMLHeadElementProperties>('head') export const header = hh('header') export const hgroup = hh('hgroup') export const hr = hh<HTMLHRElement, HTMLHRElementProperties>('hr') export const html = hh<HTMLHtmlElement, HTMLHtmlElementProperties>('html') export const i = hh<HTMLHtmlElement, HTMLHtmlElementProperties>('i') export const iframe = hh<HTMLIFrameElement, HTMLIFrameElementProperties>('iframe') export const img = hh<HTMLImageElement, HTMLImageElementProperties>('img') export const input = hh<HTMLInputElement, HTMLInputElementProperties>('input') export const ins = hh('ins') export const isindex = hh('isindex') export const kbd = hh('kbd') export const keygen = hh('keygen') export const label = hh<HTMLLabelElement, HTMLLabelElementProperties>('label') export const legend = hh<HTMLLegendElement, HTMLLegendElementProperties>('legend') export const li = hh<HTMLLIElement, HTMLLIElementProperties>('li') export const link = hh<HTMLLinkElement, HTMLLinkElementProperties>('link') export const listing = hh('listing') export const main = hh('main') export const map = hh<HTMLMapElement, HTMLMapElementProperties>('map') export const mark = hh('mark') export const marquee = hh<HTMLMarqueeElement, HTMLMarqueeElementProperties>('marquee') export const math = hh('math') export const menu = hh<HTMLMenuElement, HTMLMenuElementProperties>('menu') export const menuitem = hh('menuitem') export const meta = hh<HTMLMetaElement, HTMLMetaElementProperties>('meta') export const meter = hh<HTMLMeterElement, HTMLMeterElementProperties>('meter') export const multicol = hh('multicol') export const nav = hh('nav') export const nextid = hh('nextid') export const nobr = hh('nobr') export const noembed = hh('noembed') export const noframes = hh('noframes') export const noscript = hh('noscript') export const object = hh<HTMLObjectElement, HTMLObjectElementProperties>('object') export const ol = hh<HTMLOListElement, HTMLOListElementProperteis>('ol') export const optgroup = hh<HTMLOptGroupElement, HTMLOptGroupElementProperties>('optgroup') export const option = hh<HTMLOptionElement, HTMLOptionElementProperties>('option') export const output = hh<HTMLOutputElement, HTMLOutputElementProperties>('output') export const p = hh<HTMLParagraphElement, HTMLParagraphElementProperties>('p') export const param = hh<HTMLParamElement, HTMLParamElementProperties>('param') export const picture = hh<HTMLPictureElement, HTMLPictureElementProperties>('picture') export const plaintext = hh('plaintext') export const pre = hh<HTMLPreElement, HTMLPreElementProperties>('pre') export const progress = hh<HTMLProgressElement, HTMLProgressElementProperties>('progress') export const q = hh<HTMLQuoteElement, HTMLQuoteElementProperties>('q') export const rb = hh('rb') export const rbc = hh('rbc') export const rp = hh('rp') export const rt = hh('rt') export const rtc = hh('rtc') export const ruby = hh('ruby') export const s = hh('s') export const samp = hh('samp') export const script = hh<HTMLScriptElement, HTMLScriptElementProperties>('script') export const section = hh('section') export const select = hh<HTMLSelectElement, HTMLSelectElementProperties>('select') export const shadow = hh('shadow') export const small = hh('small') export const source = hh<HTMLSourceElement, HTMLSourceElementProperties>('source') export const spacer = hh('spacer') export const span = hh<HTMLSpanElement, HTMLSpanElementProperties>('span') export const strike = hh('strike') export const strong = hh('strong') export const style = hh<HTMLStyleElement, HTMLStyleElementProperties>('style') export const sub = hh('sub') export const summary = hh('summary') export const sup = hh('sup') export const slot = hh('slot') export const table = hh<HTMLTableElement, HTMLTableElementProperties>('table') export const tbody = hh('tbody') export const td = hh('td') export const template = hh<HTMLTemplateElement, HTMLTemplateElementProperties>('template') export const textarea = hh<HTMLTextAreaElement, HTMLTextAreaElementProperties>('textarea') export const tfoot = hh('tfoot') export const th = hh('th') export const time = hh<HTMLTimeElement, HTMLTimeElementProperties>('time') export const title = hh<HTMLTitleElement, HTMLTitleElementProperties>('title') export const tr = hh<HTMLTableRowElement, HTMLTableRowElementProperties>('tr') export const track = hh<HTMLTrackElement, HTMLTrackElementProperties>('track') export const tt = hh('tt') export const u = hh('u') export const ul = hh<HTMLUListElement, HTMLUListElementProperties>('ul') export const video = hh<HTMLVideoElement, HTMLVideoElementProperties>('video') export const wbr = hh('wbr') export const xmp = hh('xmp') // tslint:disable:no-mixed-interface declare global { namespace JSX { interface Element extends VNode {} interface IntrinsicElements { a: HTMLAnchorElementProperties applet: HTMLAppletElementProperties area: HTMLAreaElementProperties audio: HTMLAudioElementProperties base: HTMLBaseElementProperties basefont: HTMLBaseFontElementProperties body: HTMLBodyElementProperties br: HTMLBRElementProperties button: HTMLButtonElementProperties canvas: HTMLCanvasElementProperties data: HTMLDataElementProperties datalist: HTMLDataListElementProperties dir: HTMLDirectoryElementProperties div: HTMLDivElementProperties dl: HTMLDListElementProperties embed: HTMLEmbedElementProperties fieldset: HTMLFieldSetElementProperties font: HTMLFontElementProperties form: HTMLFormElementProperties frame: HTMLFrameElementProperties frameset: HTMLFrameSetElementProperties h1: HTMLHeadingElementProperties h2: HTMLHeadingElementProperties h3: HTMLHeadingElementProperties h4: HTMLHeadingElementProperties h5: HTMLHeadingElementProperties h6: HTMLHeadingElementProperties head: HTMLHeadElementProperties hr: HTMLHRElementProperties html: HTMLHtmlElementProperties i: HTMLHtmlElementProperties iframe: HTMLIFrameElementProperties img: HTMLImageElementProperties input: HTMLInputElementProperties label: HTMLLabelElementProperties legend: HTMLLegendElementProperties li: HTMLLIElementProperties link: HTMLLinkElementProperties map: HTMLMapElementProperties marquee: HTMLMarqueeElementProperties menu: HTMLMenuElementProperties meta: HTMLMetaElementProperties meter: HTMLMeterElementProperties object: HTMLObjectElementProperties ol: HTMLOListElementProperteis optgroup: HTMLOptGroupElementProperties option: HTMLOptionElementProperties output: HTMLOutputElementProperties p: HTMLParagraphElementProperties param: HTMLParamElementProperties picture: HTMLPictureElementProperties pre: HTMLPreElementProperties progress: HTMLProgressElementProperties q: HTMLQuoteElementProperties script: HTMLScriptElementProperties select: HTMLSelectElementProperties source: HTMLSourceElementProperties span: HTMLSpanElementProperties style: HTMLStyleElementProperties table: HTMLTableElementProperties template: HTMLTemplateElementProperties textarea: HTMLTextAreaElementProperties time: HTMLTimeElementProperties title: HTMLTitleElementProperties tr: HTMLTableRowElementProperties track: HTMLTrackElementProperties ul: HTMLUListElementProperties video: HTMLVideoElementProperties } } // tslint:disable-next-line:max-file-line-count } |