Comparing version 6.3.1 to 6.4.0
@@ -0,1 +1,4 @@ | ||
# 6.4.0 | ||
- **Now requires `Object.assign` polyfill for old browsers.** | ||
# 6.3.0 | ||
@@ -2,0 +5,0 @@ - Adds `defaultProps` support to functional componants. |
@@ -1,33 +0,33 @@ | ||
"use strict"; | ||
"use strict" | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
value: true, | ||
}) | ||
var tslib_1 = require("tslib"); | ||
var tslib = require("tslib") | ||
var keys = Object.keys; | ||
var keys = Object.keys | ||
function isBoolean(val) { | ||
return typeof val === "boolean"; | ||
return typeof val === "boolean" | ||
} | ||
function isElement(val) { | ||
return val && typeof val.nodeType === "number"; | ||
return val && typeof val.nodeType === "number" | ||
} | ||
function isString(val) { | ||
return typeof val === "string"; | ||
return typeof val === "string" | ||
} | ||
function isNumber(val) { | ||
return typeof val === "number"; | ||
return typeof val === "number" | ||
} | ||
function isObject(val) { | ||
return typeof val === "object" ? val !== null : isFunction(val); | ||
return typeof val === "object" ? val !== null : isFunction(val) | ||
} // tslint:disable-next-line:ban-types | ||
function isFunction(val) { | ||
return typeof val === "function"; | ||
return typeof val === "function" | ||
} | ||
@@ -40,3 +40,3 @@ | ||
typeof obj.nodeType !== "number" | ||
); | ||
) | ||
} | ||
@@ -46,20 +46,20 @@ | ||
return Object.seal({ | ||
current: null | ||
}); | ||
current: null, | ||
}) | ||
} | ||
function isRef(maybeRef) { | ||
return isObject(maybeRef) && "current" in maybeRef; | ||
return isObject(maybeRef) && "current" in maybeRef | ||
} | ||
var SVGNamespace = "http://www.w3.org/2000/svg"; | ||
var SVGNamespace = "http://www.w3.org/2000/svg" | ||
function preventDefault(event) { | ||
event.preventDefault(); | ||
return event; | ||
event.preventDefault() | ||
return event | ||
} | ||
function stopPropagation(event) { | ||
event.stopPropagation(); | ||
return event; | ||
event.stopPropagation() | ||
return event | ||
} // https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | ||
@@ -69,3 +69,3 @@ // Emulate JSX Expression logic to ignore certain type of children or className. | ||
function isVisibleChild(value) { | ||
return !isBoolean(value) && value != null; | ||
return !isBoolean(value) && value != null | ||
} | ||
@@ -82,13 +82,13 @@ /** | ||
.filter(Boolean) | ||
.join(" "); | ||
.join(" ") | ||
} else if (isObject(value)) { | ||
return keys(value) | ||
.filter(function(k) { | ||
return value[k]; | ||
return value[k] | ||
}) | ||
.join(" "); | ||
.join(" ") | ||
} else if (isVisibleChild(value)) { | ||
return "" + value; | ||
return "" + value | ||
} else { | ||
return ""; | ||
return "" | ||
} | ||
@@ -98,16 +98,16 @@ } | ||
function Fragment(attr) { | ||
var fragment = document.createDocumentFragment(); | ||
appendChildren(attr.children, fragment); | ||
return fragment; | ||
var fragment = document.createDocumentFragment() | ||
appendChildren(attr.children, fragment) | ||
return fragment | ||
} | ||
function createElement(tag, attr) { | ||
var children = []; | ||
var children = [] | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
children[_i - 2] = arguments[_i]; | ||
children[_i - 2] = arguments[_i] | ||
} | ||
attr = attr || {}; | ||
var node; | ||
attr = attr || {} | ||
var node | ||
@@ -117,25 +117,25 @@ if (isString(tag)) { | ||
? document.createElementNS(attr.namespaceURI, tag) | ||
: document.createElement(tag); | ||
attributes(attr, node); | ||
appendChildren(children, node); | ||
: document.createElement(tag) | ||
attributes(attr, node) | ||
appendChildren(children, node) | ||
} else if (isFunction(tag)) { | ||
// Custom elements. | ||
if (isObject(tag.defaultProps)) { | ||
attr = tslib_1.__assign({}, tag.defaultProps, attr); | ||
attr = tslib.__assign(tslib.__assign({}, tag.defaultProps), attr) | ||
} | ||
node = tag( | ||
tslib_1.__assign({}, attr, { | ||
children: children | ||
tslib.__assign(tslib.__assign({}, attr), { | ||
children: children, | ||
}) | ||
); | ||
) | ||
} | ||
if (isRef(attr.ref)) { | ||
attr.ref.current = node; | ||
attr.ref.current = node | ||
} else if (isFunction(attr.ref)) { | ||
attr.ref(node); | ||
attr.ref(node) | ||
} | ||
return node; | ||
return node | ||
} | ||
@@ -145,9 +145,9 @@ | ||
if (isArrayLike(child)) { | ||
appendChildren(child, node); | ||
appendChildren(child, node) | ||
} else if (isString(child) || isNumber(child)) { | ||
node.appendChild(document.createTextNode(child)); | ||
node.appendChild(document.createTextNode(child)) | ||
} else if (child === null) { | ||
node.appendChild(document.createComment("")); | ||
node.appendChild(document.createComment("")) | ||
} else if (isElement(child)) { | ||
node.appendChild(child); | ||
node.appendChild(child) | ||
} | ||
@@ -158,7 +158,7 @@ } | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
var child = children_1[_i] | ||
appendChild(child, node) | ||
} | ||
return node; | ||
return node | ||
} | ||
@@ -169,16 +169,16 @@ | ||
case "htmlFor": | ||
node.setAttribute("for", value); | ||
return; | ||
node.setAttribute("for", value) | ||
return | ||
case "dataset": | ||
for (var _i = 0, _a = keys(value || {}); _i < _a.length; _i++) { | ||
var dataKey = _a[_i]; | ||
var dataValue = value[dataKey]; | ||
var dataKey = _a[_i] | ||
var dataValue = value[dataKey] | ||
if (dataValue != null) { | ||
node.dataset[dataKey] = dataValue; | ||
node.dataset[dataKey] = dataValue | ||
} | ||
} | ||
return; | ||
return | ||
@@ -188,23 +188,22 @@ case "innerHTML": | ||
case "textContent": | ||
node[key] = value; | ||
return; | ||
node[key] = value | ||
return | ||
case "spellCheck": | ||
node.spellcheck = value; | ||
return; | ||
node.spellcheck = value | ||
return | ||
case "class": | ||
case "className": | ||
node.setAttribute("class", className(value)); | ||
return; | ||
node.setAttribute("class", className(value)) | ||
return | ||
case "ref": | ||
case "namespaceURI": | ||
return; | ||
return | ||
case "style": | ||
if (isObject(value)) { | ||
tslib_1.__assign(node.style, value); | ||
return; | ||
Object.assign(node.style, value) | ||
return | ||
} | ||
@@ -217,9 +216,9 @@ | ||
if (key[0] === "o" && key[1] === "n") { | ||
var name = key.slice(2).toLowerCase(); | ||
listen(node, name, value); | ||
var name = key.slice(2).toLowerCase() | ||
listen(node, name, value) | ||
} | ||
} else if (value === true) { | ||
node.setAttribute(key, ""); | ||
node.setAttribute(key, "") | ||
} else if (value !== false && value != null) { | ||
node.setAttribute(key, value); | ||
node.setAttribute(key, value) | ||
} | ||
@@ -230,20 +229,20 @@ } | ||
for (var _i = 0, _a = keys(attr); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
attribute(key, attr[key], node); | ||
var key = _a[_i] | ||
attribute(key, attr[key], node) | ||
} | ||
return node; | ||
return node | ||
} | ||
function listen(node, eventName, callback) { | ||
node.addEventListener(eventName, callback); | ||
return node; | ||
node.addEventListener(eventName, callback) | ||
return node | ||
} | ||
exports.SVGNamespace = "http://www.w3.org/2000/svg"; | ||
exports.preventDefault = preventDefault; | ||
exports.stopPropagation = stopPropagation; | ||
exports.Fragment = Fragment; | ||
exports.h = createElement; | ||
exports.createElement = createElement; | ||
exports.createRef = createRef; | ||
exports.Fragment = Fragment | ||
exports.SVGNamespace = "http://www.w3.org/2000/svg" | ||
exports.createElement = createElement | ||
exports.createRef = createRef | ||
exports.h = createElement | ||
exports.preventDefault = preventDefault | ||
exports.stopPropagation = stopPropagation |
153
lib/index.js
@@ -1,26 +0,26 @@ | ||
import { __assign } from "tslib"; | ||
var keys = Object.keys; | ||
import { __assign } from "tslib" | ||
var keys = Object.keys | ||
function isBoolean(val) { | ||
return typeof val === "boolean"; | ||
return typeof val === "boolean" | ||
} | ||
function isElement(val) { | ||
return val && typeof val.nodeType === "number"; | ||
return val && typeof val.nodeType === "number" | ||
} | ||
function isString(val) { | ||
return typeof val === "string"; | ||
return typeof val === "string" | ||
} | ||
function isNumber(val) { | ||
return typeof val === "number"; | ||
return typeof val === "number" | ||
} | ||
function isObject(val) { | ||
return typeof val === "object" ? val !== null : isFunction(val); | ||
return typeof val === "object" ? val !== null : isFunction(val) | ||
} // tslint:disable-next-line:ban-types | ||
function isFunction(val) { | ||
return typeof val === "function"; | ||
return typeof val === "function" | ||
} | ||
@@ -33,3 +33,3 @@ | ||
typeof obj.nodeType !== "number" | ||
); | ||
) | ||
} | ||
@@ -39,20 +39,20 @@ | ||
return Object.seal({ | ||
current: null | ||
}); | ||
current: null, | ||
}) | ||
} | ||
function isRef(maybeRef) { | ||
return isObject(maybeRef) && "current" in maybeRef; | ||
return isObject(maybeRef) && "current" in maybeRef | ||
} | ||
var SVGNamespace = "http://www.w3.org/2000/svg"; | ||
var SVGNamespace = "http://www.w3.org/2000/svg" | ||
function preventDefault(event) { | ||
event.preventDefault(); | ||
return event; | ||
event.preventDefault() | ||
return event | ||
} | ||
function stopPropagation(event) { | ||
event.stopPropagation(); | ||
return event; | ||
event.stopPropagation() | ||
return event | ||
} // https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | ||
@@ -62,3 +62,3 @@ // Emulate JSX Expression logic to ignore certain type of children or className. | ||
function isVisibleChild(value) { | ||
return !isBoolean(value) && value != null; | ||
return !isBoolean(value) && value != null | ||
} | ||
@@ -75,13 +75,13 @@ /** | ||
.filter(Boolean) | ||
.join(" "); | ||
.join(" ") | ||
} else if (isObject(value)) { | ||
return keys(value) | ||
.filter(function(k) { | ||
return value[k]; | ||
return value[k] | ||
}) | ||
.join(" "); | ||
.join(" ") | ||
} else if (isVisibleChild(value)) { | ||
return "" + value; | ||
return "" + value | ||
} else { | ||
return ""; | ||
return "" | ||
} | ||
@@ -91,16 +91,16 @@ } | ||
function Fragment(attr) { | ||
var fragment = document.createDocumentFragment(); | ||
appendChildren(attr.children, fragment); | ||
return fragment; | ||
var fragment = document.createDocumentFragment() | ||
appendChildren(attr.children, fragment) | ||
return fragment | ||
} | ||
function createElement(tag, attr) { | ||
var children = []; | ||
var children = [] | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
children[_i - 2] = arguments[_i]; | ||
children[_i - 2] = arguments[_i] | ||
} | ||
attr = attr || {}; | ||
var node; | ||
attr = attr || {} | ||
var node | ||
@@ -110,25 +110,25 @@ if (isString(tag)) { | ||
? document.createElementNS(attr.namespaceURI, tag) | ||
: document.createElement(tag); | ||
attributes(attr, node); | ||
appendChildren(children, node); | ||
: document.createElement(tag) | ||
attributes(attr, node) | ||
appendChildren(children, node) | ||
} else if (isFunction(tag)) { | ||
// Custom elements. | ||
if (isObject(tag.defaultProps)) { | ||
attr = __assign({}, tag.defaultProps, attr); | ||
attr = __assign(__assign({}, tag.defaultProps), attr) | ||
} | ||
node = tag( | ||
__assign({}, attr, { | ||
children: children | ||
__assign(__assign({}, attr), { | ||
children: children, | ||
}) | ||
); | ||
) | ||
} | ||
if (isRef(attr.ref)) { | ||
attr.ref.current = node; | ||
attr.ref.current = node | ||
} else if (isFunction(attr.ref)) { | ||
attr.ref(node); | ||
attr.ref(node) | ||
} | ||
return node; | ||
return node | ||
} | ||
@@ -138,9 +138,9 @@ | ||
if (isArrayLike(child)) { | ||
appendChildren(child, node); | ||
appendChildren(child, node) | ||
} else if (isString(child) || isNumber(child)) { | ||
node.appendChild(document.createTextNode(child)); | ||
node.appendChild(document.createTextNode(child)) | ||
} else if (child === null) { | ||
node.appendChild(document.createComment("")); | ||
node.appendChild(document.createComment("")) | ||
} else if (isElement(child)) { | ||
node.appendChild(child); | ||
node.appendChild(child) | ||
} | ||
@@ -151,7 +151,7 @@ } | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
var child = children_1[_i] | ||
appendChild(child, node) | ||
} | ||
return node; | ||
return node | ||
} | ||
@@ -162,16 +162,16 @@ | ||
case "htmlFor": | ||
node.setAttribute("for", value); | ||
return; | ||
node.setAttribute("for", value) | ||
return | ||
case "dataset": | ||
for (var _i = 0, _a = keys(value || {}); _i < _a.length; _i++) { | ||
var dataKey = _a[_i]; | ||
var dataValue = value[dataKey]; | ||
var dataKey = _a[_i] | ||
var dataValue = value[dataKey] | ||
if (dataValue != null) { | ||
node.dataset[dataKey] = dataValue; | ||
node.dataset[dataKey] = dataValue | ||
} | ||
} | ||
return; | ||
return | ||
@@ -181,23 +181,22 @@ case "innerHTML": | ||
case "textContent": | ||
node[key] = value; | ||
return; | ||
node[key] = value | ||
return | ||
case "spellCheck": | ||
node.spellcheck = value; | ||
return; | ||
node.spellcheck = value | ||
return | ||
case "class": | ||
case "className": | ||
node.setAttribute("class", className(value)); | ||
return; | ||
node.setAttribute("class", className(value)) | ||
return | ||
case "ref": | ||
case "namespaceURI": | ||
return; | ||
return | ||
case "style": | ||
if (isObject(value)) { | ||
__assign(node.style, value); | ||
return; | ||
Object.assign(node.style, value) | ||
return | ||
} | ||
@@ -210,9 +209,9 @@ | ||
if (key[0] === "o" && key[1] === "n") { | ||
var name = key.slice(2).toLowerCase(); | ||
listen(node, name, value); | ||
var name = key.slice(2).toLowerCase() | ||
listen(node, name, value) | ||
} | ||
} else if (value === true) { | ||
node.setAttribute(key, ""); | ||
node.setAttribute(key, "") | ||
} else if (value !== false && value != null) { | ||
node.setAttribute(key, value); | ||
node.setAttribute(key, value) | ||
} | ||
@@ -223,22 +222,22 @@ } | ||
for (var _i = 0, _a = keys(attr); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
attribute(key, attr[key], node); | ||
var key = _a[_i] | ||
attribute(key, attr[key], node) | ||
} | ||
return node; | ||
return node | ||
} | ||
function listen(node, eventName, callback) { | ||
node.addEventListener(eventName, callback); | ||
return node; | ||
node.addEventListener(eventName, callback) | ||
return node | ||
} | ||
export { | ||
Fragment, | ||
SVGNamespace, | ||
createElement, | ||
createRef, | ||
createElement as h, | ||
preventDefault, | ||
stopPropagation, | ||
Fragment, | ||
createElement as h, | ||
createElement, | ||
createRef | ||
}; | ||
} |
@@ -1,33 +0,33 @@ | ||
"use strict"; | ||
"use strict" | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
value: true, | ||
}) | ||
var tslib_1 = require("tslib"); | ||
var tslib = require("tslib") | ||
var keys = Object.keys; | ||
var keys = Object.keys | ||
function isBoolean(val) { | ||
return typeof val === "boolean"; | ||
return typeof val === "boolean" | ||
} | ||
function isElement(val) { | ||
return val && typeof val.nodeType === "number"; | ||
return val && typeof val.nodeType === "number" | ||
} | ||
function isString(val) { | ||
return typeof val === "string"; | ||
return typeof val === "string" | ||
} | ||
function isNumber(val) { | ||
return typeof val === "number"; | ||
return typeof val === "number" | ||
} | ||
function isObject(val) { | ||
return typeof val === "object" ? val !== null : isFunction(val); | ||
return typeof val === "object" ? val !== null : isFunction(val) | ||
} // tslint:disable-next-line:ban-types | ||
function isFunction(val) { | ||
return typeof val === "function"; | ||
return typeof val === "function" | ||
} | ||
@@ -40,3 +40,3 @@ | ||
typeof obj.nodeType !== "number" | ||
); | ||
) | ||
} | ||
@@ -46,22 +46,22 @@ | ||
return Object.seal({ | ||
current: null | ||
}); | ||
current: null, | ||
}) | ||
} | ||
function isRef(maybeRef) { | ||
return isObject(maybeRef) && "current" in maybeRef; | ||
return isObject(maybeRef) && "current" in maybeRef | ||
} | ||
var SVGNamespace = "http://www.w3.org/2000/svg"; | ||
var XLinkNamespace = "http://www.w3.org/1999/xlink"; | ||
var XMLNamespace = "http://www.w3.org/XML/1998/namespace"; | ||
var SVGNamespace = "http://www.w3.org/2000/svg" | ||
var XLinkNamespace = "http://www.w3.org/1999/xlink" | ||
var XMLNamespace = "http://www.w3.org/XML/1998/namespace" | ||
function preventDefault(event) { | ||
event.preventDefault(); | ||
return event; | ||
event.preventDefault() | ||
return event | ||
} | ||
function stopPropagation(event) { | ||
event.stopPropagation(); | ||
return event; | ||
event.stopPropagation() | ||
return event | ||
} // https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | ||
@@ -71,3 +71,3 @@ // Emulate JSX Expression logic to ignore certain type of children or className. | ||
function isVisibleChild(value) { | ||
return !isBoolean(value) && value != null; | ||
return !isBoolean(value) && value != null | ||
} | ||
@@ -84,13 +84,13 @@ /** | ||
.filter(Boolean) | ||
.join(" "); | ||
.join(" ") | ||
} else if (isObject(value)) { | ||
return keys(value) | ||
.filter(function(k) { | ||
return value[k]; | ||
return value[k] | ||
}) | ||
.join(" "); | ||
.join(" ") | ||
} else if (isVisibleChild(value)) { | ||
return "" + value; | ||
return "" + value | ||
} else { | ||
return ""; | ||
return "" | ||
} | ||
@@ -153,27 +153,27 @@ } | ||
use: 0, | ||
view: 0 | ||
}; | ||
view: 0, | ||
} | ||
function Fragment(attr) { | ||
var fragment = document.createDocumentFragment(); | ||
appendChildren(attr.children, fragment); | ||
return fragment; | ||
var fragment = document.createDocumentFragment() | ||
appendChildren(attr.children, fragment) | ||
return fragment | ||
} | ||
function createElement(tag, attr) { | ||
var children = []; | ||
var children = [] | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
children[_i - 2] = arguments[_i]; | ||
children[_i - 2] = arguments[_i] | ||
} | ||
attr = attr || {}; | ||
attr = attr || {} | ||
if (!attr.namespaceURI && svg[tag] === 0) { | ||
attr = tslib_1.__assign({}, attr, { | ||
namespaceURI: SVGNamespace | ||
}); | ||
attr = tslib.__assign(tslib.__assign({}, attr), { | ||
namespaceURI: SVGNamespace, | ||
}) | ||
} | ||
var node; | ||
var node | ||
@@ -183,25 +183,25 @@ if (isString(tag)) { | ||
? document.createElementNS(attr.namespaceURI, tag) | ||
: document.createElement(tag); | ||
attributes(attr, node); | ||
appendChildren(children, node); | ||
: document.createElement(tag) | ||
attributes(attr, node) | ||
appendChildren(children, node) | ||
} else if (isFunction(tag)) { | ||
// Custom elements. | ||
if (isObject(tag.defaultProps)) { | ||
attr = tslib_1.__assign({}, tag.defaultProps, attr); | ||
attr = tslib.__assign(tslib.__assign({}, tag.defaultProps), attr) | ||
} | ||
node = tag( | ||
tslib_1.__assign({}, attr, { | ||
children: children | ||
tslib.__assign(tslib.__assign({}, attr), { | ||
children: children, | ||
}) | ||
); | ||
) | ||
} | ||
if (isRef(attr.ref)) { | ||
attr.ref.current = node; | ||
attr.ref.current = node | ||
} else if (isFunction(attr.ref)) { | ||
attr.ref(node); | ||
attr.ref(node) | ||
} | ||
return node; | ||
return node | ||
} | ||
@@ -211,9 +211,9 @@ | ||
if (isArrayLike(child)) { | ||
appendChildren(child, node); | ||
appendChildren(child, node) | ||
} else if (isString(child) || isNumber(child)) { | ||
node.appendChild(document.createTextNode(child)); | ||
node.appendChild(document.createTextNode(child)) | ||
} else if (child === null) { | ||
node.appendChild(document.createComment("")); | ||
node.appendChild(document.createComment("")) | ||
} else if (isElement(child)) { | ||
node.appendChild(child); | ||
node.appendChild(child) | ||
} | ||
@@ -224,7 +224,7 @@ } | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
var child = children_1[_i] | ||
appendChild(child, node) | ||
} | ||
return node; | ||
return node | ||
} | ||
@@ -234,4 +234,4 @@ | ||
return s.replace(/[A-Z\d]/g, function(match) { | ||
return ":" + match.toLowerCase(); | ||
}); | ||
return ":" + match.toLowerCase() | ||
}) | ||
} | ||
@@ -249,8 +249,8 @@ | ||
case "xlinkType": | ||
node.setAttributeNS(XLinkNamespace, normalizeAttribute(key), value); | ||
return; | ||
node.setAttributeNS(XLinkNamespace, normalizeAttribute(key), value) | ||
return | ||
case "xmlnsXlink": | ||
node.setAttribute(normalizeAttribute(key), value); | ||
return; | ||
node.setAttribute(normalizeAttribute(key), value) | ||
return | ||
@@ -260,4 +260,4 @@ case "xmlBase": | ||
case "xmlSpace": | ||
node.setAttributeNS(XMLNamespace, normalizeAttribute(key), value); | ||
return; | ||
node.setAttributeNS(XMLNamespace, normalizeAttribute(key), value) | ||
return | ||
} | ||
@@ -268,16 +268,16 @@ } | ||
case "htmlFor": | ||
node.setAttribute("for", value); | ||
return; | ||
node.setAttribute("for", value) | ||
return | ||
case "dataset": | ||
for (var _i = 0, _a = keys(value || {}); _i < _a.length; _i++) { | ||
var dataKey = _a[_i]; | ||
var dataValue = value[dataKey]; | ||
var dataKey = _a[_i] | ||
var dataValue = value[dataKey] | ||
if (dataValue != null) { | ||
node.dataset[dataKey] = dataValue; | ||
node.dataset[dataKey] = dataValue | ||
} | ||
} | ||
return; | ||
return | ||
@@ -287,23 +287,22 @@ case "innerHTML": | ||
case "textContent": | ||
node[key] = value; | ||
return; | ||
node[key] = value | ||
return | ||
case "spellCheck": | ||
node.spellcheck = value; | ||
return; | ||
node.spellcheck = value | ||
return | ||
case "class": | ||
case "className": | ||
node.setAttribute("class", className(value)); | ||
return; | ||
node.setAttribute("class", className(value)) | ||
return | ||
case "ref": | ||
case "namespaceURI": | ||
return; | ||
return | ||
case "style": | ||
if (isObject(value)) { | ||
tslib_1.__assign(node.style, value); | ||
return; | ||
Object.assign(node.style, value) | ||
return | ||
} | ||
@@ -316,9 +315,9 @@ | ||
if (key[0] === "o" && key[1] === "n") { | ||
var name = key.slice(2).toLowerCase(); | ||
listen(node, name, value); | ||
var name = key.slice(2).toLowerCase() | ||
listen(node, name, value) | ||
} | ||
} else if (value === true) { | ||
node.setAttribute(key, ""); | ||
node.setAttribute(key, "") | ||
} else if (value !== false && value != null) { | ||
node.setAttribute(key, value); | ||
node.setAttribute(key, value) | ||
} | ||
@@ -329,20 +328,20 @@ } | ||
for (var _i = 0, _a = keys(attr); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
attribute(key, attr[key], node); | ||
var key = _a[_i] | ||
attribute(key, attr[key], node) | ||
} | ||
return node; | ||
return node | ||
} | ||
function listen(node, eventName, callback) { | ||
node.addEventListener(eventName, callback); | ||
return node; | ||
node.addEventListener(eventName, callback) | ||
return node | ||
} | ||
exports.SVGNamespace = "http://www.w3.org/2000/svg"; | ||
exports.preventDefault = preventDefault; | ||
exports.stopPropagation = stopPropagation; | ||
exports.Fragment = Fragment; | ||
exports.h = createElement; | ||
exports.createElement = createElement; | ||
exports.createRef = createRef; | ||
exports.Fragment = Fragment | ||
exports.SVGNamespace = "http://www.w3.org/2000/svg" | ||
exports.createElement = createElement | ||
exports.createRef = createRef | ||
exports.h = createElement | ||
exports.preventDefault = preventDefault | ||
exports.stopPropagation = stopPropagation |
183
lib/svg.js
@@ -1,26 +0,26 @@ | ||
import { __assign } from "tslib"; | ||
var keys = Object.keys; | ||
import { __assign } from "tslib" | ||
var keys = Object.keys | ||
function isBoolean(val) { | ||
return typeof val === "boolean"; | ||
return typeof val === "boolean" | ||
} | ||
function isElement(val) { | ||
return val && typeof val.nodeType === "number"; | ||
return val && typeof val.nodeType === "number" | ||
} | ||
function isString(val) { | ||
return typeof val === "string"; | ||
return typeof val === "string" | ||
} | ||
function isNumber(val) { | ||
return typeof val === "number"; | ||
return typeof val === "number" | ||
} | ||
function isObject(val) { | ||
return typeof val === "object" ? val !== null : isFunction(val); | ||
return typeof val === "object" ? val !== null : isFunction(val) | ||
} // tslint:disable-next-line:ban-types | ||
function isFunction(val) { | ||
return typeof val === "function"; | ||
return typeof val === "function" | ||
} | ||
@@ -33,3 +33,3 @@ | ||
typeof obj.nodeType !== "number" | ||
); | ||
) | ||
} | ||
@@ -39,22 +39,22 @@ | ||
return Object.seal({ | ||
current: null | ||
}); | ||
current: null, | ||
}) | ||
} | ||
function isRef(maybeRef) { | ||
return isObject(maybeRef) && "current" in maybeRef; | ||
return isObject(maybeRef) && "current" in maybeRef | ||
} | ||
var SVGNamespace = "http://www.w3.org/2000/svg"; | ||
var XLinkNamespace = "http://www.w3.org/1999/xlink"; | ||
var XMLNamespace = "http://www.w3.org/XML/1998/namespace"; | ||
var SVGNamespace = "http://www.w3.org/2000/svg" | ||
var XLinkNamespace = "http://www.w3.org/1999/xlink" | ||
var XMLNamespace = "http://www.w3.org/XML/1998/namespace" | ||
function preventDefault(event) { | ||
event.preventDefault(); | ||
return event; | ||
event.preventDefault() | ||
return event | ||
} | ||
function stopPropagation(event) { | ||
event.stopPropagation(); | ||
return event; | ||
event.stopPropagation() | ||
return event | ||
} // https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | ||
@@ -64,3 +64,3 @@ // Emulate JSX Expression logic to ignore certain type of children or className. | ||
function isVisibleChild(value) { | ||
return !isBoolean(value) && value != null; | ||
return !isBoolean(value) && value != null | ||
} | ||
@@ -77,13 +77,13 @@ /** | ||
.filter(Boolean) | ||
.join(" "); | ||
.join(" ") | ||
} else if (isObject(value)) { | ||
return keys(value) | ||
.filter(function(k) { | ||
return value[k]; | ||
return value[k] | ||
}) | ||
.join(" "); | ||
.join(" ") | ||
} else if (isVisibleChild(value)) { | ||
return "" + value; | ||
return "" + value | ||
} else { | ||
return ""; | ||
return "" | ||
} | ||
@@ -146,27 +146,27 @@ } | ||
use: 0, | ||
view: 0 | ||
}; | ||
view: 0, | ||
} | ||
function Fragment(attr) { | ||
var fragment = document.createDocumentFragment(); | ||
appendChildren(attr.children, fragment); | ||
return fragment; | ||
var fragment = document.createDocumentFragment() | ||
appendChildren(attr.children, fragment) | ||
return fragment | ||
} | ||
function createElement(tag, attr) { | ||
var children = []; | ||
var children = [] | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
children[_i - 2] = arguments[_i]; | ||
children[_i - 2] = arguments[_i] | ||
} | ||
attr = attr || {}; | ||
attr = attr || {} | ||
if (!attr.namespaceURI && svg[tag] === 0) { | ||
attr = __assign({}, attr, { | ||
namespaceURI: SVGNamespace | ||
}); | ||
attr = __assign(__assign({}, attr), { | ||
namespaceURI: SVGNamespace, | ||
}) | ||
} | ||
var node; | ||
var node | ||
@@ -176,25 +176,25 @@ if (isString(tag)) { | ||
? document.createElementNS(attr.namespaceURI, tag) | ||
: document.createElement(tag); | ||
attributes(attr, node); | ||
appendChildren(children, node); | ||
: document.createElement(tag) | ||
attributes(attr, node) | ||
appendChildren(children, node) | ||
} else if (isFunction(tag)) { | ||
// Custom elements. | ||
if (isObject(tag.defaultProps)) { | ||
attr = __assign({}, tag.defaultProps, attr); | ||
attr = __assign(__assign({}, tag.defaultProps), attr) | ||
} | ||
node = tag( | ||
__assign({}, attr, { | ||
children: children | ||
__assign(__assign({}, attr), { | ||
children: children, | ||
}) | ||
); | ||
) | ||
} | ||
if (isRef(attr.ref)) { | ||
attr.ref.current = node; | ||
attr.ref.current = node | ||
} else if (isFunction(attr.ref)) { | ||
attr.ref(node); | ||
attr.ref(node) | ||
} | ||
return node; | ||
return node | ||
} | ||
@@ -204,9 +204,9 @@ | ||
if (isArrayLike(child)) { | ||
appendChildren(child, node); | ||
appendChildren(child, node) | ||
} else if (isString(child) || isNumber(child)) { | ||
node.appendChild(document.createTextNode(child)); | ||
node.appendChild(document.createTextNode(child)) | ||
} else if (child === null) { | ||
node.appendChild(document.createComment("")); | ||
node.appendChild(document.createComment("")) | ||
} else if (isElement(child)) { | ||
node.appendChild(child); | ||
node.appendChild(child) | ||
} | ||
@@ -217,7 +217,7 @@ } | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
var child = children_1[_i] | ||
appendChild(child, node) | ||
} | ||
return node; | ||
return node | ||
} | ||
@@ -227,4 +227,4 @@ | ||
return s.replace(/[A-Z\d]/g, function(match) { | ||
return ":" + match.toLowerCase(); | ||
}); | ||
return ":" + match.toLowerCase() | ||
}) | ||
} | ||
@@ -242,8 +242,8 @@ | ||
case "xlinkType": | ||
node.setAttributeNS(XLinkNamespace, normalizeAttribute(key), value); | ||
return; | ||
node.setAttributeNS(XLinkNamespace, normalizeAttribute(key), value) | ||
return | ||
case "xmlnsXlink": | ||
node.setAttribute(normalizeAttribute(key), value); | ||
return; | ||
node.setAttribute(normalizeAttribute(key), value) | ||
return | ||
@@ -253,4 +253,4 @@ case "xmlBase": | ||
case "xmlSpace": | ||
node.setAttributeNS(XMLNamespace, normalizeAttribute(key), value); | ||
return; | ||
node.setAttributeNS(XMLNamespace, normalizeAttribute(key), value) | ||
return | ||
} | ||
@@ -261,16 +261,16 @@ } | ||
case "htmlFor": | ||
node.setAttribute("for", value); | ||
return; | ||
node.setAttribute("for", value) | ||
return | ||
case "dataset": | ||
for (var _i = 0, _a = keys(value || {}); _i < _a.length; _i++) { | ||
var dataKey = _a[_i]; | ||
var dataValue = value[dataKey]; | ||
var dataKey = _a[_i] | ||
var dataValue = value[dataKey] | ||
if (dataValue != null) { | ||
node.dataset[dataKey] = dataValue; | ||
node.dataset[dataKey] = dataValue | ||
} | ||
} | ||
return; | ||
return | ||
@@ -280,23 +280,22 @@ case "innerHTML": | ||
case "textContent": | ||
node[key] = value; | ||
return; | ||
node[key] = value | ||
return | ||
case "spellCheck": | ||
node.spellcheck = value; | ||
return; | ||
node.spellcheck = value | ||
return | ||
case "class": | ||
case "className": | ||
node.setAttribute("class", className(value)); | ||
return; | ||
node.setAttribute("class", className(value)) | ||
return | ||
case "ref": | ||
case "namespaceURI": | ||
return; | ||
return | ||
case "style": | ||
if (isObject(value)) { | ||
__assign(node.style, value); | ||
return; | ||
Object.assign(node.style, value) | ||
return | ||
} | ||
@@ -309,9 +308,9 @@ | ||
if (key[0] === "o" && key[1] === "n") { | ||
var name = key.slice(2).toLowerCase(); | ||
listen(node, name, value); | ||
var name = key.slice(2).toLowerCase() | ||
listen(node, name, value) | ||
} | ||
} else if (value === true) { | ||
node.setAttribute(key, ""); | ||
node.setAttribute(key, "") | ||
} else if (value !== false && value != null) { | ||
node.setAttribute(key, value); | ||
node.setAttribute(key, value) | ||
} | ||
@@ -322,22 +321,22 @@ } | ||
for (var _i = 0, _a = keys(attr); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
attribute(key, attr[key], node); | ||
var key = _a[_i] | ||
attribute(key, attr[key], node) | ||
} | ||
return node; | ||
return node | ||
} | ||
function listen(node, eventName, callback) { | ||
node.addEventListener(eventName, callback); | ||
return node; | ||
node.addEventListener(eventName, callback) | ||
return node | ||
} | ||
export { | ||
Fragment, | ||
SVGNamespace, | ||
createElement, | ||
createRef, | ||
createElement as h, | ||
preventDefault, | ||
stopPropagation, | ||
Fragment, | ||
createElement as h, | ||
createElement, | ||
createRef | ||
}; | ||
} |
{ | ||
"name": "jsx-dom", | ||
"version": "6.3.1", | ||
"version": "6.4.0", | ||
"description": "JSX to document.createElement.", | ||
"main": "lib/index.cjs.js", | ||
"jsnext:main": "lib/index.js", | ||
"module": "lib/index.js", | ||
@@ -19,25 +18,29 @@ "scripts": { | ||
"typings": "index.d.ts", | ||
"author": "@glixlur", | ||
"author": "proteria", | ||
"license": "BSD-3-Clause", | ||
"devDependencies": { | ||
"@babel/core": "^7.3.4", | ||
"@types/babel__core": "^7.1.0", | ||
"@types/chai": "^4.1.7", | ||
"@types/jsdom": "^12.2.3", | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^11.11.3", | ||
"@types/prop-types": "^15.7.0", | ||
"babel-preset-minify": "^0.5.0", | ||
"@babel/core": "^7.5.5", | ||
"@types/babel__core": "^7.1.2", | ||
"@types/chai": "^4.2.0", | ||
"@types/jsdom": "^12.2.4", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.7.3", | ||
"@types/prop-types": "^15.7.1", | ||
"babel-preset-minify": "^0.5.1", | ||
"chai": "^4.2.0", | ||
"coffeescript": "^2.3.2", | ||
"fs-extra": "^7.0.1", | ||
"jsdom": "^14.0.0", | ||
"mocha": "^6.0.2", | ||
"nyc": "^13.3.0", | ||
"rollup": "^1.6.0", | ||
"coffeescript": "^2.4.1", | ||
"fs-extra": "^8.1.0", | ||
"jsdom": "^15.1.1", | ||
"mocha": "^6.2.0", | ||
"nyc": "^14.1.1", | ||
"prettier": "^1.18.2", | ||
"rollup": "^1.20.3", | ||
"rollup-plugin-prettier": "^0.6.0", | ||
"rollup-plugin-replace": "^2.1.0", | ||
"rollup-plugin-replace": "^2.2.0", | ||
"rollup-typescript": "^1.2.0", | ||
"ts-node": "^8.0.3", | ||
"typescript": "^3.3.3333" | ||
"ts-node": "^8.3.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"typescript": "^3.6.2" | ||
}, | ||
@@ -52,5 +55,9 @@ "repository": { | ||
"homepage": "https://github.com/glixlur/jsx-dom#readme", | ||
"dependencies": { | ||
"tslib": "^1.9.3" | ||
"prettier": { | ||
"tabWidth": 2, | ||
"printWidth": 85, | ||
"semi": false, | ||
"singleQuote": false, | ||
"trailingComma": "es5" | ||
} | ||
} |
# jsx-dom | ||
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) | ||
[![build status](https://travis-ci.org/glixlur/jsx-dom.svg?branch=master)](https://travis-ci.org/glixlur/jsx-dom) | ||
[![dependency status](https://david-dm.org/glixlur/jsx-dom/status.svg)](https://david-dm.org/glixlur/jsx-dom#info=dependencies) | ||
[![devDependency status](https://david-dm.org/glixlur/jsx-dom/dev-status.svg)](https://david-dm.org/glixlur/jsx-dom#info=devDependencies) | ||
[![build status](https://travis-ci.org/proteria/jsx-dom.svg?branch=master)](https://travis-ci.org/proteria/jsx-dom) | ||
[![dependency status](https://david-dm.org/proteria/jsx-dom/status.svg)](https://david-dm.org/proteria/jsx-dom#info=dependencies) | ||
[![devDependency status](https://david-dm.org/proteria/jsx-dom/dev-status.svg)](https://david-dm.org/proteria/jsx-dom#info=devDependencies) | ||
[![npm version](https://badge.fury.io/js/jsx-dom.svg)](https://badge.fury.io/js/jsx-dom) | ||
@@ -7,0 +7,0 @@ ![big mood](https://img.shields.io/badge/kirito-eugeo-blue.svg) |
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
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
220509
0
0
24
- Removedtslib@^1.9.3
- Removedtslib@1.14.1(transitive)