Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsx-dom-runtime

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsx-dom-runtime - npm Package Compare versions

Comparing version 0.14.0 to 0.14.1

2

dist/index.cjs.js

@@ -27,3 +27,3 @@ 'use strict';

var Extend = '_ex';
var Extend = '!';
exports.Extend = Extend;

@@ -30,0 +30,0 @@ exports.createRef = createRef;

@@ -19,4 +19,4 @@ let createRef = () => ({

const Extend = '_ex';
const Extend = '!';
export { Extend, createRef, parseFromString, useText };

@@ -21,3 +21,3 @@ var createRef = function createRef() {

var Extend = '_ex';
var Extend = '!';
export { Extend, createRef, parseFromString, useText };

@@ -15,75 +15,74 @@ 'use strict';

let plugins = new Map();
let extensions = new Map();
let properties = new Set(['className', 'innerHTML', 'textContent', 'value', 'htmlFor']);
let jsx = (el, props) => {
if (typeof el === 'function') {
return el(props);
let jsx = (node, props) => {
let key, val;
if (typeof node === 'function') {
return node(props);
}
if (el === '_ex') {
for (let key in props) {
plugins.set(key, props[key]);
if (node === '!') {
for (key in props) {
extensions.set(key, props[key]);
}
} else {
node = typeof node === 'string' ? document.createElement(node) : node;
return;
}
for (key in props) {
if (key !== 'ref' && key !== 'children') {
val = props[key];
let val;
let node = typeof el === 'string' ? document.createElement(el) : el;
if (extensions.has(key)) {
extensions.get(key)(node, val);
} else if (properties.has(key)) {
node[key] = val;
} else if (key === 'style') {
if (typeof val === 'string') {
node.style.cssText = val;
} else {
// reuse `key` variable
for (key in val) {
if (key[0] === '-') {
node.style.setProperty(key, val[key]);
} else {
node.style[key] = val[key];
}
}
} // Benchmark for comparison (thanks preact): https://esbench.com/bench/574c954bdb965b9a00965ac6
for (let key in props) {
if (key !== 'ref' && key !== 'children') {
val = props[key];
} else if (key[0] === 'o' && key[1] === 'n') {
key = key.toLowerCase();
if (plugins.has(key)) {
plugins.get(key)(node, val);
} else if (properties.has(key)) {
node[key] = val;
} else if (key === 'style') {
if (typeof val === 'string') {
node.style.cssText = val;
} else {
// reuse `key` variable
for (key in val) {
if (key[0] === '-') {
node.style.setProperty(key, val[key]);
} else {
node.style[key] = val[key];
}
if (key in node) {
node[key] = val;
}
} // Benchmark for comparison (thanks preact): https://esbench.com/bench/574c954bdb965b9a00965ac6
} else if (key[0] === 'o' && key[1] === 'n') {
key = key.toLowerCase();
if (key in node) {
node[key] = val;
}
} else if (val != null) {
if (typeof val !== 'boolean' || /^(ari|dat)a-/.test(key)) {
node.setAttribute(key, val);
} else if (val) {
node.setAttribute(key, '');
} else if (val != null) {
if (typeof val !== 'boolean' || /^(ari|dat)a-/.test(key)) {
node.setAttribute(key, val);
} else if (val) {
node.setAttribute(key, '');
} else {
node.removeAttribute(key);
}
} else {
node.removeAttribute(key);
}
} else {
node.removeAttribute(key);
}
}
}
appendChildren(node.tagName === 'TEMPLATE' ? node.content : node, props.children); // reuse `val` variable
appendChildren(node.tagName === 'TEMPLATE' ? node.content : node, props.children); // reuse `val` variable
val = props.ref;
val = props.ref;
if (val != null) {
if (typeof val === 'function') {
val(node);
} else {
val.current = node;
if (val != null) {
if (typeof val === 'function') {
val(node);
} else {
val.current = node;
}
}
return node;
}
return node;
};

@@ -319,6 +318,18 @@

const inputMode = T.oneOf(['none', 'text', 'tel', 'url', 'email', 'numeric', 'decimal', 'search']);
const enterKeyHint = T.oneOf(['enter', 'done', 'go', 'next', 'previous', 'search', 'send']);
const input = {
type: T.oneOf(['text', 'password', 'tel', 'checkbox', 'radio', 'button', 'search', 'color', 'date', 'datetime', 'email', 'file', 'hidden', 'image', 'month', 'number', 'range', 'reset', 'submit', 'time', 'url', 'week', 'datetime-local']),
value: T.oneOfType([T.string, T.number]),
name: T.string
name: T.string,
inputMode,
inputmode: inputMode,
enterKeyHint,
enterkeyhint: enterKeyHint,
pattern: T.string,
maxLength: T.number,
maxlength: T.number,
minLength: T.number,
minlength: T.number,
size: T.number
};

@@ -352,5 +363,15 @@

const iframe = {
title: T.string,
name: T.string,
src: T.string,
srcDoc: T.string,
allowFullScreen: T.bool,
allowfullscreen: T.bool,
loading: T.oneOf(['eager', 'lazy'])
};
const specMap = new Map();
const defaultSpecs = Object.assign({}, element, ARIA);
const list = [['a', a, ReferrerPolicy], 'abbr', 'address', 'applet', ['area', ReferrerPolicy], 'article', 'aside', ['audio', CORS], 'b', 'base', 'basefont', 'bdi', 'bdo', 'blockquote', 'body', 'br', ['button', button], 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', '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', ReferrerPolicy], ['img', img, CORS, ReferrerPolicy], ['input', input, CORS], 'ins', 'kbd', ['label', label], 'legend', 'li', ['link', CORS, ReferrerPolicy], 'main', 'map', 'mark', 'marquee', 'menu', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', ['script', CORS], 'section', 'select', 'slot', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', ['textarea', textarea], 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', ['video', CORS], 'wbr'];
const list = [['a', a, ReferrerPolicy], 'abbr', 'address', 'applet', ['area', ReferrerPolicy], 'article', 'aside', ['audio', CORS], 'b', 'base', 'basefont', 'bdi', 'bdo', 'blockquote', 'body', 'br', ['button', button], 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', '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', iframe, ReferrerPolicy], ['img', img, CORS, ReferrerPolicy], ['input', input, CORS], 'ins', 'kbd', ['label', label], 'legend', 'li', ['link', CORS, ReferrerPolicy], 'main', 'map', 'mark', 'marquee', 'menu', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', ['script', CORS], 'section', 'select', 'slot', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', ['textarea', textarea], 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', ['video', CORS], 'wbr'];
list.forEach(item => {

@@ -357,0 +378,0 @@ if (Array.isArray(item)) {

@@ -1,1 +0,1 @@

Object.defineProperty(exports,"__esModule",{value:!0});var e=function e(t,r){Array.isArray(r)?r.forEach((function(r){e(t,r)})):null!=r&&!1!==r&&t.appendChild(r.nodeType>0?r:document.createTextNode(r))},t=new Map,r=new Set(["className","innerHTML","textContent","value","htmlFor"]),n=function(n,o){if("function"==typeof n)return n(o);if("_ex"!==n){var i,s="string"==typeof n?document.createElement(n):n;for(var a in o)if("ref"!==a&&"children"!==a)if(i=o[a],t.has(a))t.get(a)(s,i);else if(r.has(a))s[a]=i;else if("style"===a)if("string"==typeof i)s.style.cssText=i;else for(a in i)"-"===a[0]?s.style.setProperty(a,i[a]):s.style[a]=i[a];else"o"===a[0]&&"n"===a[1]?(a=a.toLowerCase())in s&&(s[a]=i):null!=i?"boolean"!=typeof i||/^(ari|dat)a-/.test(a)?s.setAttribute(a,i):i?s.setAttribute(a,""):s.removeAttribute(a):s.removeAttribute(a);return e("TEMPLATE"===s.tagName?s.content:s,o.children),null!=(i=o.ref)&&("function"==typeof i?i(s):i.current=s),s}for(var f in o)t.set(f,o[f])};exports.Fragment=function(t){var r=document.createDocumentFragment();return e(r,t.children),r},exports.jsx=n,exports.jsxs=n;
Object.defineProperty(exports,"__esModule",{value:!0});var e=function e(t,r){Array.isArray(r)?r.forEach((function(r){e(t,r)})):null!=r&&!1!==r&&t.appendChild(r.nodeType>0?r:document.createTextNode(r))},t=new Map,r=new Set(["className","innerHTML","textContent","value","htmlFor"]),n=function(n,o){var i,s;if("function"==typeof n)return n(o);if("!"!==n){for(i in n="string"==typeof n?document.createElement(n):n,o)if("ref"!==i&&"children"!==i)if(s=o[i],t.has(i))t.get(i)(n,s);else if(r.has(i))n[i]=s;else if("style"===i)if("string"==typeof s)n.style.cssText=s;else for(i in s)"-"===i[0]?n.style.setProperty(i,s[i]):n.style[i]=s[i];else"o"===i[0]&&"n"===i[1]?(i=i.toLowerCase())in n&&(n[i]=s):null!=s?"boolean"!=typeof s||/^(ari|dat)a-/.test(i)?n.setAttribute(i,s):s?n.setAttribute(i,""):n.removeAttribute(i):n.removeAttribute(i);return e("TEMPLATE"===n.tagName?n.content:n,o.children),null!=(s=o.ref)&&("function"==typeof s?s(n):s.current=n),n}for(i in o)t.set(i,o[i])};exports.Fragment=function(t){var r=document.createDocumentFragment();return e(r,t.children),r},exports.jsx=n,exports.jsxs=n;

@@ -1,1 +0,1 @@

let e=(t,r)=>{Array.isArray(r)?r.forEach((r=>{e(t,r)})):null!=r&&!1!==r&&t.appendChild(r.nodeType>0?r:document.createTextNode(r))},t=t=>{let r=document.createDocumentFragment();return e(r,t.children),r},r=new Map,n=new Set(["className","innerHTML","textContent","value","htmlFor"]),o=(t,o)=>{if("function"==typeof t)return t(o);if("_ex"===t){for(let e in o)r.set(e,o[e]);return}let l,i="string"==typeof t?document.createElement(t):t;for(let e in o)if("ref"!==e&&"children"!==e)if(l=o[e],r.has(e))r.get(e)(i,l);else if(n.has(e))i[e]=l;else if("style"===e)if("string"==typeof l)i.style.cssText=l;else for(e in l)"-"===e[0]?i.style.setProperty(e,l[e]):i.style[e]=l[e];else"o"===e[0]&&"n"===e[1]?(e=e.toLowerCase(),e in i&&(i[e]=l)):null!=l?"boolean"!=typeof l||/^(ari|dat)a-/.test(e)?i.setAttribute(e,l):l?i.setAttribute(e,""):i.removeAttribute(e):i.removeAttribute(e);return e("TEMPLATE"===i.tagName?i.content:i,o.children),l=o.ref,null!=l&&("function"==typeof l?l(i):l.current=i),i};export{t as Fragment,o as jsx,o as jsxs};
let e=(t,r)=>{Array.isArray(r)?r.forEach((r=>{e(t,r)})):null!=r&&!1!==r&&t.appendChild(r.nodeType>0?r:document.createTextNode(r))},t=t=>{let r=document.createDocumentFragment();return e(r,t.children),r},r=new Map,n=new Set(["className","innerHTML","textContent","value","htmlFor"]),o=(t,o)=>{let i,l;if("function"==typeof t)return t(o);if("!"!==t){for(i in t="string"==typeof t?document.createElement(t):t,o)if("ref"!==i&&"children"!==i)if(l=o[i],r.has(i))r.get(i)(t,l);else if(n.has(i))t[i]=l;else if("style"===i)if("string"==typeof l)t.style.cssText=l;else for(i in l)"-"===i[0]?t.style.setProperty(i,l[i]):t.style[i]=l[i];else"o"===i[0]&&"n"===i[1]?(i=i.toLowerCase(),i in t&&(t[i]=l)):null!=l?"boolean"!=typeof l||/^(ari|dat)a-/.test(i)?t.setAttribute(i,l):l?t.setAttribute(i,""):t.removeAttribute(i):t.removeAttribute(i);return e("TEMPLATE"===t.tagName?t.content:t,o.children),l=o.ref,null!=l&&("function"==typeof l?l(t):l.current=t),t}for(i in o)r.set(i,o[i])};export{t as Fragment,o as jsx,o as jsxs};

@@ -22,3 +22,3 @@ let appendChildren = (node, children) => {

let plugins = new Map();
let extensions = new Map();

@@ -33,79 +33,78 @@ let properties = new Set([

let jsx = (el, props) => {
if (typeof el === 'function') {
return el(props);
let jsx = (node, props) => {
let key, val;
if (typeof node === 'function') {
return node(props);
}
if (el === '_ex') {
for (let key in props) {
plugins.set(key, props[key]);
if (node === '!') {
for (key in props) {
extensions.set(key, props[key]);
}
} else {
node = typeof node === 'string' ? document.createElement(node) : node;
return;
}
for (key in props) {
if (key !== 'ref' && key !== 'children') {
val = props[key];
let val;
let node = typeof el === 'string' ? document.createElement(el) : el;
for (let key in props) {
if (key !== 'ref' && key !== 'children') {
val = props[key];
if (plugins.has(key)) {
plugins.get(key)(node, val);
} else if (properties.has(key)) {
node[key] = val;
} else if (key === 'style') {
if (typeof val === 'string') {
node.style.cssText = val;
} else {
if (extensions.has(key)) {
extensions.get(key)(node, val);
} else if (properties.has(key)) {
node[key] = val;
} else if (key === 'style') {
if (typeof val === 'string') {
node.style.cssText = val;
} else {
// reuse `key` variable
for (key in val) {
if (key[0] === '-') {
node.style.setProperty(key, val[key]);
} else {
node.style[key] = val[key];
for (key in val) {
if (key[0] === '-') {
node.style.setProperty(key, val[key]);
} else {
node.style[key] = val[key];
}
}
}
}
// Benchmark for comparison (thanks preact): https://esbench.com/bench/574c954bdb965b9a00965ac6
} else if (key[0] === 'o' && key[1] === 'n') {
key = key.toLowerCase();
} else if (key[0] === 'o' && key[1] === 'n') {
key = key.toLowerCase();
if (key in node) {
node[key] = val;
}
} else if (val != null) {
if (typeof val !== 'boolean' || /^(ari|dat)a-/.test(key)) {
node.setAttribute(key, val);
} else if (val) {
node.setAttribute(key, '');
if (key in node) {
node[key] = val;
}
} else if (val != null) {
if (typeof val !== 'boolean' || /^(ari|dat)a-/.test(key)) {
node.setAttribute(key, val);
} else if (val) {
node.setAttribute(key, '');
} else {
node.removeAttribute(key);
}
} else {
node.removeAttribute(key);
}
} else {
node.removeAttribute(key);
}
}
}
appendChildren(
node.tagName === 'TEMPLATE' ? node.content : node,
props.children
);
appendChildren(
node.tagName === 'TEMPLATE' ? node.content : node,
props.children
);
// reuse `val` variable
val = props.ref;
// reuse `val` variable
val = props.ref;
if (val != null) {
if (typeof val === 'function') {
val(node);
} else {
val.current = node;
if (val != null) {
if (typeof val === 'function') {
val(node);
} else {
val.current = node;
}
}
return node;
}
return node;
};
export { Fragment, jsx, jsx as jsxs };

@@ -1,1 +0,1 @@

var e=function e(t,n){Array.isArray(n)?n.forEach((function(n){e(t,n)})):null!=n&&!1!==n&&t.appendChild(n.nodeType>0?n:document.createTextNode(n))},t=function(t){var n=document.createDocumentFragment();return e(n,t.children),n},n=new Map,r=new Set(["className","innerHTML","textContent","value","htmlFor"]),o=function(t,o){if("function"==typeof t)return t(o);if("_ex"!==t){var i,a="string"==typeof t?document.createElement(t):t;for(var s in o)if("ref"!==s&&"children"!==s)if(i=o[s],n.has(s))n.get(s)(a,i);else if(r.has(s))a[s]=i;else if("style"===s)if("string"==typeof i)a.style.cssText=i;else for(s in i)"-"===s[0]?a.style.setProperty(s,i[s]):a.style[s]=i[s];else"o"===s[0]&&"n"===s[1]?(s=s.toLowerCase())in a&&(a[s]=i):null!=i?"boolean"!=typeof i||/^(ari|dat)a-/.test(s)?a.setAttribute(s,i):i?a.setAttribute(s,""):a.removeAttribute(s):a.removeAttribute(s);return e("TEMPLATE"===a.tagName?a.content:a,o.children),null!=(i=o.ref)&&("function"==typeof i?i(a):i.current=a),a}for(var f in o)n.set(f,o[f])};export{t as Fragment,o as jsx,o as jsxs};
var e=function e(t,n){Array.isArray(n)?n.forEach((function(n){e(t,n)})):null!=n&&!1!==n&&t.appendChild(n.nodeType>0?n:document.createTextNode(n))},t=function(t){var n=document.createDocumentFragment();return e(n,t.children),n},n=new Map,r=new Set(["className","innerHTML","textContent","value","htmlFor"]),o=function(t,o){var i,s;if("function"==typeof t)return t(o);if("!"!==t){for(i in t="string"==typeof t?document.createElement(t):t,o)if("ref"!==i&&"children"!==i)if(s=o[i],n.has(i))n.get(i)(t,s);else if(r.has(i))t[i]=s;else if("style"===i)if("string"==typeof s)t.style.cssText=s;else for(i in s)"-"===i[0]?t.style.setProperty(i,s[i]):t.style[i]=s[i];else"o"===i[0]&&"n"===i[1]?(i=i.toLowerCase())in t&&(t[i]=s):null!=s?"boolean"!=typeof s||/^(ari|dat)a-/.test(i)?t.setAttribute(i,s):s?t.setAttribute(i,""):t.removeAttribute(i):t.removeAttribute(i);return e("TEMPLATE"===t.tagName?t.content:t,o.children),null!=(s=o.ref)&&("function"==typeof s?s(t):s.current=t),t}for(i in o)n.set(i,o[i])};export{t as Fragment,o as jsx,o as jsxs};
{
"name": "jsx-dom-runtime",
"version": "0.14.0",
"version": "0.14.1",
"description": "A tiny in 500 bytes library to JSX syntax templates for DOM",

@@ -20,28 +20,28 @@ "main": "dist/index.cjs.js",

"dependencies": {
"@babel/core": "^7.13.13",
"@babel/helper-plugin-utils": "^7.13.0",
"@babel/plugin-transform-react-jsx": "^7.13.12",
"csstype": "^3.0.7"
"@babel/core": "^7.14.5",
"@babel/helper-plugin-utils": "^7.14.5",
"@babel/plugin-transform-react-jsx": "^7.14.5",
"csstype": "^3.0.8"
},
"devDependencies": {
"@babel/preset-env": "^7.13.12",
"@babel/preset-typescript": "^7.13.0",
"@babel/preset-env": "^7.14.5",
"@babel/preset-typescript": "^7.14.5",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@size-limit/preset-small-lib": "^4.10.1",
"@testing-library/dom": "^7.30.1",
"@testing-library/jest-dom": "^5.11.10",
"@types/testing-library__jest-dom": "^5.9.5",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"babel-jest": "^26.6.3",
"eslint": "^7.23.0",
"fs-extra": "^9.1.0",
"husky": "^4.3.8",
"jest": "^26.6.3",
"rollup": "^2.43.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@size-limit/preset-small-lib": "^4.12.0",
"@testing-library/dom": "^7.31.2",
"@testing-library/jest-dom": "^5.14.1",
"@types/testing-library__jest-dom": "^5.14.0",
"@typescript-eslint/eslint-plugin": "^4.26.1",
"@typescript-eslint/parser": "^4.26.1",
"babel-jest": "^27.0.2",
"eslint": "^7.28.0",
"fs-extra": "^10.0.0",
"jest": "^27.0.4",
"rollup": "^2.51.2",
"rollup-plugin-terser": "^7.0.2",
"size-limit": "^4.10.1",
"typescript": "^4.2.3"
"simple-git-hooks": "^2.4.1",
"size-limit": "^4.12.0",
"typescript": "^4.3.2"
},

@@ -65,20 +65,18 @@ "files": [

"path": "jsx-runtime/jsxRuntime.esm.js",
"limit": "496 B"
"limit": "489 B"
},
{
"path": "jsx-runtime/jsxRuntime.cjs.js",
"limit": "482 B"
"limit": "472 B"
},
{
"path": "jsx-runtime/jsxRuntime.module.js",
"limit": "494 B"
"limit": "483 B"
}
],
"husky": {
"hooks": {
"pre-commit": "npm test"
}
"simple-git-hooks": {
"pre-commit": "npm test"
},
"engines": {
"node": "14",
"node": "16",
"npm": "7"

@@ -85,0 +83,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc