typed-dom
Advanced tools
Comparing version 0.0.24 to 0.0.25
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.24 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License */ | ||
/*! typed-dom v0.0.25 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License */ | ||
require = function e(t, n, r) { | ||
@@ -50,2 +50,3 @@ function s(o, u) { | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var TypedHTMLElement = function () { | ||
@@ -168,2 +169,3 @@ function TypedHTMLElement(element_, children_) { | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var builder_1 = require('./builder'); | ||
@@ -315,13 +317,109 @@ exports.TypedHTML = [ | ||
'use strict'; | ||
function __export(m) { | ||
for (var p in m) | ||
if (!exports.hasOwnProperty(p)) | ||
exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var html_1 = require('./dom/html'); | ||
exports.default = html_1.TypedHTML; | ||
exports.TypedHTML = html_1.TypedHTML; | ||
__export(require('./util/dom')); | ||
}, | ||
{ './dom/html': 4 } | ||
{ | ||
'./dom/html': 4, | ||
'./util/dom': 6 | ||
} | ||
], | ||
6: [ | ||
function (require, module, exports) { | ||
arguments[4][1][0].apply(exports, arguments); | ||
'use strict'; | ||
var __assign = this && this.__assign || Object.assign || function (t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) | ||
if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var noop_1 = require('./noop'); | ||
function bind(target, type, listener, option) { | ||
if (option === void 0) { | ||
option = false; | ||
} | ||
void target.addEventListener(type, handler, adjustEventListenerOptions(option)); | ||
var unbind = function () { | ||
return unbind = noop_1.noop, void target.removeEventListener(type, handler, adjustEventListenerOptions(option)); | ||
}; | ||
return function () { | ||
return void unbind(); | ||
}; | ||
function handler(ev) { | ||
if (typeof option === 'object' && option.passive) { | ||
ev.preventDefault = noop_1.noop; | ||
} | ||
void listener(ev); | ||
} | ||
} | ||
exports.bind = bind; | ||
function once(target, type, listener, option) { | ||
if (option === void 0) { | ||
option = false; | ||
} | ||
var unbind = bind(target, type, function (ev) { | ||
void unbind(); | ||
void listener(ev); | ||
}, option); | ||
return function () { | ||
return void unbind(); | ||
}; | ||
} | ||
exports.once = once; | ||
function delegate(target, selector, type, listener, option) { | ||
if (option === void 0) { | ||
option = {}; | ||
} | ||
return bind(target, type, function (ev) { | ||
var cx = ev.target.closest(selector); | ||
if (!cx) | ||
return; | ||
void Array.from(target.querySelectorAll(selector)).filter(function (el) { | ||
return el === cx; | ||
}).forEach(function (el) { | ||
return void once(el, type, function (ev) { | ||
void listener(ev); | ||
}, option); | ||
}); | ||
}, __assign({}, option, { capture: true })); | ||
} | ||
exports.delegate = delegate; | ||
var supportEventListenerOptions = false; | ||
try { | ||
document.createElement('div').addEventListener('test', function () { | ||
}, { | ||
get capture() { | ||
return supportEventListenerOptions = true; | ||
} | ||
}); | ||
} catch (e) { | ||
} | ||
function adjustEventListenerOptions(option) { | ||
return supportEventListenerOptions ? option : typeof option === 'boolean' ? option : option.capture; | ||
} | ||
}, | ||
{ 'dup': 1 } | ||
{ './noop': 7 } | ||
], | ||
7: [ | ||
function (require, module, exports) { | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function noop() { | ||
return; | ||
} | ||
exports.noop = noop; | ||
}, | ||
{} | ||
], | ||
'typed-dom': [ | ||
@@ -335,6 +433,6 @@ function (require, module, exports) { | ||
} | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
__export(require('./src/export')); | ||
var export_1 = require('./src/export'); | ||
exports.default = export_1.default; | ||
exports.__esModule = true; | ||
}, | ||
@@ -346,4 +444,3 @@ { './src/export': 5 } | ||
2, | ||
6, | ||
'typed-dom' | ||
]); |
@@ -1,2 +0,2 @@ | ||
/*! typed-dom v0.0.24 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License */ | ||
require=function e(t,r,n){function i(c,s){if(!r[c]){if(!t[c]){var u="function"==typeof require&&require;if(!s&&u)return u(c,!0);if(o)return o(c,!0);var d=new Error("Cannot find module '"+c+"'");throw d.code="MODULE_NOT_FOUND",d}var a=r[c]={exports:{}};t[c][0].call(a.exports,function(e){var r=t[c][1][e];return i(r?r:e)},a,a.exports,e,t,r,n)}return r[c].exports}for(var o="function"==typeof require&&require,c=0;c<n.length;c++)i(n[c]);return i}({1:[function(e,t,r){},{}],2:[function(e,t,r){arguments[4][1][0].apply(r,arguments)},{dup:1}],3:[function(e,t,r){"use strict";var n=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},i=function(){function e(e,t){var r=this;if(this.element_=e,this.children_=t,this.mode=void 0===this.children_?"empty":"string"==typeof this.children_?"text":Array.isArray(this.children_)?"collection":"struct",this.structkeys="struct"===this.mode?Object.keys(this.children_):[],void 0!==t)switch(this.mode){case"empty":return;case"text":return this.children_=document.createTextNode(""),void this.element_.appendChild(this.children_),void(this.children=t);case"collection":return this.children_=Object.freeze([]),void(this.children=t);case"struct":return this.children_=this.observe(n({},t)),void void this.structkeys.forEach(function(e){return void r.element_.appendChild(t[e].element)})}}return Object.defineProperty(e.prototype,"element",{get:function(){return this.element_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){switch(this.mode){case"text":return this.children_.data;default:return this.children_}},set:function(e){var t=this;switch(this.mode){case"empty":return;case"text":if(e===this.children_.data)return;return void(this.children_.data=e);case"collection":if(e===this.children_)return;if(!Object.isFrozen(this.children_))throw new Error("TypedHTMLElement collections cannot be updated recursively.");return void e.reduce(function(e,t){var r=e.indexOf(t);return r===-1?e:(void e.splice(r,1),e)},this.children_.slice()).forEach(function(e){return void e.element.remove()}),this.children_=[],void e.forEach(function(e,r){return t.children_[r]=e,void t.element_.appendChild(e.element)}),void void Object.freeze(this.children_);case"struct":if(e===this.children_)return;return void void this.structkeys.forEach(function(r){return t.children_[r]=e[r]})}},enumerable:!0,configurable:!0}),e.prototype.observe=function(e){var t=this;return Object.defineProperties(e,this.structkeys.reduce(function(r,n){var i=e[n];return r[n]={configurable:!0,enumerable:!0,get:function(){return i},set:function(e){var r=i;e!==r&&(i=e,void t.element_.replaceChild(e.element,r.element))}},r},{}))},e}();r.TypedHTMLElement=i},{}],4:[function(e,t,r){"use strict";function n(e,t){return void Object.keys(e).forEach(function(r){return void t.setAttribute(r,e[r]||"")}),t}var i=e("./builder");r.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","meter","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,r,o){return e&&r&&"function"!=typeof r?new i.TypedHTMLElement(n(e,(o||function(){return document.createElement(t)})()),r):new i.TypedHTMLElement((r||function(){return document.createElement(t)})(),e)},e},{})},{"./builder":3}],5:[function(e,t,r){"use strict";var n=e("./dom/html");r.default=n.TypedHTML},{"./dom/html":4}],6:[function(e,t,r){arguments[4][1][0].apply(r,arguments)},{dup:1}],"typed-dom":[function(e,t,r){"use strict";function n(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}n(e("./src/export"));var i=e("./src/export");r.default=i.default,r.__esModule=!0},{"./src/export":5}]},{},[1,2,6,"typed-dom"]); | ||
/*! typed-dom v0.0.25 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License */ | ||
require=function e(t,r,n){function i(c,u){if(!r[c]){if(!t[c]){var s="function"==typeof require&&require;if(!u&&s)return s(c,!0);if(o)return o(c,!0);var d=new Error("Cannot find module '"+c+"'");throw d.code="MODULE_NOT_FOUND",d}var a=r[c]={exports:{}};t[c][0].call(a.exports,function(e){var r=t[c][1][e];return i(r||e)},a,a.exports,e,t,r,n)}return r[c].exports}for(var o="function"==typeof require&&require,c=0;c<n.length;c++)i(n[c]);return i}({1:[function(e,t,r){},{}],2:[function(e,t,r){arguments[4][1][0].apply(r,arguments)},{dup:1}],3:[function(e,t,r){"use strict";var n=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e};Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){var r=this;if(this.element_=e,this.children_=t,this.mode=void 0===this.children_?"empty":"string"==typeof this.children_?"text":Array.isArray(this.children_)?"collection":"struct",this.structkeys="struct"===this.mode?Object.keys(this.children_):[],void 0!==t)switch(this.mode){case"empty":return;case"text":return this.children_=document.createTextNode(""),this.element_.appendChild(this.children_),void(this.children=t);case"collection":return this.children_=Object.freeze([]),void(this.children=t);case"struct":return this.children_=this.observe(n({},t)),void this.structkeys.forEach(function(e){return void r.element_.appendChild(t[e].element)})}}return Object.defineProperty(e.prototype,"element",{get:function(){return this.element_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){switch(this.mode){case"text":return this.children_.data;default:return this.children_}},set:function(e){var t=this;switch(this.mode){case"empty":return;case"text":if(e===this.children_.data)return;return void(this.children_.data=e);case"collection":if(e===this.children_)return;if(!Object.isFrozen(this.children_))throw new Error("TypedHTMLElement collections cannot be updated recursively.");return e.reduce(function(e,t){var r=e.indexOf(t);return-1===r?e:(e.splice(r,1),e)},this.children_.slice()).forEach(function(e){return void e.element.remove()}),this.children_=[],e.forEach(function(e,r){return t.children_[r]=e,void t.element_.appendChild(e.element)}),void Object.freeze(this.children_);case"struct":if(e===this.children_)return;return void this.structkeys.forEach(function(r){return t.children_[r]=e[r]})}},enumerable:!0,configurable:!0}),e.prototype.observe=function(e){var t=this;return Object.defineProperties(e,this.structkeys.reduce(function(r,n){var i=e[n];return r[n]={configurable:!0,enumerable:!0,get:function(){return i},set:function(e){var r=i;e!==r&&(i=e,t.element_.replaceChild(e.element,r.element))}},r},{}))},e}();r.TypedHTMLElement=i},{}],4:[function(e,t,r){"use strict";function n(e,t){return Object.keys(e).forEach(function(r){return void t.setAttribute(r,e[r]||"")}),t}Object.defineProperty(r,"__esModule",{value:!0});var i=e("./builder");r.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","meter","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,r,o){return e&&r&&"function"!=typeof r?new i.TypedHTMLElement(n(e,(o||function(){return document.createElement(t)})()),r):new i.TypedHTMLElement((r||function(){return document.createElement(t)})(),e)},e},{})},{"./builder":3}],5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./dom/html");r.default=n.TypedHTML,r.TypedHTML=n.TypedHTML,function(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}(e("./util/dom"))},{"./dom/html":4,"./util/dom":6}],6:[function(e,t,r){"use strict";function n(e,t,r,n){function i(e){"object"==typeof n&&n.passive&&(e.preventDefault=s.noop),r(e)}void 0===n&&(n=!1),e.addEventListener(t,i,c(n));var o=function(){return o=s.noop,void e.removeEventListener(t,i,c(n))};return function(){return void o()}}function i(e,t,r,i){void 0===i&&(i=!1);var o=n(e,t,function(e){o(),r(e)},i);return function(){return void o()}}function o(e,t,r,o,c){return void 0===c&&(c={}),n(e,r,function(n){var u=n.target.closest(t);u&&Array.from(e.querySelectorAll(t)).filter(function(e){return e===u}).forEach(function(e){return void i(e,r,function(e){o(e)},c)})},u({},c,{capture:!0}))}function c(e){return d?e:"boolean"==typeof e?e:e.capture}var u=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e};Object.defineProperty(r,"__esModule",{value:!0});var s=e("./noop");r.bind=n,r.once=i,r.delegate=o;var d=!1;try{document.createElement("div").addEventListener("test",function(){},{get capture(){return d=!0}})}catch(e){}},{"./noop":7}],7:[function(e,t,r){"use strict";function n(){}Object.defineProperty(r,"__esModule",{value:!0}),r.noop=n},{}],"typed-dom":[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}(e("./src/export"));var n=e("./src/export");r.default=n.default},{"./src/export":5}]},{},[1,2,"typed-dom"]); |
@@ -53,11 +53,6 @@ const gulp = require('gulp'); | ||
let done = true; | ||
return browserify({ | ||
basedir: '.', | ||
debug: false, | ||
entries: Object.values(paths).map(p => glob.sync(p)), | ||
return browserify(Object.values(paths).map(p => glob.sync(p)), { | ||
bundleExternal: false, | ||
cache: {}, | ||
packageCache: {} | ||
}) | ||
.require(`./${pkg.name}.ts`, { expose: pkg.name }) | ||
.require(`./index.ts`, { expose: pkg.name }) | ||
.plugin(tsify, require('./tsconfig.json').compilerOptions) | ||
@@ -64,0 +59,0 @@ .bundle() |
187
index.d.ts
@@ -1,2 +0,185 @@ | ||
import './typed-dom.d'; | ||
export * from 'typed-dom'; | ||
/** | ||
* | ||
* typed-dom.d.ts | ||
* | ||
* @author falsandtru https://github.com/falsandtru/typed-dom | ||
*/ | ||
export default TypedHTML; | ||
export interface TypedHTMLElement< | ||
T extends string, | ||
E extends HTMLElement, | ||
C extends TypedHTMLElementChildren | ||
> | ||
extends AbstractTypedHTMLElement<T> { | ||
readonly element: E; | ||
children: C; | ||
} | ||
type TypedHTMLElementChildren | ||
= TypedHTMLElementChildren.Text | ||
| TypedHTMLElementChildren.Collection | ||
| TypedHTMLElementChildren.Struct; | ||
declare namespace TypedHTMLElementChildren { | ||
export type Text = string; | ||
export type Collection = TypedHTMLElement<string, HTMLElement, any>[]; | ||
export type Struct = { [name: string]: TypedHTMLElement<string, HTMLElement, any>; }; | ||
} | ||
declare abstract class AbstractTypedHTMLElement<T extends string> { | ||
private identifier: T; | ||
} | ||
interface TypedHTMLElementBuilder<E extends HTMLElement, T extends string> { | ||
(): TypedHTMLElement<T, E, never>; | ||
<C extends string> | ||
(children: C): TypedHTMLElement<T, E, C>; | ||
<C extends string> | ||
(children: C, factory?: () => E): never; | ||
<C extends TypedHTMLElementChildren> | ||
(children: C, factory?: () => E): TypedHTMLElement<T, E, C>; | ||
<C extends string> | ||
(attrs: { [name: string]: string; }, children: C, factory?: () => E): never; | ||
<C extends TypedHTMLElementChildren> | ||
(attrs: { [name: string]: string; }, children: C, factory?: () => E): TypedHTMLElement<T, E, C>; | ||
} | ||
export const TypedHTML: { | ||
// lib.dom.d.ts | ||
//[K in keyof HTMLElementTagNameMap]: TypedHTMLBuilder<HTMLElementTagNameMap[K], K>; | ||
a: TypedHTMLElementBuilder<HTMLAnchorElement, 'a'>; | ||
abbr: TypedHTMLElementBuilder<HTMLElement, 'abbr'>; | ||
acronym: TypedHTMLElementBuilder<HTMLElement, 'acronym'>; | ||
address: TypedHTMLElementBuilder<HTMLElement, 'address'>; | ||
applet: TypedHTMLElementBuilder<HTMLAppletElement, 'applet'>; | ||
area: TypedHTMLElementBuilder<HTMLAreaElement, 'area'>; | ||
article: TypedHTMLElementBuilder<HTMLElement, 'article'>; | ||
aside: TypedHTMLElementBuilder<HTMLElement, 'aside'>; | ||
audio: TypedHTMLElementBuilder<HTMLAudioElement, 'audio'>; | ||
b: TypedHTMLElementBuilder<HTMLElement, 'b'>; | ||
base: TypedHTMLElementBuilder<HTMLBaseElement, 'base'>; | ||
basefont: TypedHTMLElementBuilder<HTMLBaseFontElement, 'basefont'>; | ||
bdo: TypedHTMLElementBuilder<HTMLElement, 'bdo'>; | ||
big: TypedHTMLElementBuilder<HTMLElement, 'big'>; | ||
blockquote: TypedHTMLElementBuilder<HTMLQuoteElement, 'blockquote'>; | ||
body: TypedHTMLElementBuilder<HTMLBodyElement, 'body'>; | ||
br: TypedHTMLElementBuilder<HTMLBRElement, 'br'>; | ||
button: TypedHTMLElementBuilder<HTMLButtonElement, 'button'>; | ||
canvas: TypedHTMLElementBuilder<HTMLCanvasElement, 'canvas'>; | ||
caption: TypedHTMLElementBuilder<HTMLTableCaptionElement, 'caption'>; | ||
center: TypedHTMLElementBuilder<HTMLElement, 'center'>; | ||
cite: TypedHTMLElementBuilder<HTMLElement, 'cite'>; | ||
code: TypedHTMLElementBuilder<HTMLElement, 'code'>; | ||
col: TypedHTMLElementBuilder<HTMLTableColElement, 'col'>; | ||
colgroup: TypedHTMLElementBuilder<HTMLTableColElement, 'colgroup'>; | ||
datalist: TypedHTMLElementBuilder<HTMLDataListElement, 'datalist'>; | ||
dd: TypedHTMLElementBuilder<HTMLElement, 'dd'>; | ||
del: TypedHTMLElementBuilder<HTMLModElement, 'del'>; | ||
dfn: TypedHTMLElementBuilder<HTMLElement, 'dfn'>; | ||
dir: TypedHTMLElementBuilder<HTMLDirectoryElement, 'dir'>; | ||
div: TypedHTMLElementBuilder<HTMLDivElement, 'div'>; | ||
dl: TypedHTMLElementBuilder<HTMLDListElement, 'dl'>; | ||
dt: TypedHTMLElementBuilder<HTMLElement, 'dt'>; | ||
em: TypedHTMLElementBuilder<HTMLElement, 'em'>; | ||
embed: TypedHTMLElementBuilder<HTMLEmbedElement, 'embed'>; | ||
fieldset: TypedHTMLElementBuilder<HTMLFieldSetElement, 'fieldset'>; | ||
figcaption: TypedHTMLElementBuilder<HTMLElement, 'figcaption'>; | ||
figure: TypedHTMLElementBuilder<HTMLElement, 'figure'>; | ||
font: TypedHTMLElementBuilder<HTMLFontElement, 'font'>; | ||
footer: TypedHTMLElementBuilder<HTMLElement, 'footer'>; | ||
form: TypedHTMLElementBuilder<HTMLFormElement, 'form'>; | ||
frame: TypedHTMLElementBuilder<HTMLFrameElement, 'frame'>; | ||
frameset: TypedHTMLElementBuilder<HTMLFrameSetElement, 'frameset'>; | ||
h1: TypedHTMLElementBuilder<HTMLHeadingElement, 'h1'>; | ||
h2: TypedHTMLElementBuilder<HTMLHeadingElement, 'h2'>; | ||
h3: TypedHTMLElementBuilder<HTMLHeadingElement, 'h3'>; | ||
h4: TypedHTMLElementBuilder<HTMLHeadingElement, 'h4'>; | ||
h5: TypedHTMLElementBuilder<HTMLHeadingElement, 'h5'>; | ||
h6: TypedHTMLElementBuilder<HTMLHeadingElement, 'h6'>; | ||
head: TypedHTMLElementBuilder<HTMLHeadElement, 'head'>; | ||
header: TypedHTMLElementBuilder<HTMLElement, 'header'>; | ||
hgroup: TypedHTMLElementBuilder<HTMLElement, 'hgroup'>; | ||
hr: TypedHTMLElementBuilder<HTMLHRElement, 'hr'>; | ||
html: TypedHTMLElementBuilder<HTMLHtmlElement, 'html'>; | ||
i: TypedHTMLElementBuilder<HTMLElement, 'i'>; | ||
iframe: TypedHTMLElementBuilder<HTMLIFrameElement, 'iframe'>; | ||
img: TypedHTMLElementBuilder<HTMLImageElement, 'img'>; | ||
input: TypedHTMLElementBuilder<HTMLInputElement, 'input'>; | ||
ins: TypedHTMLElementBuilder<HTMLModElement, 'ins'>; | ||
isindex: TypedHTMLElementBuilder<HTMLUnknownElement, 'isindex'>; | ||
kbd: TypedHTMLElementBuilder<HTMLElement, 'kbd'>; | ||
keygen: TypedHTMLElementBuilder<HTMLElement, 'keygen'>; | ||
label: TypedHTMLElementBuilder<HTMLLabelElement, 'label'>; | ||
legend: TypedHTMLElementBuilder<HTMLLegendElement, 'legend'>; | ||
li: TypedHTMLElementBuilder<HTMLLIElement, 'li'>; | ||
link: TypedHTMLElementBuilder<HTMLLinkElement, 'link'>; | ||
listing: TypedHTMLElementBuilder<HTMLPreElement, 'listing'>; | ||
map: TypedHTMLElementBuilder<HTMLMapElement, 'map'>; | ||
mark: TypedHTMLElementBuilder<HTMLElement, 'mark'>; | ||
marquee: TypedHTMLElementBuilder<HTMLMarqueeElement, 'marquee'>; | ||
menu: TypedHTMLElementBuilder<HTMLMenuElement, 'menu'>; | ||
meta: TypedHTMLElementBuilder<HTMLMetaElement, 'meta'>; | ||
meter: TypedHTMLElementBuilder<HTMLMeterElement, 'meter'>; | ||
nav: TypedHTMLElementBuilder<HTMLElement, 'nav'>; | ||
nextid: TypedHTMLElementBuilder<HTMLUnknownElement, 'nextid'>; | ||
nobr: TypedHTMLElementBuilder<HTMLElement, 'nobr'>; | ||
noframes: TypedHTMLElementBuilder<HTMLElement, 'noframes'>; | ||
noscript: TypedHTMLElementBuilder<HTMLElement, 'noscript'>; | ||
object: TypedHTMLElementBuilder<HTMLObjectElement, 'object'>; | ||
ol: TypedHTMLElementBuilder<HTMLOListElement, 'ol'>; | ||
optgroup: TypedHTMLElementBuilder<HTMLOptGroupElement, 'optgroup'>; | ||
option: TypedHTMLElementBuilder<HTMLOptionElement, 'option'>; | ||
p: TypedHTMLElementBuilder<HTMLParagraphElement, 'p'>; | ||
param: TypedHTMLElementBuilder<HTMLParamElement, 'param'>; | ||
picture: TypedHTMLElementBuilder<HTMLPictureElement, 'picture'>; | ||
plaintext: TypedHTMLElementBuilder<HTMLElement, 'plaintext'>; | ||
pre: TypedHTMLElementBuilder<HTMLPreElement, 'pre'>; | ||
progress: TypedHTMLElementBuilder<HTMLProgressElement, 'progress'>; | ||
q: TypedHTMLElementBuilder<HTMLQuoteElement, 'q'>; | ||
rt: TypedHTMLElementBuilder<HTMLElement, 'rt'>; | ||
ruby: TypedHTMLElementBuilder<HTMLElement, 'ruby'>; | ||
s: TypedHTMLElementBuilder<HTMLElement, 's'>; | ||
samp: TypedHTMLElementBuilder<HTMLElement, 'samp'>; | ||
script: TypedHTMLElementBuilder<HTMLScriptElement, 'script'>; | ||
section: TypedHTMLElementBuilder<HTMLElement, 'section'>; | ||
select: TypedHTMLElementBuilder<HTMLSelectElement, 'select'>; | ||
small: TypedHTMLElementBuilder<HTMLElement, 'small'>; | ||
source: TypedHTMLElementBuilder<HTMLSourceElement, 'source'>; | ||
span: TypedHTMLElementBuilder<HTMLSpanElement, 'span'>; | ||
strike: TypedHTMLElementBuilder<HTMLElement, 'strike'>; | ||
strong: TypedHTMLElementBuilder<HTMLElement, 'strong'>; | ||
style: TypedHTMLElementBuilder<HTMLStyleElement, 'style'>; | ||
sub: TypedHTMLElementBuilder<HTMLElement, 'sub'>; | ||
sup: TypedHTMLElementBuilder<HTMLElement, 'sup'>; | ||
table: TypedHTMLElementBuilder<HTMLTableElement, 'table'>; | ||
tbody: TypedHTMLElementBuilder<HTMLTableSectionElement, 'tbody'>; | ||
td: TypedHTMLElementBuilder<HTMLTableDataCellElement, 'td'>; | ||
template: TypedHTMLElementBuilder<HTMLTemplateElement, 'template'>; | ||
textarea: TypedHTMLElementBuilder<HTMLTextAreaElement, 'textarea'>; | ||
tfoot: TypedHTMLElementBuilder<HTMLTableSectionElement, 'tfoot'>; | ||
th: TypedHTMLElementBuilder<HTMLTableHeaderCellElement, 'th'>; | ||
thead: TypedHTMLElementBuilder<HTMLTableSectionElement, 'thead'>; | ||
title: TypedHTMLElementBuilder<HTMLTitleElement, 'title'>; | ||
tr: TypedHTMLElementBuilder<HTMLTableRowElement, 'tr'>; | ||
track: TypedHTMLElementBuilder<HTMLTrackElement, 'track'>; | ||
tt: TypedHTMLElementBuilder<HTMLElement, 'tt'>; | ||
u: TypedHTMLElementBuilder<HTMLElement, 'u'>; | ||
ul: TypedHTMLElementBuilder<HTMLUListElement, 'ul'>; | ||
var: TypedHTMLElementBuilder<HTMLElement, 'var'>; | ||
video: TypedHTMLElementBuilder<HTMLVideoElement, 'video'>; | ||
wbr: TypedHTMLElementBuilder<HTMLElement, 'wbr'>; | ||
xmp: TypedHTMLElementBuilder<HTMLPreElement, 'xmp'>; | ||
// custom | ||
custom<E extends HTMLElement, T extends string, C extends TypedHTMLElementChildren>(children: C, factory: () => E, tag: T): TypedHTMLElement<T, E, C>; | ||
}; | ||
export function bind<T extends keyof WindowEventMap>(target: Window, type: T, listener: (ev: WindowEventMap[T]) => any, option?: boolean | EventListenerOption): () => undefined; | ||
export function bind<T extends keyof DocumentEventMap>(target: Document, type: T, listener: (ev: DocumentEventMap[T]) => any, option?: boolean | EventListenerOption): () => undefined; | ||
export function bind<T extends keyof HTMLElementEventMap>(target: HTMLElement, type: T, listener: (ev: HTMLElementEventMap[T]) => any, option?: boolean | EventListenerOption): () => undefined; | ||
export function once<T extends keyof WindowEventMap>(target: Window, type: T, listener: (ev: WindowEventMap[T]) => any, option?: boolean | EventListenerOption): () => undefined; | ||
export function once<T extends keyof DocumentEventMap>(target: Document, type: T, listener: (ev: DocumentEventMap[T]) => any, option?: boolean | EventListenerOption): () => undefined; | ||
export function once<T extends keyof HTMLElementEventMap>(target: HTMLElement, type: T, listener: (ev: HTMLElementEventMap[T]) => any, option?: boolean | EventListenerOption): () => undefined; | ||
export function delegate<T extends keyof HTMLElementEventMap>(target: HTMLElement, selector: string, type: T, listener: (ev: HTMLElementEventMap[T]) => any, option?: EventListenerOption): () => undefined; | ||
interface EventListenerOption { | ||
capture?: boolean; | ||
passive?: boolean; | ||
} |
{ | ||
"name": "typed-dom", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"description": "Static typed dom component builder.", | ||
@@ -18,2 +18,3 @@ "private": false, | ||
], | ||
"types": "./index.d.ts", | ||
"main": "./dist/typed-dom.js", | ||
@@ -23,3 +24,2 @@ "files": [ | ||
"index.*", | ||
"typings", | ||
"src", | ||
@@ -35,30 +35,30 @@ "test", | ||
"devDependencies": { | ||
"@types/mocha": "^2.2.38", | ||
"@types/mocha": "^2.2.41", | ||
"@types/power-assert": "1.4.29", | ||
"browserify": "^14.0.0", | ||
"browserify": "^14.3.0", | ||
"del": "^2.2.2", | ||
"extend": "^3.0.0", | ||
"extend": "^3.0.1", | ||
"gulp": "^3.9.1", | ||
"gulp-header": "^1.8.8", | ||
"gulp-load-plugins": "^1.4.0", | ||
"gulp-mocha": "^3.0.1", | ||
"gulp-load-plugins": "^1.5.0", | ||
"gulp-mocha": "^4.3.1", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-uglify": "^2.0.1", | ||
"gulp-uglify": "^2.1.2", | ||
"gulp-unassert": "^1.0.1", | ||
"karma": "1.4.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma": "1.6.0", | ||
"karma-chrome-launcher": "^2.1.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-coveralls": "^1.1.2", | ||
"karma-edge-launcher": "^0.2.0", | ||
"karma-edge-launcher": "^0.4.1", | ||
"karma-espower-preprocessor": "1.1.0", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-firefox-launcher": "^1.0.1", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-mocha": "^1.3.0", | ||
"mocha": "^3.2.0", | ||
"npm-check-updates": "^2.8.9", | ||
"mocha": "^3.3.0", | ||
"npm-check-updates": "^2.11.0", | ||
"power-assert": "^1.4.2", | ||
"run-sequence": "^1.2.2", | ||
"spica": "0.0.47", | ||
"spica": "0.0.66", | ||
"tsify": "^3.0.1", | ||
"typescript": "2.2.0-dev.20170128", | ||
"typescript": "2.4.0-dev.20170504", | ||
"vinyl-buffer": "^1.0.0", | ||
@@ -65,0 +65,0 @@ "vinyl-source-stream": "^1.1.0" |
@@ -1,2 +0,2 @@ | ||
import { TypedHTMLElement as ITypedHTMLElement } from 'typed-dom'; | ||
import { TypedHTMLElement as ITypedHTMLElement } from '../../'; | ||
@@ -3,0 +3,0 @@ export type TypedHTMLElementChildren |
@@ -0,4 +1,5 @@ | ||
import { TypedHTML as ITypedHTML } from '../../'; | ||
import { TypedHTMLElement, TypedHTMLElementChildren } from './builder'; | ||
export const TypedHTML: TypedHTMLElement<string, HTMLElement, TypedHTMLElementChildren> = [ | ||
export const TypedHTML: typeof ITypedHTML = [ | ||
// lib.dom.d.ts | ||
@@ -139,3 +140,3 @@ 'a', | ||
obj | ||
), <TypedHTMLElement<string, HTMLElement, TypedHTMLElementChildren>>{}); | ||
), <typeof ITypedHTML>{}); | ||
@@ -142,0 +143,0 @@ function attribute<E extends HTMLElement>(attrs: { [name: string]: string }, element: E): E { |
@@ -1,1 +0,2 @@ | ||
export { TypedHTML as default } from './dom/html'; | ||
export { TypedHTML as default, TypedHTML } from './dom/html'; | ||
export * from './util/dom'; |
import { Sequence } from 'spica'; | ||
import TypedHTML from 'typed-dom'; | ||
import TypedHTML from '../../index'; | ||
@@ -4,0 +4,0 @@ declare const _: { |
@@ -1,11 +0,7 @@ | ||
import TypedHTML, { __esModule } from 'typed-dom'; | ||
import def, { TypedHTML, bind, once, delegate } from '../../index'; | ||
declare module 'typed-dom' { | ||
export const __esModule: boolean | undefined; | ||
} | ||
describe('Interface: Package', function () { | ||
describe('module', function () { | ||
it('module', function () { | ||
assert(__esModule === true); | ||
describe('default', function () { | ||
it('default', function () { | ||
assert(def === TypedHTML); | ||
}); | ||
@@ -22,2 +18,23 @@ | ||
describe('bind', function () { | ||
it('bind', function () { | ||
assert(typeof bind === 'function'); | ||
}); | ||
}); | ||
describe('once', function () { | ||
it('once', function () { | ||
assert(typeof once === 'function'); | ||
}); | ||
}); | ||
describe('delegate', function () { | ||
it('delegate', function () { | ||
assert(typeof delegate === 'function'); | ||
}); | ||
}); | ||
}); |
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
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
63624
21
1425