Comparing version 5.1.4 to 5.1.5
@@ -5,9 +5,3 @@ 'use strict'; | ||
var __assign = Object.assign || function __assign(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; | ||
}; | ||
var tslib_1 = require('tslib'); | ||
@@ -50,2 +44,3 @@ var keys = Object.keys; | ||
} | ||
/** @type {any} */ | ||
var DOM = function (obj) { | ||
@@ -97,7 +92,11 @@ for (var _i = 0, _a = keys(obj); _i < _a.length; _i++) { | ||
} | ||
// https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | ||
// Emulate JSX Expression logic to ignore certain type of children or className. | ||
function isVisibleChild(value) { | ||
return !isBoolean(value) && value != null; | ||
} | ||
/** | ||
* Convert a `value` to a className string. | ||
* `value` can be a string, an array or a `Dictionary<boolean>`. | ||
*/ | ||
function className(value) { | ||
@@ -124,7 +123,10 @@ if (Array.isArray(value)) { | ||
if (isString(tag)) { | ||
node = attr.namespaceURI ? document.createElementNS(attr.namespaceURI, tag) : document.createElement(tag); | ||
node = attr.namespaceURI ? document.createElementNS(attr.namespaceURI, tag) | ||
// : isProbablySVG(tag) ? document.createElementNS( SVGNamespace, tag ) | ||
: document.createElement(tag); | ||
attributes(attr, node); | ||
appendChildren(children, node); | ||
} else if (isFunction(tag)) { | ||
node = tag(__assign({}, attr, { children: children })); | ||
// Custom elements. | ||
node = tag(tslib_1.__assign({}, attr, { children: children })); | ||
} | ||
@@ -148,9 +150,5 @@ if (isFunction(attr.ref)) { | ||
function appendChildren(children, node) { | ||
if (isElement(children) || isString(children)) { | ||
appendChild(children, node); | ||
} else { | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
} | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
} | ||
@@ -166,3 +164,3 @@ return node; | ||
if (isObject(value)) { | ||
__assign(node[key], value); | ||
tslib_1.__assign(node[key], value); | ||
continue; | ||
@@ -172,3 +170,3 @@ } | ||
case 'dataset': | ||
__assign(node[key], value); | ||
tslib_1.__assign(node[key], value); | ||
continue; | ||
@@ -192,3 +190,3 @@ case 'innerHTML': | ||
if (isFunction(value)) { | ||
if (key.substr(0, 2) === 'on') { | ||
if (key[0] === 'o' && key[1] === 'n') { | ||
var name = key.slice(2).toLowerCase(); | ||
@@ -195,0 +193,0 @@ listen(node, name, value); |
36
index.js
@@ -0,11 +1,3 @@ | ||
import { __assign } from 'tslib'; | ||
var __assign = Object.assign || function __assign(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; | ||
}; | ||
var keys = Object.keys; | ||
@@ -47,2 +39,3 @@ function isBoolean(val) { | ||
} | ||
/** @type {any} */ | ||
var DOM = function (obj) { | ||
@@ -94,7 +87,11 @@ for (var _i = 0, _a = keys(obj); _i < _a.length; _i++) { | ||
} | ||
// https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | ||
// Emulate JSX Expression logic to ignore certain type of children or className. | ||
function isVisibleChild(value) { | ||
return !isBoolean(value) && value != null; | ||
} | ||
/** | ||
* Convert a `value` to a className string. | ||
* `value` can be a string, an array or a `Dictionary<boolean>`. | ||
*/ | ||
function className(value) { | ||
@@ -121,6 +118,9 @@ if (Array.isArray(value)) { | ||
if (isString(tag)) { | ||
node = attr.namespaceURI ? document.createElementNS(attr.namespaceURI, tag) : document.createElement(tag); | ||
node = attr.namespaceURI ? document.createElementNS(attr.namespaceURI, tag) | ||
// : isProbablySVG(tag) ? document.createElementNS( SVGNamespace, tag ) | ||
: document.createElement(tag); | ||
attributes(attr, node); | ||
appendChildren(children, node); | ||
} else if (isFunction(tag)) { | ||
// Custom elements. | ||
node = tag(__assign({}, attr, { children: children })); | ||
@@ -145,9 +145,5 @@ } | ||
function appendChildren(children, node) { | ||
if (isElement(children) || isString(children)) { | ||
appendChild(children, node); | ||
} else { | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
} | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
} | ||
@@ -187,3 +183,3 @@ return node; | ||
if (isFunction(value)) { | ||
if (key.substr(0, 2) === 'on') { | ||
if (key[0] === 'o' && key[1] === 'n') { | ||
var name = key.slice(2).toLowerCase(); | ||
@@ -190,0 +186,0 @@ listen(node, name, value); |
{ | ||
"name": "jsx-dom", | ||
"version": "5.1.4", | ||
"version": "5.1.5", | ||
"description": "JSX to document.createElement.", | ||
@@ -11,3 +11,4 @@ "main": "index.cjs.js", | ||
"pretest": "npm run build", | ||
"test": "mocha ./test/test.tsx --compilers ts:ts-node/register" | ||
"postpublish": "rm index.js index.cjs.js svg.js svg.cjs.js", | ||
"test": "nyc --reporter=html mocha ./test/test.tsx --compilers ts:ts-node/register" | ||
}, | ||
@@ -22,15 +23,16 @@ "keywords": [ | ||
"@alexlur/rollup-plugin-typescript": "^1.0.4", | ||
"@types/babel-core": "^6.25.1", | ||
"@types/babel-core": "^6.25.3", | ||
"@types/chai": "^4.0.4", | ||
"@types/jsdom": "^11.0.2", | ||
"@types/mocha": "^2.2.42", | ||
"@types/node": "^8.0.27", | ||
"@types/jsdom": "^11.0.3", | ||
"@types/mocha": "^2.2.44", | ||
"@types/node": "^8.0.47", | ||
"babel-core": "^6.26.0", | ||
"chai": "^4.1.2", | ||
"coffeescript": "^2.0.0-beta3", | ||
"jsdom": "^11.2.0", | ||
"mocha": "^3.5.0", | ||
"rollup": "^0.49.2", | ||
"coffeescript": "^2.0.2", | ||
"jsdom": "^11.3.0", | ||
"mocha": "^4.0.1", | ||
"nyc": "^11.2.1", | ||
"rollup": "^0.50.0", | ||
"ts-node": "^3.3.0", | ||
"typescript": "^2.5.2" | ||
"typescript": "^2.5.3" | ||
}, | ||
@@ -44,3 +46,6 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/alexlur/jsx-dom#readme" | ||
"homepage": "https://github.com/alexlur/jsx-dom#readme", | ||
"dependencies": { | ||
"tslib": "^1.8.0" | ||
} | ||
} |
@@ -5,9 +5,3 @@ 'use strict'; | ||
var __assign = Object.assign || function __assign(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; | ||
}; | ||
var tslib_1 = require('tslib'); | ||
@@ -50,2 +44,3 @@ var keys = Object.keys; | ||
} | ||
/** @type {any} */ | ||
var DOM = function (obj) { | ||
@@ -97,7 +92,11 @@ for (var _i = 0, _a = keys(obj); _i < _a.length; _i++) { | ||
} | ||
// https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | ||
// Emulate JSX Expression logic to ignore certain type of children or className. | ||
function isVisibleChild(value) { | ||
return !isBoolean(value) && value != null; | ||
} | ||
/** | ||
* Convert a `value` to a className string. | ||
* `value` can be a string, an array or a `Dictionary<boolean>`. | ||
*/ | ||
function className(value) { | ||
@@ -124,7 +123,10 @@ if (Array.isArray(value)) { | ||
if (isString(tag)) { | ||
node = attr.namespaceURI ? document.createElementNS(attr.namespaceURI, tag) : document.createElement(tag); | ||
node = attr.namespaceURI ? document.createElementNS(attr.namespaceURI, tag) | ||
// : isProbablySVG(tag) ? document.createElementNS( SVGNamespace, tag ) | ||
: document.createElement(tag); | ||
attributes(attr, node); | ||
appendChildren(children, node); | ||
} else if (isFunction(tag)) { | ||
node = tag(__assign({}, attr, { children: children })); | ||
// Custom elements. | ||
node = tag(tslib_1.__assign({}, attr, { children: children })); | ||
} | ||
@@ -148,9 +150,5 @@ if (isFunction(attr.ref)) { | ||
function appendChildren(children, node) { | ||
if (isElement(children) || isString(children)) { | ||
appendChild(children, node); | ||
} else { | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
} | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
} | ||
@@ -166,3 +164,3 @@ return node; | ||
if (isObject(value)) { | ||
__assign(node[key], value); | ||
tslib_1.__assign(node[key], value); | ||
continue; | ||
@@ -172,3 +170,3 @@ } | ||
case 'dataset': | ||
__assign(node[key], value); | ||
tslib_1.__assign(node[key], value); | ||
continue; | ||
@@ -192,3 +190,3 @@ case 'innerHTML': | ||
if (isFunction(value)) { | ||
if (key.substr(0, 2) === 'on') { | ||
if (key[0] === 'o' && key[1] === 'n') { | ||
var name = key.slice(2).toLowerCase(); | ||
@@ -221,3 +219,3 @@ listen(node, name, value); | ||
var svg = __assign(Object.create(null), { | ||
var svg = tslib_1.__assign(Object.create(null), { | ||
svg: 0, | ||
@@ -284,3 +282,3 @@ animate: 0, | ||
if ((!attr || !attr.namespaceURI) && tag in svg) { | ||
attr = __assign({}, attr, { namespaceURI: SVGNamespace }); | ||
attr = tslib_1.__assign({}, attr, { namespaceURI: SVGNamespace }); | ||
} | ||
@@ -287,0 +285,0 @@ return createElement$1.apply(dom, [tag, attr].concat(args)); |
36
svg.js
@@ -0,11 +1,3 @@ | ||
import { __assign } from 'tslib'; | ||
var __assign = Object.assign || function __assign(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; | ||
}; | ||
var keys = Object.keys; | ||
@@ -47,2 +39,3 @@ function isBoolean(val) { | ||
} | ||
/** @type {any} */ | ||
var DOM = function (obj) { | ||
@@ -94,7 +87,11 @@ for (var _i = 0, _a = keys(obj); _i < _a.length; _i++) { | ||
} | ||
// https://facebook.github.io/react/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored | ||
// Emulate JSX Expression logic to ignore certain type of children or className. | ||
function isVisibleChild(value) { | ||
return !isBoolean(value) && value != null; | ||
} | ||
/** | ||
* Convert a `value` to a className string. | ||
* `value` can be a string, an array or a `Dictionary<boolean>`. | ||
*/ | ||
function className(value) { | ||
@@ -121,6 +118,9 @@ if (Array.isArray(value)) { | ||
if (isString(tag)) { | ||
node = attr.namespaceURI ? document.createElementNS(attr.namespaceURI, tag) : document.createElement(tag); | ||
node = attr.namespaceURI ? document.createElementNS(attr.namespaceURI, tag) | ||
// : isProbablySVG(tag) ? document.createElementNS( SVGNamespace, tag ) | ||
: document.createElement(tag); | ||
attributes(attr, node); | ||
appendChildren(children, node); | ||
} else if (isFunction(tag)) { | ||
// Custom elements. | ||
node = tag(__assign({}, attr, { children: children })); | ||
@@ -145,9 +145,5 @@ } | ||
function appendChildren(children, node) { | ||
if (isElement(children) || isString(children)) { | ||
appendChild(children, node); | ||
} else { | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
} | ||
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { | ||
var child = children_1[_i]; | ||
appendChild(child, node); | ||
} | ||
@@ -187,3 +183,3 @@ return node; | ||
if (isFunction(value)) { | ||
if (key.substr(0, 2) === 'on') { | ||
if (key[0] === 'o' && key[1] === 'n') { | ||
var name = key.slice(2).toLowerCase(); | ||
@@ -190,0 +186,0 @@ listen(node, name, value); |
Sorry, the diff of this file is too big to display
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
130471
1
15
9
+ Addedtslib@^1.8.0
+ Addedtslib@1.14.1(transitive)