typed-dom
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.6 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License (https://opensource.org/licenses/MIT) */ | ||
/*! typed-dom v0.0.7 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License (https://opensource.org/licenses/MIT) */ | ||
define = typeof define === 'function' && define.amd | ||
@@ -36,7 +36,13 @@ ? define | ||
'use strict'; | ||
function build(factory, contents) { | ||
function build(factory, contents, attrs) { | ||
if (contents === void 0) { | ||
contents = []; | ||
} | ||
if (attrs === void 0) { | ||
attrs = {}; | ||
} | ||
var raw = factory(); | ||
void Object.keys(attrs).forEach(function (attr) { | ||
return raw.setAttribute(attr, attrs[attr] || ''); | ||
}); | ||
void Object.keys(contents).forEach(function (k) { | ||
@@ -93,895 +99,136 @@ return void raw.appendChild(contents[k].raw); | ||
'use strict'; | ||
exports.TypedHTML = { | ||
a: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('a'); | ||
}; | ||
exports.TypedHTML = [ | ||
'a', | ||
'abbr', | ||
'acronym', | ||
'address', | ||
'applet', | ||
'area', | ||
'article', | ||
'aside', | ||
'audio', | ||
'b', | ||
'base', | ||
'basefont', | ||
'bdo', | ||
'big', | ||
'blockquote', | ||
'body', | ||
'br', | ||
'button', | ||
'canvas', | ||
'caption', | ||
'center', | ||
'cite', | ||
'code', | ||
'col', | ||
'colgroup', | ||
'datalist', | ||
'dd', | ||
'del', | ||
'dfn', | ||
'dir', | ||
'div', | ||
'dl', | ||
'dt', | ||
'em', | ||
'embed', | ||
'fieldset', | ||
'figcaption', | ||
'figure', | ||
'font', | ||
'footer', | ||
'form', | ||
'frame', | ||
'frameset', | ||
'h1', | ||
'h2', | ||
'h3', | ||
'h4', | ||
'h5', | ||
'h6', | ||
'head', | ||
'header', | ||
'hgroup', | ||
'hr', | ||
'html', | ||
'i', | ||
'iframe', | ||
'img', | ||
'input', | ||
'ins', | ||
'isindex', | ||
'kbd', | ||
'keygen', | ||
'label', | ||
'legend', | ||
'li', | ||
'link', | ||
'listing', | ||
'map', | ||
'mark', | ||
'marquee', | ||
'menu', | ||
'meta', | ||
'nav', | ||
'nextid', | ||
'nobr', | ||
'noframes', | ||
'noscript', | ||
'object', | ||
'ol', | ||
'optgroup', | ||
'option', | ||
'p', | ||
'param', | ||
'picture', | ||
'plaintext', | ||
'pre', | ||
'progress', | ||
'q', | ||
'rt', | ||
'ruby', | ||
's', | ||
'samp', | ||
'script', | ||
'section', | ||
'select', | ||
'small', | ||
'source', | ||
'span', | ||
'strike', | ||
'strong', | ||
'style', | ||
'sub', | ||
'sup', | ||
'table', | ||
'tbody', | ||
'td', | ||
'template', | ||
'textarea', | ||
'tfoot', | ||
'th', | ||
'thead', | ||
'title', | ||
'tr', | ||
'track', | ||
'tt', | ||
'u', | ||
'ul', | ||
'var', | ||
'video', | ||
'wbr', | ||
'xmp', | ||
'custom' | ||
].reduce(function (obj, tag) { | ||
obj[tag] = function (contents, attrs, factory) { | ||
if (!factory && typeof attrs === 'function') { | ||
factory = attrs; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
abbr: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('abbr'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
acronym: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('acronym'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
address: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('address'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
applet: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('applet'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
area: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('area'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
audio: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('audio'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
b: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('b'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
base: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('base'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
basefont: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('basefont'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
bdo: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('bdo'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
big: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('big'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
blockquote: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('blockquote'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
body: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('body'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
br: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('br'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
button: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('button'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
canvas: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('canvas'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
caption: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('caption'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
center: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('center'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
cite: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('cite'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
code: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('code'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
col: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('col'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
colgroup: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('colgroup'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
datalist: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('datalist'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
dd: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('dd'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
del: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('del'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
dfn: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('dfn'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
dir: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('dir'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
div: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('div'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
dl: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('dl'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
dt: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('dt'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
em: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('em'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
embed: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('embed'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
fieldset: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('fieldset'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
font: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('font'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
form: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('form'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
frame: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('frame'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
frameset: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('frameset'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
h1: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('h1'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
h2: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('h2'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
h3: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('h3'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
h4: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('h4'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
h5: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('h5'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
h6: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('h6'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
head: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('head'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
hr: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('hr'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
html: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('html'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
i: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('i'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
iframe: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('iframe'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
img: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('img'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
input: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('input'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
ins: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('ins'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
isindex: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('isindex'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
kbd: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('kbd'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
keygen: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('keygen'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
label: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('label'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
legend: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('legend'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
li: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('li'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
link: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('link'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
listing: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('listing'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
map: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('map'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
marquee: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('marquee'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
menu: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('menu'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
meta: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('meta'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
nextid: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('nextid'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
nobr: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('nobr'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
object: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('object'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
ol: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('ol'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
optgroup: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('optgroup'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
option: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('option'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
p: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('p'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
param: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('param'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
picture: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('picture'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
plaintext: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('plaintext'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
pre: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('pre'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
progress: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('progress'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
q: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('q'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
rt: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('rt'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
ruby: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('ruby'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
s: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('s'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
samp: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('samp'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
script: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('script'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
select: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('select'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
small: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('small'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
source: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('source'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
span: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('span'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
strike: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('strike'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
strong: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('strong'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
style: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('style'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
sub: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('sub'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
sup: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('sup'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
table: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('table'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
tbody: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('tbody'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
td: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('td'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
textarea: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('textarea'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
tfoot: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('tfoot'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
th: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('th'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
thead: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('thead'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
title: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('title'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
tr: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('tr'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
track: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('track'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
tt: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('tt'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
u: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('u'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
ul: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('ul'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
var: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('var'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
video: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('video'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
xmp: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('xmp'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
article: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('article'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
aside: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('aside'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
nav: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('nav'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
section: function (contents, factory) { | ||
if (factory === void 0) { | ||
factory = function () { | ||
return document.createElement('section'); | ||
}; | ||
} | ||
return builder_1.build(factory, contents); | ||
}, | ||
untyped: function (contents, factory) { | ||
return builder_1.build(factory, contents); | ||
} | ||
}; | ||
return builder_1.build(factory || function () { | ||
return document.createElement(tag); | ||
}, contents, attrs); | ||
}; | ||
return obj; | ||
}, {}); | ||
}); | ||
@@ -988,0 +235,0 @@ define('src/export', [ |
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.6 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License (https://opensource.org/licenses/MIT) */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var n="typed-dom",e={};return function t(u,r,i){return i?void i.apply(this,r.map(function(n){switch(n){case"require":return"function"==typeof require?require:void 0;case"exports":return-1===u.indexOf("/")?e[u]="undefined"==typeof exports?self[u]=self[u]||{}:exports:e[u]=e.hasOwnProperty(u)?e[u]:{};default:return".d"===n.slice(-2)&&{}||e.hasOwnProperty(n)&&e[n]||"function"==typeof require&&require(n)||self[n]}})):void t(n,u,r)}}(),define("src/dom/builder",["require","exports"],function(n,e){"use strict";function t(n,e){function t(n){var e={};return Object.keys(n).reduce(function(n,t){return e[t]=n[t],Object.defineProperty(n,t,{get:function(){return e[t]},set:function(n){var r=e[t];e[t]=n,u.replaceChild(n.raw,r.raw)}}),n},n)}void 0===e&&(e=[]);var u=n();return void Object.keys(e).forEach(function(n){return void u.appendChild(e[n].raw)}),e=e instanceof Array?Object.freeze(e):t(e),Object.freeze({raw:u,get contents(){return e},set contents(n){e instanceof Array?(n=Object.freeze(n),u.innerHTML="",void n.forEach(function(n){return void u.appendChild(n.raw)})):(void Object.keys(n).forEach(function(t){return void u.replaceChild(n[t].raw,e[t].raw)}),n=t(n)),e=n}})}e.build=t}),define("src/dom/html",["require","exports","src/dom/builder"],function(n,e,t){"use strict";e.TypedHTML={a:function(n,e){return void 0===e&&(e=function(){return document.createElement("a")}),t.build(e,n)},abbr:function(n,e){return void 0===e&&(e=function(){return document.createElement("abbr")}),t.build(e,n)},acronym:function(n,e){return void 0===e&&(e=function(){return document.createElement("acronym")}),t.build(e,n)},address:function(n,e){return void 0===e&&(e=function(){return document.createElement("address")}),t.build(e,n)},applet:function(n,e){return void 0===e&&(e=function(){return document.createElement("applet")}),t.build(e,n)},area:function(n,e){return void 0===e&&(e=function(){return document.createElement("area")}),t.build(e,n)},audio:function(n,e){return void 0===e&&(e=function(){return document.createElement("audio")}),t.build(e,n)},b:function(n,e){return void 0===e&&(e=function(){return document.createElement("b")}),t.build(e,n)},base:function(n,e){return void 0===e&&(e=function(){return document.createElement("base")}),t.build(e,n)},basefont:function(n,e){return void 0===e&&(e=function(){return document.createElement("basefont")}),t.build(e,n)},bdo:function(n,e){return void 0===e&&(e=function(){return document.createElement("bdo")}),t.build(e,n)},big:function(n,e){return void 0===e&&(e=function(){return document.createElement("big")}),t.build(e,n)},blockquote:function(n,e){return void 0===e&&(e=function(){return document.createElement("blockquote")}),t.build(e,n)},body:function(n,e){return void 0===e&&(e=function(){return document.createElement("body")}),t.build(e,n)},br:function(n,e){return void 0===e&&(e=function(){return document.createElement("br")}),t.build(e,n)},button:function(n,e){return void 0===e&&(e=function(){return document.createElement("button")}),t.build(e,n)},canvas:function(n,e){return void 0===e&&(e=function(){return document.createElement("canvas")}),t.build(e,n)},caption:function(n,e){return void 0===e&&(e=function(){return document.createElement("caption")}),t.build(e,n)},center:function(n,e){return void 0===e&&(e=function(){return document.createElement("center")}),t.build(e,n)},cite:function(n,e){return void 0===e&&(e=function(){return document.createElement("cite")}),t.build(e,n)},code:function(n,e){return void 0===e&&(e=function(){return document.createElement("code")}),t.build(e,n)},col:function(n,e){return void 0===e&&(e=function(){return document.createElement("col")}),t.build(e,n)},colgroup:function(n,e){return void 0===e&&(e=function(){return document.createElement("colgroup")}),t.build(e,n)},datalist:function(n,e){return void 0===e&&(e=function(){return document.createElement("datalist")}),t.build(e,n)},dd:function(n,e){return void 0===e&&(e=function(){return document.createElement("dd")}),t.build(e,n)},del:function(n,e){return void 0===e&&(e=function(){return document.createElement("del")}),t.build(e,n)},dfn:function(n,e){return void 0===e&&(e=function(){return document.createElement("dfn")}),t.build(e,n)},dir:function(n,e){return void 0===e&&(e=function(){return document.createElement("dir")}),t.build(e,n)},div:function(n,e){return void 0===e&&(e=function(){return document.createElement("div")}),t.build(e,n)},dl:function(n,e){return void 0===e&&(e=function(){return document.createElement("dl")}),t.build(e,n)},dt:function(n,e){return void 0===e&&(e=function(){return document.createElement("dt")}),t.build(e,n)},em:function(n,e){return void 0===e&&(e=function(){return document.createElement("em")}),t.build(e,n)},embed:function(n,e){return void 0===e&&(e=function(){return document.createElement("embed")}),t.build(e,n)},fieldset:function(n,e){return void 0===e&&(e=function(){return document.createElement("fieldset")}),t.build(e,n)},font:function(n,e){return void 0===e&&(e=function(){return document.createElement("font")}),t.build(e,n)},form:function(n,e){return void 0===e&&(e=function(){return document.createElement("form")}),t.build(e,n)},frame:function(n,e){return void 0===e&&(e=function(){return document.createElement("frame")}),t.build(e,n)},frameset:function(n,e){return void 0===e&&(e=function(){return document.createElement("frameset")}),t.build(e,n)},h1:function(n,e){return void 0===e&&(e=function(){return document.createElement("h1")}),t.build(e,n)},h2:function(n,e){return void 0===e&&(e=function(){return document.createElement("h2")}),t.build(e,n)},h3:function(n,e){return void 0===e&&(e=function(){return document.createElement("h3")}),t.build(e,n)},h4:function(n,e){return void 0===e&&(e=function(){return document.createElement("h4")}),t.build(e,n)},h5:function(n,e){return void 0===e&&(e=function(){return document.createElement("h5")}),t.build(e,n)},h6:function(n,e){return void 0===e&&(e=function(){return document.createElement("h6")}),t.build(e,n)},head:function(n,e){return void 0===e&&(e=function(){return document.createElement("head")}),t.build(e,n)},hr:function(n,e){return void 0===e&&(e=function(){return document.createElement("hr")}),t.build(e,n)},html:function(n,e){return void 0===e&&(e=function(){return document.createElement("html")}),t.build(e,n)},i:function(n,e){return void 0===e&&(e=function(){return document.createElement("i")}),t.build(e,n)},iframe:function(n,e){return void 0===e&&(e=function(){return document.createElement("iframe")}),t.build(e,n)},img:function(n,e){return void 0===e&&(e=function(){return document.createElement("img")}),t.build(e,n)},input:function(n,e){return void 0===e&&(e=function(){return document.createElement("input")}),t.build(e,n)},ins:function(n,e){return void 0===e&&(e=function(){return document.createElement("ins")}),t.build(e,n)},isindex:function(n,e){return void 0===e&&(e=function(){return document.createElement("isindex")}),t.build(e,n)},kbd:function(n,e){return void 0===e&&(e=function(){return document.createElement("kbd")}),t.build(e,n)},keygen:function(n,e){return void 0===e&&(e=function(){return document.createElement("keygen")}),t.build(e,n)},label:function(n,e){return void 0===e&&(e=function(){return document.createElement("label")}),t.build(e,n)},legend:function(n,e){return void 0===e&&(e=function(){return document.createElement("legend")}),t.build(e,n)},li:function(n,e){return void 0===e&&(e=function(){return document.createElement("li")}),t.build(e,n)},link:function(n,e){return void 0===e&&(e=function(){return document.createElement("link")}),t.build(e,n)},listing:function(n,e){return void 0===e&&(e=function(){return document.createElement("listing")}),t.build(e,n)},map:function(n,e){return void 0===e&&(e=function(){return document.createElement("map")}),t.build(e,n)},marquee:function(n,e){return void 0===e&&(e=function(){return document.createElement("marquee")}),t.build(e,n)},menu:function(n,e){return void 0===e&&(e=function(){return document.createElement("menu")}),t.build(e,n)},meta:function(n,e){return void 0===e&&(e=function(){return document.createElement("meta")}),t.build(e,n)},nextid:function(n,e){return void 0===e&&(e=function(){return document.createElement("nextid")}),t.build(e,n)},nobr:function(n,e){return void 0===e&&(e=function(){return document.createElement("nobr")}),t.build(e,n)},object:function(n,e){return void 0===e&&(e=function(){return document.createElement("object")}),t.build(e,n)},ol:function(n,e){return void 0===e&&(e=function(){return document.createElement("ol")}),t.build(e,n)},optgroup:function(n,e){return void 0===e&&(e=function(){return document.createElement("optgroup")}),t.build(e,n)},option:function(n,e){return void 0===e&&(e=function(){return document.createElement("option")}),t.build(e,n)},p:function(n,e){return void 0===e&&(e=function(){return document.createElement("p")}),t.build(e,n)},param:function(n,e){return void 0===e&&(e=function(){return document.createElement("param")}),t.build(e,n)},picture:function(n,e){return void 0===e&&(e=function(){return document.createElement("picture")}),t.build(e,n)},plaintext:function(n,e){return void 0===e&&(e=function(){return document.createElement("plaintext")}),t.build(e,n)},pre:function(n,e){return void 0===e&&(e=function(){return document.createElement("pre")}),t.build(e,n)},progress:function(n,e){return void 0===e&&(e=function(){return document.createElement("progress")}),t.build(e,n)},q:function(n,e){return void 0===e&&(e=function(){return document.createElement("q")}),t.build(e,n)},rt:function(n,e){return void 0===e&&(e=function(){return document.createElement("rt")}),t.build(e,n)},ruby:function(n,e){return void 0===e&&(e=function(){return document.createElement("ruby")}),t.build(e,n)},s:function(n,e){return void 0===e&&(e=function(){return document.createElement("s")}),t.build(e,n)},samp:function(n,e){return void 0===e&&(e=function(){return document.createElement("samp")}),t.build(e,n)},script:function(n,e){return void 0===e&&(e=function(){return document.createElement("script")}),t.build(e,n)},select:function(n,e){return void 0===e&&(e=function(){return document.createElement("select")}),t.build(e,n)},small:function(n,e){return void 0===e&&(e=function(){return document.createElement("small")}),t.build(e,n)},source:function(n,e){return void 0===e&&(e=function(){return document.createElement("source")}),t.build(e,n)},span:function(n,e){return void 0===e&&(e=function(){return document.createElement("span")}),t.build(e,n)},strike:function(n,e){return void 0===e&&(e=function(){return document.createElement("strike")}),t.build(e,n)},strong:function(n,e){return void 0===e&&(e=function(){return document.createElement("strong")}),t.build(e,n)},style:function(n,e){return void 0===e&&(e=function(){return document.createElement("style")}),t.build(e,n)},sub:function(n,e){return void 0===e&&(e=function(){return document.createElement("sub")}),t.build(e,n)},sup:function(n,e){return void 0===e&&(e=function(){return document.createElement("sup")}),t.build(e,n)},table:function(n,e){return void 0===e&&(e=function(){return document.createElement("table")}),t.build(e,n)},tbody:function(n,e){return void 0===e&&(e=function(){return document.createElement("tbody")}),t.build(e,n)},td:function(n,e){return void 0===e&&(e=function(){return document.createElement("td")}),t.build(e,n)},textarea:function(n,e){return void 0===e&&(e=function(){return document.createElement("textarea")}),t.build(e,n)},tfoot:function(n,e){return void 0===e&&(e=function(){return document.createElement("tfoot")}),t.build(e,n)},th:function(n,e){return void 0===e&&(e=function(){return document.createElement("th")}),t.build(e,n)},thead:function(n,e){return void 0===e&&(e=function(){return document.createElement("thead")}),t.build(e,n)},title:function(n,e){return void 0===e&&(e=function(){return document.createElement("title")}),t.build(e,n)},tr:function(n,e){return void 0===e&&(e=function(){return document.createElement("tr")}),t.build(e,n)},track:function(n,e){return void 0===e&&(e=function(){return document.createElement("track")}),t.build(e,n)},tt:function(n,e){return void 0===e&&(e=function(){return document.createElement("tt")}),t.build(e,n)},u:function(n,e){return void 0===e&&(e=function(){return document.createElement("u")}),t.build(e,n)},ul:function(n,e){return void 0===e&&(e=function(){return document.createElement("ul")}),t.build(e,n)},"var":function(n,e){return void 0===e&&(e=function(){return document.createElement("var")}),t.build(e,n)},video:function(n,e){return void 0===e&&(e=function(){return document.createElement("video")}),t.build(e,n)},xmp:function(n,e){return void 0===e&&(e=function(){return document.createElement("xmp")}),t.build(e,n)},article:function(n,e){return void 0===e&&(e=function(){return document.createElement("article")}),t.build(e,n)},aside:function(n,e){return void 0===e&&(e=function(){return document.createElement("aside")}),t.build(e,n)},nav:function(n,e){return void 0===e&&(e=function(){return document.createElement("nav")}),t.build(e,n)},section:function(n,e){return void 0===e&&(e=function(){return document.createElement("section")}),t.build(e,n)},untyped:function(n,e){return t.build(e,n)}}}),define("src/export",["require","exports","src/dom/html"],function(n,e,t){"use strict";e["default"]=t.TypedHTML}),define("typed-dom",["require","exports","src/export","src/export"],function(n,e,t,u){"use strict";function r(n){for(var t in n)e.hasOwnProperty(t)||(e[t]=n[t])}r(t),e["default"]=u["default"]}); | ||
/*! typed-dom v0.0.7 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License (https://opensource.org/licenses/MIT) */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var e="typed-dom",t={};return function r(n,i,o){return o?void o.apply(this,i.map(function(e){switch(e){case"require":return"function"==typeof require?require:void 0;case"exports":return-1===n.indexOf("/")?t[n]="undefined"==typeof exports?self[n]=self[n]||{}:exports:t[n]=t.hasOwnProperty(n)?t[n]:{};default:return".d"===e.slice(-2)&&{}||t.hasOwnProperty(e)&&t[e]||"function"==typeof require&&require(e)||self[e]}})):void r(e,n,i)}}(),define("src/dom/builder",["require","exports"],function(e,t){"use strict";function r(e,t,r){function n(e){var t={};return Object.keys(e).reduce(function(e,r){return t[r]=e[r],Object.defineProperty(e,r,{get:function(){return t[r]},set:function(e){var n=t[r];t[r]=e,i.replaceChild(e.raw,n.raw)}}),e},e)}void 0===t&&(t=[]),void 0===r&&(r={});var i=e();return void Object.keys(r).forEach(function(e){return i.setAttribute(e,r[e]||"")}),void Object.keys(t).forEach(function(e){return void i.appendChild(t[e].raw)}),t=t instanceof Array?Object.freeze(t):n(t),Object.freeze({raw:i,get contents(){return t},set contents(e){t instanceof Array?(e=Object.freeze(e),i.innerHTML="",void e.forEach(function(e){return void i.appendChild(e.raw)})):(void Object.keys(e).forEach(function(r){return void i.replaceChild(e[r].raw,t[r].raw)}),e=n(e)),t=e}})}t.build=r}),define("src/dom/html",["require","exports","src/dom/builder"],function(e,t,r){"use strict";t.TypedHTML=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdo","big","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","datalist","dd","del","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","map","mark","marquee","menu","meta","nav","nextid","nobr","noframes","noscript","object","ol","optgroup","option","p","param","picture","plaintext","pre","progress","q","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","sup","table","tbody","td","template","textarea","tfoot","th","thead","title","tr","track","tt","u","ul","var","video","wbr","xmp","custom"].reduce(function(e,t){return e[t]=function(e,n,i){return i||"function"!=typeof n||(i=n),r.build(i||function(){return document.createElement(t)},e,n)},e},{})}),define("src/export",["require","exports","src/dom/html"],function(e,t,r){"use strict";t["default"]=r.TypedHTML}),define("typed-dom",["require","exports","src/export","src/export"],function(e,t,r,n){"use strict";function i(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}i(r),t["default"]=n["default"]}); |
157
gulpfile.js
const gulp = require('gulp'); | ||
const shell = cmd => require('child_process').execSync(cmd, {stdio:[0,1,2]}); | ||
const shell = cmd => require('child_process').execSync(cmd, { stdio: [0, 1, 2] }); | ||
const del = require('del'); | ||
const extend = require('extend'); | ||
const seq = require('run-sequence'); | ||
const $ = require('gulp-load-plugins')({ | ||
//pattern: ['gulp-*', 'gulp.*'], | ||
//replaceString: /\bgulp[\-.]/ | ||
}); | ||
const $ = require('gulp-load-plugins')(); | ||
const Server = require('karma').Server; | ||
const pkg = require('./package.json'); | ||
const karmaconfig = require('./karma.conf.js'); | ||
const config = { | ||
ts: { | ||
options: extend(require('./tsconfig.json').compilerOptions, { | ||
typescript: require('typescript') | ||
typescript: require('typescript'), | ||
outFile: `${pkg.name}.js` | ||
}), | ||
source: { | ||
src: [ | ||
'typings/*.d.ts', | ||
'*.ts', | ||
'src/**/*.ts' | ||
], | ||
dest: 'dist/' | ||
}, | ||
dist: { | ||
src: [ | ||
'typings/*.d.ts', | ||
'*.ts', | ||
'src/**/*.d.ts', | ||
'src/**/+([!.]).ts' | ||
'*.ts' | ||
], | ||
dest: 'dist/' | ||
dest: 'dist' | ||
}, | ||
@@ -39,5 +26,7 @@ test: { | ||
'typings/*.d.ts', | ||
'*.ts', | ||
'src/**/*.ts', | ||
'test/**/*.ts' | ||
], | ||
dest: 'test/' | ||
dest: 'dist' | ||
} | ||
@@ -81,45 +70,15 @@ }, | ||
clean: { | ||
src: 'src/**/*.js', | ||
dist: 'dist', | ||
test: 'test/**/*.js', | ||
bench: 'benchmark/**/*.js', | ||
cov: 'coverage' | ||
}, | ||
karma: { | ||
watch: extend({}, require('./karma.conf.js'), { | ||
browsers: ['Chrome'], | ||
preprocessors: { | ||
'dist/*.js': ['espower'], | ||
'test/**/*.js': ['espower'] | ||
}, | ||
singleRun: false | ||
}), | ||
test: extend({}, require('./karma.conf.js'), { | ||
browsers: ['Chrome', 'Firefox', 'IE11'], | ||
reporters: ['dots'], | ||
preprocessors: { | ||
'dist/*.js': ['espower'], | ||
'test/**/*.js': ['espower'] | ||
}, | ||
singleRun: true | ||
}), | ||
server: extend({}, require('./karma.conf.js'), { | ||
browsers: ['Chrome', 'Firefox'], | ||
reporters: ['dots'], | ||
preprocessors: { | ||
'dist/*.js': ['espower'], | ||
'test/**/*.js': ['espower'] | ||
}, | ||
singleRun: true | ||
}) | ||
dist: 'dist' | ||
} | ||
}; | ||
gulp.task('ts:source', function () { | ||
return gulp.src(config.ts.source.src) | ||
.pipe($.typescript(Object.assign({ | ||
outFile: `${pkg.name}.js` | ||
}, config.ts.options))) | ||
gulp.task('ts:watch', function () { | ||
gulp.watch(config.ts.test.src, ['ts:test']); | ||
}); | ||
gulp.task('ts:test', function () { | ||
return gulp.src(config.ts.test.src) | ||
.pipe($.typescript(config.ts.options)) | ||
.pipe($.header(config.exporter)) | ||
.pipe(gulp.dest(config.ts.source.dest)); | ||
.pipe(gulp.dest(config.ts.test.dest)); | ||
}); | ||
@@ -129,5 +88,3 @@ | ||
return gulp.src(config.ts.dist.src) | ||
.pipe($.typescript(Object.assign({ | ||
outFile: `${pkg.name}.js` | ||
}, config.ts.options))) | ||
.pipe($.typescript(config.ts.options)) | ||
.once("error", function () { | ||
@@ -145,40 +102,37 @@ this.once("finish", () => process.exit(1)); | ||
gulp.task('ts:test', function () { | ||
return gulp.src(config.ts.test.src) | ||
.pipe($.typescript(Object.assign({ | ||
}, config.ts.options))) | ||
.pipe(gulp.dest(config.ts.test.dest)); | ||
}); | ||
gulp.task('ts:watch', function () { | ||
gulp.watch(config.ts.source.src, ['ts:source']); | ||
gulp.watch(config.ts.test.src, ['ts:test']); | ||
}); | ||
gulp.task('mocha:watch', function () { | ||
gulp.watch(config.ts.source.dest + '*.js', ['mocha:test']); | ||
}); | ||
gulp.task('mocha:test', function () { | ||
return gulp.src(config.ts.source.dest + '*.js', { read: false }) | ||
.pipe($.mocha({ | ||
require: ['intelli-espower-loader'], | ||
reporter: 'dot' | ||
})); | ||
}); | ||
gulp.task('karma:watch', function (done) { | ||
new Server(config.karma.watch, done).start(); | ||
new Server({ | ||
configFile: __dirname + '/karma.conf.js', | ||
preprocessors: { | ||
'dist/*.js': ['espower'] | ||
}, | ||
}, done).start(); | ||
}); | ||
gulp.task('karma:test', function (done) { | ||
new Server(config.karma.test, done).start(); | ||
new Server({ | ||
configFile: __dirname + '/karma.conf.js', | ||
browsers: ['Chrome', 'Firefox', 'IE11'], | ||
reporters: ['dots', 'coverage'], | ||
preprocessors: { | ||
'dist/*.js': ['coverage', 'espower'] | ||
}, | ||
singleRun: true | ||
}, done).start(); | ||
}); | ||
gulp.task('karma:server', function (done) { | ||
new Server(config.karma.server, done).start(); | ||
new Server({ | ||
configFile: __dirname + '/karma.conf.js', | ||
browsers: ['Chrome', 'Firefox'], | ||
reporters: ['dots', 'coverage'], | ||
preprocessors: { | ||
'dist/*.js': ['coverage', 'espower'] | ||
}, | ||
singleRun: true | ||
}, done).start(); | ||
}); | ||
gulp.task('clean', function () { | ||
return del([config.clean.src, config.clean.dist, config.clean.test, config.clean.bench]); | ||
return del([config.clean.dist]); | ||
}); | ||
@@ -197,18 +151,15 @@ | ||
gulp.task('build', ['clean'], function (done) { | ||
gulp.task('watch', ['clean'], function () { | ||
seq( | ||
['ts:source', 'ts:test'], | ||
done | ||
'ts:test', | ||
[ | ||
'ts:watch', | ||
'karma:watch' | ||
] | ||
); | ||
}); | ||
gulp.task('watch', ['build'], function () { | ||
seq([ | ||
'ts:watch', | ||
'karma:watch' | ||
]); | ||
}); | ||
gulp.task('test', ['build'], function (done) { | ||
gulp.task('test', ['clean'], function (done) { | ||
seq( | ||
'ts:test', | ||
'karma:test', | ||
@@ -228,5 +179,5 @@ function () { | ||
gulp.task('server', function (done) { | ||
gulp.task('server', ['clean'], function (done) { | ||
seq( | ||
'build', | ||
'ts:test', | ||
'karma:server', | ||
@@ -233,0 +184,0 @@ 'dist', |
@@ -1,106 +0,37 @@ | ||
module.exports = { | ||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: '', | ||
customLaunchers: { | ||
IE11: { | ||
base: 'IE', | ||
'x-ua-compatible': 'IE=EmulateIE11' | ||
} | ||
}, | ||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['mocha'], | ||
// list of files / patterns to load in the browser | ||
files: [ | ||
// dependencies | ||
// fixtures | ||
{ pattern: 'node_modules/power-assert/build/power-assert.js', watched: true, served: true, included: true }, | ||
{ pattern: 'node_modules/lodash/lodash.js', watched: true, served: true, included: true }, | ||
{ pattern: 'node_modules/benchmark/benchmark.js', watched: true, served: true, included: true }, | ||
{ pattern: 'test/fixture/**/*.html', watched: true, served: true, included: true }, | ||
{ pattern: 'test/fixture/**/*.css', watched: true, served: true, included: false }, | ||
{ pattern: 'test/fixture/**/*.js', watched: true, served: true, included: false }, | ||
// files to test | ||
{ pattern: 'dist/*.js', watched: true, served: true, included: true }, | ||
{ pattern: 'test/**/*.js', watched: true, served: true, included: true }, | ||
{ pattern: 'benchmark/**/*.js', watched: true, served: true, included: true }, | ||
], | ||
// list of files to exclude | ||
exclude: [ | ||
], | ||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'dist/*.js': ['espower'], | ||
'test/fixture/*.html': ['html2js'], | ||
}, | ||
espowerPreprocessor: { | ||
options: { | ||
// emit espowerified code. | ||
// default: false (in-memory) | ||
emitActualCode: false, | ||
ignoreUpstreamSourceMap: true | ||
} | ||
}, | ||
// test results reporter to use | ||
// possible values: 'dots', 'progress' | ||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
reporters: ['dots'], | ||
coverageReporter: { | ||
dir: 'coverage', | ||
subdir: function (browser, platform) { | ||
return browser.toLowerCase().split(' ')[0]; | ||
module.exports = function (config) { | ||
config.set({ | ||
basePath: '', | ||
customLaunchers: { | ||
IE11: { | ||
base: 'IE', | ||
'x-ua-compatible': 'IE=EmulateIE11' | ||
} | ||
}, | ||
reporters: [ | ||
{ type: 'lcov' }, | ||
{ type: 'text-summary', subdir: '.', file: 'summary.txt' } | ||
] | ||
}, | ||
// web server port | ||
port: 9876, | ||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
//logLevel: config.LOG_INFO, | ||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
autoWatchBatchDelay: 500, | ||
// start these browsers | ||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
//browsers: ['PhantomJS', 'Chrome', 'Firefox', 'IE'], | ||
browsers: ['Chrome'], | ||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: true | ||
}; | ||
frameworks: ['mocha'], | ||
files: [ | ||
{ pattern: 'node_modules/power-assert/build/power-assert.js', watched: true, served: true, included: true }, | ||
{ pattern: 'dist/*.js', watched: true, served: true, included: true } | ||
], | ||
exclude: [ | ||
], | ||
espowerPreprocessor: { | ||
options: { | ||
emitActualCode: false, | ||
ignoreUpstreamSourceMap: true | ||
} | ||
}, | ||
reporters: ['dots'], | ||
coverageReporter: { | ||
dir: 'coverage', | ||
subdir: function (browser, platform) { | ||
return browser.toLowerCase().split(' ')[0]; | ||
}, | ||
reporters: [ | ||
{ type: 'lcov' }, | ||
{ type: 'text-summary', subdir: '.', file: 'summary.txt' } | ||
] | ||
}, | ||
autoWatch: true, | ||
browsers: ['Chrome'] | ||
}); | ||
} |
{ | ||
"name": "typed-dom", | ||
"version": "0.0.6", | ||
"description": "Typed html dom structs.", | ||
"version": "0.0.7", | ||
"description": "Static typed html dom builder.", | ||
"private": false, | ||
@@ -18,5 +18,2 @@ "homepage": "https://github.com/falsandtru/typed-dom", | ||
"main": "./dist/typed-dom.js", | ||
"scripts": { | ||
"test": "gulp server" | ||
}, | ||
"files": [ | ||
@@ -36,8 +33,5 @@ "dist", | ||
"devDependencies": { | ||
"benchmark": "^2.1.0", | ||
"browser-sync": "^2.12.5", | ||
"del": "^2.2.0", | ||
"extend": "^3.0.0", | ||
"gulp": "^3.9.1", | ||
"gulp-cached": "^1.1.0", | ||
"gulp-footer": "^1.0.5", | ||
@@ -48,6 +42,5 @@ "gulp-header": "^1.8.2", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-typescript": "^2.13.3", | ||
"gulp-typescript": "^2.13.4", | ||
"gulp-uglify": "^1.5.3", | ||
"gulp-unassert": "^1.0.0", | ||
"intelli-espower-loader": "^1.0.1", | ||
"karma": "0.13.22", | ||
@@ -59,15 +52,13 @@ "karma-chrome-launcher": "^1.0.1", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-html2js-preprocessor": "^1.0.0", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-mocha": "^1.0.1", | ||
"lodash": "^4.11.2", | ||
"mocha": "^2.4.5", | ||
"npm-check-updates": "^2.6.4", | ||
"power-assert": "^1.4.0", | ||
"run-sequence": "^1.1.5", | ||
"mocha": "^2.5.0", | ||
"npm-check-updates": "^2.6.5", | ||
"power-assert": "^1.4.1", | ||
"run-sequence": "^1.2.0", | ||
"tsd": "^0.6.5", | ||
"typescript": "^1.8.10" | ||
"typescript": "1.9.0-dev.20160513" | ||
}, | ||
"engines": { | ||
"node": ">=4.0" | ||
"scripts": { | ||
"test": "gulp server" | ||
}, | ||
@@ -74,0 +65,0 @@ "author": "falsandtru", |
import {default as Builder, TypedHTML, TypedHTMLContents} from 'typed-dom'; | ||
export function build<S extends string, T extends HTMLElement, U extends TypedHTMLContents<HTMLElement>>(factory: () => T, contents: U = <any>[]): TypedHTML<S, T, U> { | ||
export function build<S extends string, T extends HTMLElement, U extends TypedHTMLContents<HTMLElement>>(factory: () => T, contents: U = <any>[], attrs: {} = {}): TypedHTML<S, T, U> { | ||
const raw = factory(); | ||
void Object.keys(attrs) | ||
.forEach(attr => raw.setAttribute(attr, attrs[attr] || '')); | ||
void Object.keys(contents) | ||
.forEach(k => void raw.appendChild(contents[k].raw)); | ||
contents = contents instanceof Array | ||
? Object.freeze(contents) | ||
// https://github.com/Microsoft/TypeScript/issues/8563 | ||
? <any>Object.freeze(contents) | ||
: observe(contents); | ||
@@ -10,0 +13,0 @@ return <TypedHTML<S, T, U>>Object.freeze({ |
@@ -5,675 +5,139 @@ import {TypedHTML as ITypedHTML, TypedHTMLContents} from 'typed-dom'; | ||
export type TypedHTML<S extends string, T extends HTMLElement, U extends TypedHTMLContents<HTMLElement>> = ITypedHTML<S, T, U>; | ||
export const TypedHTML = { | ||
a | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLAnchorElement = () => document.createElement('a')) | ||
: TypedHTML<string, HTMLAnchorElement, T> { | ||
return build(factory, contents); | ||
}, | ||
abbr | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('abbr')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
acronym | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('acronym')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
address | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBlockElement = () => document.createElement('address')) | ||
: TypedHTML<string, HTMLBlockElement, T> { | ||
return build(factory, contents); | ||
}, | ||
applet | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLAppletElement = () => document.createElement('applet')) | ||
: TypedHTML<string, HTMLAppletElement, T> { | ||
return build(factory, contents); | ||
}, | ||
area | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLAreaElement = () => document.createElement('area')) | ||
: TypedHTML<string, HTMLAreaElement, T> { | ||
return build(factory, contents); | ||
}, | ||
audio | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLAudioElement = () => document.createElement('audio')) | ||
: TypedHTML<string, HTMLAudioElement, T> { | ||
return build(factory, contents); | ||
}, | ||
b | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('b')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
base | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBaseElement = () => document.createElement('base')) | ||
: TypedHTML<string, HTMLBaseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
basefont | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBaseFontElement = () => document.createElement('basefont')) | ||
: TypedHTML<string, HTMLBaseFontElement, T> { | ||
return build(factory, contents); | ||
}, | ||
bdo | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('bdo')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
big | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('big')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
blockquote | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBlockElement = () => document.createElement('blockquote')) | ||
: TypedHTML<string, HTMLBlockElement, T> { | ||
return build(factory, contents); | ||
}, | ||
body | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBodyElement = () => document.createElement('body')) | ||
: TypedHTML<string, HTMLBodyElement, T> { | ||
return build(factory, contents); | ||
}, | ||
br | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBRElement = () => document.createElement('br')) | ||
: TypedHTML<string, HTMLBRElement, T> { | ||
return build(factory, contents); | ||
}, | ||
button | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLButtonElement = () => document.createElement('button')) | ||
: TypedHTML<string, HTMLButtonElement, T> { | ||
return build(factory, contents); | ||
}, | ||
canvas | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLCanvasElement = () => document.createElement('canvas')) | ||
: TypedHTML<string, HTMLCanvasElement, T> { | ||
return build(factory, contents); | ||
}, | ||
caption | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableCaptionElement = () => document.createElement('caption')) | ||
: TypedHTML<string, HTMLTableCaptionElement, T> { | ||
return build(factory, contents); | ||
}, | ||
center | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBlockElement = () => document.createElement('center')) | ||
: TypedHTML<string, HTMLBlockElement, T> { | ||
return build(factory, contents); | ||
}, | ||
cite | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('cite')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
code | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('code')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
col | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableColElement = () => document.createElement('col')) | ||
: TypedHTML<string, HTMLTableColElement, T> { | ||
return build(factory, contents); | ||
}, | ||
colgroup | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableColElement = () => document.createElement('colgroup')) | ||
: TypedHTML<string, HTMLTableColElement, T> { | ||
return build(factory, contents); | ||
}, | ||
datalist | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLDataListElement = () => document.createElement('datalist')) | ||
: TypedHTML<string, HTMLDataListElement, T> { | ||
return build(factory, contents); | ||
}, | ||
dd | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLDDElement = () => document.createElement('dd')) | ||
: TypedHTML<string, HTMLDDElement, T> { | ||
return build(factory, contents); | ||
}, | ||
del | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLModElement = () => document.createElement('del')) | ||
: TypedHTML<string, HTMLModElement, T> { | ||
return build(factory, contents); | ||
}, | ||
dfn | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('dfn')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
dir | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLDirectoryElement = () => document.createElement('dir')) | ||
: TypedHTML<string, HTMLDirectoryElement, T> { | ||
return build(factory, contents); | ||
}, | ||
div | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLDivElement = () => document.createElement('div')) | ||
: TypedHTML<string, HTMLDivElement, T> { | ||
return build(factory, contents); | ||
}, | ||
dl | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLDListElement = () => document.createElement('dl')) | ||
: TypedHTML<string, HTMLDListElement, T> { | ||
return build(factory, contents); | ||
}, | ||
dt | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLDTElement = () => document.createElement('dt')) | ||
: TypedHTML<string, HTMLDTElement, T> { | ||
return build(factory, contents); | ||
}, | ||
em | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('em')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
embed | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLEmbedElement = () => document.createElement('embed')) | ||
: TypedHTML<string, HTMLEmbedElement, T> { | ||
return build(factory, contents); | ||
}, | ||
fieldset | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLFieldSetElement = () => document.createElement('fieldset')) | ||
: TypedHTML<string, HTMLFieldSetElement, T> { | ||
return build(factory, contents); | ||
}, | ||
font | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLFontElement = () => document.createElement('font')) | ||
: TypedHTML<string, HTMLFontElement, T> { | ||
return build(factory, contents); | ||
}, | ||
form | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLFormElement = () => document.createElement('form')) | ||
: TypedHTML<string, HTMLFormElement, T> { | ||
return build(factory, contents); | ||
}, | ||
frame | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLFrameElement = () => document.createElement('frame')) | ||
: TypedHTML<string, HTMLFrameElement, T> { | ||
return build(factory, contents); | ||
}, | ||
frameset | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLFrameSetElement = () => document.createElement('frameset')) | ||
: TypedHTML<string, HTMLFrameSetElement, T> { | ||
return build(factory, contents); | ||
}, | ||
h1 | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHeadingElement = () => document.createElement('h1')) | ||
: TypedHTML<string, HTMLHeadingElement, T> { | ||
return build(factory, contents); | ||
}, | ||
h2 | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHeadingElement = () => document.createElement('h2')) | ||
: TypedHTML<string, HTMLHeadingElement, T> { | ||
return build(factory, contents); | ||
}, | ||
h3 | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHeadingElement = () => document.createElement('h3')) | ||
: TypedHTML<string, HTMLHeadingElement, T> { | ||
return build(factory, contents); | ||
}, | ||
h4 | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHeadingElement = () => document.createElement('h4')) | ||
: TypedHTML<string, HTMLHeadingElement, T> { | ||
return build(factory, contents); | ||
}, | ||
h5 | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHeadingElement = () => document.createElement('h5')) | ||
: TypedHTML<string, HTMLHeadingElement, T> { | ||
return build(factory, contents); | ||
}, | ||
h6 | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHeadingElement = () => document.createElement('h6')) | ||
: TypedHTML<string, HTMLHeadingElement, T> { | ||
return build(factory, contents); | ||
}, | ||
head | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHeadElement = () => document.createElement('head')) | ||
: TypedHTML<string, HTMLHeadElement, T> { | ||
return build(factory, contents); | ||
}, | ||
hr | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHRElement = () => document.createElement('hr')) | ||
: TypedHTML<string, HTMLHRElement, T> { | ||
return build(factory, contents); | ||
}, | ||
html | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLHtmlElement = () => document.createElement('html')) | ||
: TypedHTML<string, HTMLHtmlElement, T> { | ||
return build(factory, contents); | ||
}, | ||
i | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('i')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
iframe | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLIFrameElement = () => document.createElement('iframe')) | ||
: TypedHTML<string, HTMLIFrameElement, T> { | ||
return build(factory, contents); | ||
}, | ||
img | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLImageElement = () => document.createElement('img')) | ||
: TypedHTML<string, HTMLImageElement, T> { | ||
return build(factory, contents); | ||
}, | ||
input | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLInputElement = () => document.createElement('input')) | ||
: TypedHTML<string, HTMLInputElement, T> { | ||
return build(factory, contents); | ||
}, | ||
ins | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLModElement = () => document.createElement('ins')) | ||
: TypedHTML<string, HTMLModElement, T> { | ||
return build(factory, contents); | ||
}, | ||
isindex | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLIsIndexElement = () => document.createElement('isindex')) | ||
: TypedHTML<string, HTMLIsIndexElement, T> { | ||
return build(factory, contents); | ||
}, | ||
kbd | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('kbd')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
keygen | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBlockElement = () => document.createElement('keygen')) | ||
: TypedHTML<string, HTMLBlockElement, T> { | ||
return build(factory, contents); | ||
}, | ||
label | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLLabelElement = () => document.createElement('label')) | ||
: TypedHTML<string, HTMLLabelElement, T> { | ||
return build(factory, contents); | ||
}, | ||
legend | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLLegendElement = () => document.createElement('legend')) | ||
: TypedHTML<string, HTMLLegendElement, T> { | ||
return build(factory, contents); | ||
}, | ||
li | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLLIElement = () => document.createElement('li')) | ||
: TypedHTML<string, HTMLLIElement, T> { | ||
return build(factory, contents); | ||
}, | ||
link | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLLinkElement = () => document.createElement('link')) | ||
: TypedHTML<string, HTMLLinkElement, T> { | ||
return build(factory, contents); | ||
}, | ||
listing | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBlockElement = () => document.createElement('listing')) | ||
: TypedHTML<string, HTMLBlockElement, T> { | ||
return build(factory, contents); | ||
}, | ||
map | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLMapElement = () => document.createElement('map')) | ||
: TypedHTML<string, HTMLMapElement, T> { | ||
return build(factory, contents); | ||
}, | ||
marquee | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLMarqueeElement = () => document.createElement('marquee')) | ||
: TypedHTML<string, HTMLMarqueeElement, T> { | ||
return build(factory, contents); | ||
}, | ||
menu | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLMenuElement = () => document.createElement('menu')) | ||
: TypedHTML<string, HTMLMenuElement, T> { | ||
return build(factory, contents); | ||
}, | ||
meta | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLMetaElement = () => document.createElement('meta')) | ||
: TypedHTML<string, HTMLMetaElement, T> { | ||
return build(factory, contents); | ||
}, | ||
nextid | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLNextIdElement = () => document.createElement('nextid')) | ||
: TypedHTML<string, HTMLNextIdElement, T> { | ||
return build(factory, contents); | ||
}, | ||
nobr | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('nobr')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
object | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLObjectElement = () => document.createElement('object')) | ||
: TypedHTML<string, HTMLObjectElement, T> { | ||
return build(factory, contents); | ||
}, | ||
ol | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLOListElement = () => document.createElement('ol')) | ||
: TypedHTML<string, HTMLOListElement, T> { | ||
return build(factory, contents); | ||
}, | ||
optgroup | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLOptGroupElement = () => document.createElement('optgroup')) | ||
: TypedHTML<string, HTMLOptGroupElement, T> { | ||
return build(factory, contents); | ||
}, | ||
option | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLOptionElement = () => document.createElement('option')) | ||
: TypedHTML<string, HTMLOptionElement, T> { | ||
return build(factory, contents); | ||
}, | ||
p | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLParagraphElement = () => document.createElement('p')) | ||
: TypedHTML<string, HTMLParagraphElement, T> { | ||
return build(factory, contents); | ||
}, | ||
param | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLParamElement = () => document.createElement('param')) | ||
: TypedHTML<string, HTMLParamElement, T> { | ||
return build(factory, contents); | ||
}, | ||
picture | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPictureElement = () => document.createElement('picture')) | ||
: TypedHTML<string, HTMLPictureElement, T> { | ||
return build(factory, contents); | ||
}, | ||
plaintext | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBlockElement = () => document.createElement('plaintext')) | ||
: TypedHTML<string, HTMLBlockElement, T> { | ||
return build(factory, contents); | ||
}, | ||
pre | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPreElement = () => document.createElement('pre')) | ||
: TypedHTML<string, HTMLPreElement, T> { | ||
return build(factory, contents); | ||
}, | ||
progress | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLProgressElement = () => document.createElement('progress')) | ||
: TypedHTML<string, HTMLProgressElement, T> { | ||
return build(factory, contents); | ||
}, | ||
q | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLQuoteElement = () => document.createElement('q')) | ||
: TypedHTML<string, HTMLQuoteElement, T> { | ||
return build(factory, contents); | ||
}, | ||
rt | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('rt')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
ruby | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('ruby')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
s | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('s')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
samp | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('samp')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
script | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLScriptElement = () => document.createElement('script')) | ||
: TypedHTML<string, HTMLScriptElement, T> { | ||
return build(factory, contents); | ||
}, | ||
select | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLSelectElement = () => document.createElement('select')) | ||
: TypedHTML<string, HTMLSelectElement, T> { | ||
return build(factory, contents); | ||
}, | ||
small | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('small')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
source | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLSourceElement = () => document.createElement('source')) | ||
: TypedHTML<string, HTMLSourceElement, T> { | ||
return build(factory, contents); | ||
}, | ||
span | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLSpanElement = () => document.createElement('span')) | ||
: TypedHTML<string, HTMLSpanElement, T> { | ||
return build(factory, contents); | ||
}, | ||
strike | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('strike')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
strong | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('strong')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
style | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLStyleElement = () => document.createElement('style')) | ||
: TypedHTML<string, HTMLStyleElement, T> { | ||
return build(factory, contents); | ||
}, | ||
sub | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('sub')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
sup | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('sup')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
table | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableElement = () => document.createElement('table')) | ||
: TypedHTML<string, HTMLTableElement, T> { | ||
return build(factory, contents); | ||
}, | ||
tbody | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableSectionElement = () => document.createElement('tbody')) | ||
: TypedHTML<string, HTMLTableSectionElement, T> { | ||
return build(factory, contents); | ||
}, | ||
td | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableDataCellElement = () => document.createElement('td')) | ||
: TypedHTML<string, HTMLTableDataCellElement, T> { | ||
return build(factory, contents); | ||
}, | ||
textarea | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTextAreaElement = () => document.createElement('textarea')) | ||
: TypedHTML<string, HTMLTextAreaElement, T> { | ||
return build(factory, contents); | ||
}, | ||
tfoot | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableSectionElement = () => document.createElement('tfoot')) | ||
: TypedHTML<string, HTMLTableSectionElement, T> { | ||
return build(factory, contents); | ||
}, | ||
th | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableHeaderCellElement = () => document.createElement('th')) | ||
: TypedHTML<string, HTMLTableHeaderCellElement, T> { | ||
return build(factory, contents); | ||
}, | ||
thead | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableSectionElement = () => document.createElement('thead')) | ||
: TypedHTML<string, HTMLTableSectionElement, T> { | ||
return build(factory, contents); | ||
}, | ||
title | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTitleElement = () => document.createElement('title')) | ||
: TypedHTML<string, HTMLTitleElement, T> { | ||
return build(factory, contents); | ||
}, | ||
tr | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTableRowElement = () => document.createElement('tr')) | ||
: TypedHTML<string, HTMLTableRowElement, T> { | ||
return build(factory, contents); | ||
}, | ||
track | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLTrackElement = () => document.createElement('track')) | ||
: TypedHTML<string, HTMLTrackElement, T> { | ||
return build(factory, contents); | ||
}, | ||
tt | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('tt')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
u | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('u')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
ul | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLUListElement = () => document.createElement('ul')) | ||
: TypedHTML<string, HTMLUListElement, T> { | ||
return build(factory, contents); | ||
}, | ||
var | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLPhraseElement = () => document.createElement('var')) | ||
: TypedHTML<string, HTMLPhraseElement, T> { | ||
return build(factory, contents); | ||
}, | ||
video | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLVideoElement = () => document.createElement('video')) | ||
: TypedHTML<string, HTMLVideoElement, T> { | ||
return build(factory, contents); | ||
}, | ||
xmp | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLBlockElement = () => document.createElement('xmp')) | ||
: TypedHTML<string, HTMLBlockElement, T> { | ||
return build(factory, contents); | ||
}, | ||
article | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLElement = () => document.createElement('article')) | ||
: TypedHTML<string, HTMLElement, T> { | ||
return build(factory, contents); | ||
}, | ||
aside | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLElement = () => document.createElement('aside')) | ||
: TypedHTML<string, HTMLElement, T> { | ||
return build(factory, contents); | ||
}, | ||
nav | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLElement = () => document.createElement('nav')) | ||
: TypedHTML<string, HTMLElement, T> { | ||
return build(factory, contents); | ||
}, | ||
section | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, factory: () => HTMLElement = () => document.createElement('section')) | ||
: TypedHTML<string, HTMLElement, T> { | ||
return build(factory, contents); | ||
}, | ||
untyped | ||
<T extends TypedHTMLContents<HTMLElement>, U extends HTMLElement> | ||
(contents: T, factory: () => U) | ||
: TypedHTML<string, U, T> { | ||
return build(factory, contents); | ||
} | ||
}; | ||
export const TypedHTML: TypedHTML<string, HTMLElement, TypedHTMLContents<HTMLElement>> = [ | ||
// lib.dom.d.ts | ||
'a', | ||
'abbr', | ||
'acronym', | ||
'address', | ||
'applet', | ||
'area', | ||
'article', | ||
'aside', | ||
'audio', | ||
'b', | ||
'base', | ||
'basefont', | ||
'bdo', | ||
'big', | ||
'blockquote', | ||
'body', | ||
'br', | ||
'button', | ||
'canvas', | ||
'caption', | ||
'center', | ||
'cite', | ||
'code', | ||
'col', | ||
'colgroup', | ||
'datalist', | ||
'dd', | ||
'del', | ||
'dfn', | ||
'dir', | ||
'div', | ||
'dl', | ||
'dt', | ||
'em', | ||
'embed', | ||
'fieldset', | ||
'figcaption', | ||
'figure', | ||
'font', | ||
'footer', | ||
'form', | ||
'frame', | ||
'frameset', | ||
'h1', | ||
'h2', | ||
'h3', | ||
'h4', | ||
'h5', | ||
'h6', | ||
'head', | ||
'header', | ||
'hgroup', | ||
'hr', | ||
'html', | ||
'i', | ||
'iframe', | ||
'img', | ||
'input', | ||
'ins', | ||
'isindex', | ||
'kbd', | ||
'keygen', | ||
'label', | ||
'legend', | ||
'li', | ||
'link', | ||
'listing', | ||
'map', | ||
'mark', | ||
'marquee', | ||
'menu', | ||
'meta', | ||
'nav', | ||
'nextid', | ||
'nobr', | ||
'noframes', | ||
'noscript', | ||
'object', | ||
'ol', | ||
'optgroup', | ||
'option', | ||
'p', | ||
'param', | ||
'picture', | ||
'plaintext', | ||
'pre', | ||
'progress', | ||
'q', | ||
'rt', | ||
'ruby', | ||
's', | ||
'samp', | ||
'script', | ||
'section', | ||
'select', | ||
'small', | ||
'source', | ||
'span', | ||
'strike', | ||
'strong', | ||
'style', | ||
'sub', | ||
'sup', | ||
'table', | ||
'tbody', | ||
'td', | ||
'template', | ||
'textarea', | ||
'tfoot', | ||
'th', | ||
'thead', | ||
'title', | ||
'tr', | ||
'track', | ||
'tt', | ||
'u', | ||
'ul', | ||
'var', | ||
'video', | ||
'wbr', | ||
'xmp', | ||
// custom | ||
'custom' | ||
] | ||
.reduce((obj, tag) => { | ||
obj[tag] = | ||
<T extends TypedHTMLContents<HTMLElement>> | ||
(contents?: T, attrs?: { [attr: string]: string; }, factory?: () => HTMLElement) | ||
: TypedHTML<string, HTMLElement, T> => { | ||
if (!factory && typeof attrs === 'function') { | ||
factory = <any>attrs; | ||
} | ||
return build(factory || (() => document.createElement(tag)), contents, attrs); | ||
} | ||
return obj; | ||
}, <TypedHTML<string, HTMLElement, TypedHTMLContents<HTMLElement>>>{}); |
@@ -10,2 +10,8 @@ import TypedHTML from 'typed-dom'; | ||
it('attr', function () { | ||
const dom = TypedHTML.script([], { id: 'test', src: './' }); | ||
assert(dom.raw.id === 'test'); | ||
assert(dom.raw.getAttribute('src') === './'); | ||
}); | ||
it('struct', function () { | ||
@@ -12,0 +18,0 @@ const struct = TypedHTML.article({ |
@@ -6,2 +6,3 @@ { | ||
"moduleResolution": "node", | ||
"lib": ["es6", "dom"], | ||
"allowSyntheticDefaultImports": true, | ||
@@ -12,5 +13,5 @@ "noImplicitAny": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"allowUnreachableCode": true, | ||
"allowUnusedLabels": true, | ||
"preserveConstEnums": true, | ||
"strictNullChecks": true, | ||
"rootDir": "./", | ||
@@ -17,0 +18,0 @@ "forceConsistentCasingInFileNames": true, |
@@ -20,19 +20,22 @@ /** | ||
<U extends TypedHTMLContents<HTMLElement>>(contents: U, factory?: () => T): TypedHTML<S, T, U>; | ||
<U extends TypedHTMLContents<HTMLElement>>(contents: U, attrs: { [attr: string]: string; }, factory?: () => T): TypedHTML<S, T, U>; | ||
} | ||
const TypedHTML: { | ||
// lib.d.ts | ||
// lib.dom.d.ts | ||
a: TypedHTMLBuilder<HTMLAnchorElement, 'a'>; | ||
abbr: TypedHTMLBuilder<HTMLPhraseElement, 'abbr'>; | ||
acronym: TypedHTMLBuilder<HTMLPhraseElement, 'acronym'>; | ||
address: TypedHTMLBuilder<HTMLBlockElement, 'address'>; | ||
abbr: TypedHTMLBuilder<HTMLElement, 'abbr'>; | ||
acronym: TypedHTMLBuilder<HTMLElement, 'acronym'>; | ||
address: TypedHTMLBuilder<HTMLElement, 'address'>; | ||
applet: TypedHTMLBuilder<HTMLAppletElement, 'applet'>; | ||
area: TypedHTMLBuilder<HTMLAreaElement, 'area'>; | ||
article: TypedHTMLBuilder<HTMLElement, 'article'>; | ||
aside: TypedHTMLBuilder<HTMLElement, 'aside'>; | ||
audio: TypedHTMLBuilder<HTMLAudioElement, 'audio'>; | ||
b: TypedHTMLBuilder<HTMLPhraseElement, 'b'>; | ||
b: TypedHTMLBuilder<HTMLElement, 'b'>; | ||
base: TypedHTMLBuilder<HTMLBaseElement, 'base'>; | ||
basefont: TypedHTMLBuilder<HTMLBaseFontElement, 'basefont'>; | ||
bdo: TypedHTMLBuilder<HTMLPhraseElement, 'bdo'>; | ||
big: TypedHTMLBuilder<HTMLPhraseElement, 'big'>; | ||
blockquote: TypedHTMLBuilder<HTMLBlockElement, 'blockquote'>; | ||
bdo: TypedHTMLBuilder<HTMLElement, 'bdo'>; | ||
big: TypedHTMLBuilder<HTMLElement, 'big'>; | ||
blockquote: TypedHTMLBuilder<HTMLQuoteElement, 'blockquote'>; | ||
body: TypedHTMLBuilder<HTMLBodyElement, 'body'>; | ||
@@ -43,19 +46,22 @@ br: TypedHTMLBuilder<HTMLBRElement, 'br'>; | ||
caption: TypedHTMLBuilder<HTMLTableCaptionElement, 'caption'>; | ||
center: TypedHTMLBuilder<HTMLBlockElement, 'center'>; | ||
cite: TypedHTMLBuilder<HTMLPhraseElement, 'cite'>; | ||
code: TypedHTMLBuilder<HTMLPhraseElement, 'code'>; | ||
center: TypedHTMLBuilder<HTMLElement, 'center'>; | ||
cite: TypedHTMLBuilder<HTMLElement, 'cite'>; | ||
code: TypedHTMLBuilder<HTMLElement, 'code'>; | ||
col: TypedHTMLBuilder<HTMLTableColElement, 'col'>; | ||
colgroup: TypedHTMLBuilder<HTMLTableColElement, 'colgroup'>; | ||
datalist: TypedHTMLBuilder<HTMLDataListElement, 'datalist'>; | ||
dd: TypedHTMLBuilder<HTMLDDElement, 'dd'>; | ||
dd: TypedHTMLBuilder<HTMLElement, 'dd'>; | ||
del: TypedHTMLBuilder<HTMLModElement, 'del'>; | ||
dfn: TypedHTMLBuilder<HTMLPhraseElement, 'dfn'>; | ||
dfn: TypedHTMLBuilder<HTMLElement, 'dfn'>; | ||
dir: TypedHTMLBuilder<HTMLDirectoryElement, 'dir'>; | ||
div: TypedHTMLBuilder<HTMLDivElement, 'div'>; | ||
dl: TypedHTMLBuilder<HTMLDListElement, 'dl'>; | ||
dt: TypedHTMLBuilder<HTMLDTElement, 'dt'>; | ||
em: TypedHTMLBuilder<HTMLPhraseElement, 'em'>; | ||
dt: TypedHTMLBuilder<HTMLElement, 'dt'>; | ||
em: TypedHTMLBuilder<HTMLElement, 'em'>; | ||
embed: TypedHTMLBuilder<HTMLEmbedElement, 'embed'>; | ||
fieldset: TypedHTMLBuilder<HTMLFieldSetElement, 'fieldset'>; | ||
figcaption: TypedHTMLBuilder<HTMLElement, 'figcaption'>; | ||
figure: TypedHTMLBuilder<HTMLElement, 'figure'>; | ||
font: TypedHTMLBuilder<HTMLFontElement, 'font'>; | ||
footer: TypedHTMLBuilder<HTMLElement, 'footer'>; | ||
form: TypedHTMLBuilder<HTMLFormElement, 'form'>; | ||
@@ -71,5 +77,7 @@ frame: TypedHTMLBuilder<HTMLFrameElement, 'frame'>; | ||
head: TypedHTMLBuilder<HTMLHeadElement, 'head'>; | ||
header: TypedHTMLBuilder<HTMLElement, 'header'>; | ||
hgroup: TypedHTMLBuilder<HTMLElement, 'hgroup'>; | ||
hr: TypedHTMLBuilder<HTMLHRElement, 'hr'>; | ||
html: TypedHTMLBuilder<HTMLHtmlElement, 'html'>; | ||
i: TypedHTMLBuilder<HTMLPhraseElement, 'i'>; | ||
i: TypedHTMLBuilder<HTMLElement, 'i'>; | ||
iframe: TypedHTMLBuilder<HTMLIFrameElement, 'iframe'>; | ||
@@ -79,5 +87,5 @@ img: TypedHTMLBuilder<HTMLImageElement, 'img'>; | ||
ins: TypedHTMLBuilder<HTMLModElement, 'ins'>; | ||
isindex: TypedHTMLBuilder<HTMLIsIndexElement, 'isindex'>; | ||
kbd: TypedHTMLBuilder<HTMLPhraseElement, 'kbd'>; | ||
keygen: TypedHTMLBuilder<HTMLBlockElement, 'keygen'>; | ||
isindex: TypedHTMLBuilder<HTMLUnknownElement, 'isindex'>; | ||
kbd: TypedHTMLBuilder<HTMLElement, 'kbd'>; | ||
keygen: TypedHTMLBuilder<HTMLElement, 'keygen'>; | ||
label: TypedHTMLBuilder<HTMLLabelElement, 'label'>; | ||
@@ -87,9 +95,13 @@ legend: TypedHTMLBuilder<HTMLLegendElement, 'legend'>; | ||
link: TypedHTMLBuilder<HTMLLinkElement, 'link'>; | ||
listing: TypedHTMLBuilder<HTMLBlockElement, 'listing'>; | ||
listing: TypedHTMLBuilder<HTMLPreElement, 'listing'>; | ||
map: TypedHTMLBuilder<HTMLMapElement, 'map'>; | ||
mark: TypedHTMLBuilder<HTMLElement, 'mark'>; | ||
marquee: TypedHTMLBuilder<HTMLMarqueeElement, 'marquee'>; | ||
menu: TypedHTMLBuilder<HTMLMenuElement, 'menu'>; | ||
meta: TypedHTMLBuilder<HTMLMetaElement, 'meta'>; | ||
nextid: TypedHTMLBuilder<HTMLNextIdElement, 'nextid'>; | ||
nobr: TypedHTMLBuilder<HTMLPhraseElement, 'nobr'>; | ||
nav: TypedHTMLBuilder<HTMLElement, 'nav'>; | ||
nextid: TypedHTMLBuilder<HTMLUnknownElement, 'nextid'>; | ||
nobr: TypedHTMLBuilder<HTMLElement, 'nobr'>; | ||
noframes: TypedHTMLBuilder<HTMLElement, 'noframes'>; | ||
noscript: TypedHTMLBuilder<HTMLElement, 'noscript'>; | ||
object: TypedHTMLBuilder<HTMLObjectElement, 'object'>; | ||
@@ -102,23 +114,25 @@ ol: TypedHTMLBuilder<HTMLOListElement, 'ol'>; | ||
picture: TypedHTMLBuilder<HTMLPictureElement, 'picture'>; | ||
plaintext: TypedHTMLBuilder<HTMLBlockElement, 'plaintext'>; | ||
plaintext: TypedHTMLBuilder<HTMLElement, 'plaintext'>; | ||
pre: TypedHTMLBuilder<HTMLPreElement, 'pre'>; | ||
progress: TypedHTMLBuilder<HTMLProgressElement, 'progress'>; | ||
q: TypedHTMLBuilder<HTMLQuoteElement, 'q'>; | ||
rt: TypedHTMLBuilder<HTMLPhraseElement, 'rt'>; | ||
ruby: TypedHTMLBuilder<HTMLPhraseElement, 'ruby'>; | ||
s: TypedHTMLBuilder<HTMLPhraseElement, 's'>; | ||
samp: TypedHTMLBuilder<HTMLPhraseElement, 'samp'>; | ||
rt: TypedHTMLBuilder<HTMLElement, 'rt'>; | ||
ruby: TypedHTMLBuilder<HTMLElement, 'ruby'>; | ||
s: TypedHTMLBuilder<HTMLElement, 's'>; | ||
samp: TypedHTMLBuilder<HTMLElement, 'samp'>; | ||
script: TypedHTMLBuilder<HTMLScriptElement, 'script'>; | ||
section: TypedHTMLBuilder<HTMLElement, 'section'>; | ||
select: TypedHTMLBuilder<HTMLSelectElement, 'select'>; | ||
small: TypedHTMLBuilder<HTMLPhraseElement, 'small'>; | ||
small: TypedHTMLBuilder<HTMLElement, 'small'>; | ||
source: TypedHTMLBuilder<HTMLSourceElement, 'source'>; | ||
span: TypedHTMLBuilder<HTMLSpanElement, 'span'>; | ||
strike: TypedHTMLBuilder<HTMLPhraseElement, 'strike'>; | ||
strong: TypedHTMLBuilder<HTMLPhraseElement, 'strong'>; | ||
strike: TypedHTMLBuilder<HTMLElement, 'strike'>; | ||
strong: TypedHTMLBuilder<HTMLElement, 'strong'>; | ||
style: TypedHTMLBuilder<HTMLStyleElement, 'style'>; | ||
sub: TypedHTMLBuilder<HTMLPhraseElement, 'sub'>; | ||
sup: TypedHTMLBuilder<HTMLPhraseElement, 'sup'>; | ||
sub: TypedHTMLBuilder<HTMLElement, 'sub'>; | ||
sup: TypedHTMLBuilder<HTMLElement, 'sup'>; | ||
table: TypedHTMLBuilder<HTMLTableElement, 'table'>; | ||
tbody: TypedHTMLBuilder<HTMLTableSectionElement, 'tbody'>; | ||
td: TypedHTMLBuilder<HTMLTableDataCellElement, 'td'>; | ||
template: TypedHTMLBuilder<HTMLTemplateElement, 'template'>; | ||
textarea: TypedHTMLBuilder<HTMLTextAreaElement, 'textarea'>; | ||
@@ -131,17 +145,13 @@ tfoot: TypedHTMLBuilder<HTMLTableSectionElement, 'tfoot'>; | ||
track: TypedHTMLBuilder<HTMLTrackElement, 'track'>; | ||
tt: TypedHTMLBuilder<HTMLPhraseElement, 'tt'>; | ||
u: TypedHTMLBuilder<HTMLPhraseElement, 'u'>; | ||
tt: TypedHTMLBuilder<HTMLElement, 'tt'>; | ||
u: TypedHTMLBuilder<HTMLElement, 'u'>; | ||
ul: TypedHTMLBuilder<HTMLUListElement, 'ul'>; | ||
var: TypedHTMLBuilder<HTMLPhraseElement, 'var'>; | ||
var: TypedHTMLBuilder<HTMLElement, 'var'>; | ||
video: TypedHTMLBuilder<HTMLVideoElement, 'video'>; | ||
xmp: TypedHTMLBuilder<HTMLBlockElement, 'xmp'>; | ||
// sectioning contents | ||
article: TypedHTMLBuilder<HTMLElement, 'article'>; | ||
aside: TypedHTMLBuilder<HTMLElement, 'aside'>; | ||
nav: TypedHTMLBuilder<HTMLElement, 'nav'>; | ||
section: TypedHTMLBuilder<HTMLElement, 'section'>; | ||
// untyped | ||
untyped<T extends TypedHTMLContents<HTMLElement>, U extends HTMLElement, V extends string>(contents: T, factory: () => U, identity: V): TypedHTML<V, U, T>; | ||
wbr: TypedHTMLBuilder<HTMLElement, 'wbr'>; | ||
xmp: TypedHTMLBuilder<HTMLPreElement, 'xmp'>; | ||
// custom | ||
custom<T extends TypedHTMLContents<HTMLElement>, U extends HTMLElement, V extends string>(contents: T, factory: () => U, identity: V): TypedHTML<V, U, T>; | ||
}; | ||
export default TypedHTML; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
25
52672
24
1417
2