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.2.0 to 0.3.0

2

jsx-runtime/jsxRuntime.cjs.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=new Set(["innerHTML","innerText","textContent","value","htmlFor"]),t=function(e){return null==e},r=function(e){return"string"==typeof e},n=function(e){return"function"==typeof e},i=Array.isArray,s=document,o=function(e){return i(e)?e.filter(Boolean).join(" "):e},f=function e(r,n){if(!t(n)&&!1!==n)if(i(n))for(var o=0;n.length>o;)e(r,n[o++]);else r.appendChild("number"==typeof n.nodeType?n:s.createTextNode(n))},u=function(i,u){if(n(i))return i(u);var l=s.createElement(i),a=u.ref;for(var c in u){var p=u[c];if("ref"===c);else if("className"===c)l.setAttribute("class",o(p));else if("children"===c)f(l,p);else if(e.has(c)&&c in l)l[c]=p;else if("style"===c)if(r(p))l.style.cssText=p;else for(var v in p)l.style[v]=p[v];else if("o"===c[0]&&"n"===c[1]&&n(p)){var x=c.toLowerCase();x in l&&(l[x]=p)}else t(p)||l.setAttribute(c,String(p))}return t(a)||("current"in a?a.current=l:n(a)&&a(l)),l};exports.Fragment=function(e){var t=e.children,r=s.createDocumentFragment();return f(r,t),r},exports.jsx=u,exports.jsxs=u;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=new Set(["innerHTML","innerText","textContent","value","htmlFor"]),t=function(e){return null!=e},r=function(e){return"string"==typeof e},n=function(e){return"function"==typeof e},i=function(e){return"boolean"==typeof e},o=Array.isArray,s=document,f=function(e){return o(e)?e.filter(Boolean).join(" "):e},a=function e(r,n){if(t(n)&&!1!==n)if(o(n))for(var i=0;n.length>i;)e(r,n[i++]);else r.appendChild("number"==typeof n.nodeType?n:s.createTextNode(n))},u=function(o,u){if(n(o))return o(u);var l=s.createElement(o),c=u.ref;for(var p in u){var y=u[p];if("ref"===p);else if("className"===p)l.setAttribute("class",f(y));else if("children"===p)a(l,y);else if(e.has(p))l[p]=y;else if("style"===p)if(r(y))l.style.cssText=y;else for(var d in y)l.style[d]=y[d];else if("o"===p[0]&&"n"===p[1]){var v=p.toLowerCase();v in l&&(l[v]=y)}else i(y)&&!/^(aria|data)-/.test(p)?l[p]=y:t(y)&&l.setAttribute(p,""+y)}return t(c)&&("current"in c?c.current=l:n(c)&&c(l)),l};exports.Fragment=function(e){var t=s.createDocumentFragment();return a(t,e.children),t},exports.jsx=u,exports.jsxs=u;

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

let e=new Set(["innerHTML","innerText","textContent","value","htmlFor"]),t=e=>null==e,r=e=>"string"==typeof e,n=e=>"function"==typeof e,l=Array.isArray,i=document,s=e=>l(e)?e.filter(Boolean).join(" "):e,f=(e,r)=>{if(!t(r)&&!1!==r)if(l(r))for(let t=0;r.length>t;)f(e,r[t++]);else e.appendChild("number"==typeof r.nodeType?r:i.createTextNode(r))},o=({children:e})=>{let t=i.createDocumentFragment();return f(t,e),t},a=(l,o)=>{if(n(l))return l(o);let a=i.createElement(l),c=o.ref;for(let l in o){let i=o[l];if("ref"===l);else if("className"===l)a.setAttribute("class",s(i));else if("children"===l)f(a,i);else if(e.has(l)&&l in a)a[l]=i;else if("style"===l)if(r(i))a.style.cssText=i;else for(let e in i)a.style[e]=i[e];else if("o"===l[0]&&"n"===l[1]&&n(i)){let e=l.toLowerCase();e in a&&(a[e]=i)}else t(i)||a.setAttribute(l,String(i))}return t(c)||("current"in c?c.current=a:n(c)&&c(a)),a};export{o as Fragment,a as jsx,a as jsxs};
let e=new Set(["innerHTML","innerText","textContent","value","htmlFor"]),t=e=>null!=e,r=e=>"string"==typeof e,n=e=>"function"==typeof e,l=e=>"boolean"==typeof e,i=Array.isArray,s=document,o=e=>i(e)?e.filter(Boolean).join(" "):e,f=(e,r)=>{if(t(r)&&!1!==r)if(i(r))for(let t=0;r.length>t;)f(e,r[t++]);else e.appendChild("number"==typeof r.nodeType?r:s.createTextNode(r))},a=e=>{let t=s.createDocumentFragment();return f(t,e.children),t},c=(i,a)=>{if(n(i))return i(a);let c=s.createElement(i),u=a.ref;for(let n in a){let i=a[n];if("ref"===n);else if("className"===n)c.setAttribute("class",o(i));else if("children"===n)f(c,i);else if(e.has(n))c[n]=i;else if("style"===n)if(r(i))c.style.cssText=i;else for(let e in i)c.style[e]=i[e];else if("o"===n[0]&&"n"===n[1]){let e=n.toLowerCase();e in c&&(c[e]=i)}else l(i)&&!/^(aria|data)-/.test(n)?c[n]=i:t(i)&&c.setAttribute(n,""+i)}return t(u)&&("current"in u?u.current=c:n(u)&&u(c)),c};export{a as Fragment,c as jsx,c as jsxs};

@@ -9,6 +9,7 @@ let properties = new Set([

let isNil = (val) => val == null;
let isNotNil = (val) => val != null;
let isString = (val) => typeof val === 'string';
let isNumber = (val) => typeof val === 'number';
let isFunction = (val) => typeof val === 'function';
let isBoolean = (val) => typeof val === 'boolean';

@@ -23,3 +24,3 @@ let isArray = Array.isArray;

let appendChildren = (node, children) => {
if (!isNil(children) && children !== false) {
if (isNotNil(children) && children !== false) {
if (isArray(children)) {

@@ -39,6 +40,6 @@ for (let i = 0; children.length > i;) {

let Fragment = ({ children }) => {
let Fragment = (props) => {
let fragment = doc.createDocumentFragment();
appendChildren(fragment, children);
appendChildren(fragment, props.children);
return fragment;

@@ -62,3 +63,3 @@ };

appendChildren(node, val);
} else if (properties.has(key) && key in node) {
} else if (properties.has(key)) {
node[key] = val;

@@ -73,3 +74,4 @@ } else if (key === 'style') {

}
} else if (key[0] === 'o' && key[1] === 'n' && isFunction(val)) {
// Benchmark for comparison (thanks preact): https://esbench.com/bench/574c954bdb965b9a00965ac6
} else if (key[0] === 'o' && key[1] === 'n') {
let name = key.toLowerCase();

@@ -80,8 +82,10 @@

}
} else if (!isNil(val)) {
node.setAttribute(key, String(val));
} else if (isBoolean(val) && !/^(aria|data)-/.test(key)) {
node[key] = val;
} else if (isNotNil(val)) {
node.setAttribute(key, '' + val);
}
}
if (!isNil(ref)) {
if (isNotNil(ref)) {
if ('current' in ref) {

@@ -88,0 +92,0 @@ ref.current = node;

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

var e=new Set(["innerHTML","innerText","textContent","value","htmlFor"]),n=function(e){return null==e},t=function(e){return"string"==typeof e},r=function(e){return"function"==typeof e},i=Array.isArray,f=document,o=function(e){return i(e)?e.filter(Boolean).join(" "):e},s=function e(t,r){if(!n(r)&&!1!==r)if(i(r))for(var o=0;r.length>o;)e(t,r[o++]);else t.appendChild("number"==typeof r.nodeType?r:f.createTextNode(r))},l=function(e){var n=e.children,t=f.createDocumentFragment();return s(t,n),t},u=function(i,l){if(r(i))return i(l);var u=f.createElement(i),a=l.ref;for(var c in l){var v=l[c];if("ref"===c);else if("className"===c)u.setAttribute("class",o(v));else if("children"===c)s(u,v);else if(e.has(c)&&c in u)u[c]=v;else if("style"===c)if(t(v))u.style.cssText=v;else for(var y in v)u.style[y]=v[y];else if("o"===c[0]&&"n"===c[1]&&r(v)){var d=c.toLowerCase();d in u&&(u[d]=v)}else n(v)||u.setAttribute(c,String(v))}return n(a)||("current"in a?a.current=u:r(a)&&a(u)),u};export{l as Fragment,u as jsx,u as jsxs};
var e=new Set(["innerHTML","innerText","textContent","value","htmlFor"]),t=function(e){return null!=e},n=function(e){return"string"==typeof e},r=function(e){return"function"==typeof e},i=function(e){return"boolean"==typeof e},o=Array.isArray,f=document,a=function(e){return o(e)?e.filter(Boolean).join(" "):e},s=function e(n,r){if(t(r)&&!1!==r)if(o(r))for(var i=0;r.length>i;)e(n,r[i++]);else n.appendChild("number"==typeof r.nodeType?r:f.createTextNode(r))},u=function(e){var t=f.createDocumentFragment();return s(t,e.children),t},l=function(o,u){if(r(o))return o(u);var l=f.createElement(o),c=u.ref;for(var y in u){var v=u[y];if("ref"===y);else if("className"===y)l.setAttribute("class",a(v));else if("children"===y)s(l,v);else if(e.has(y))l[y]=v;else if("style"===y)if(n(v))l.style.cssText=v;else for(var d in v)l.style[d]=v[d];else if("o"===y[0]&&"n"===y[1]){var p=y.toLowerCase();p in l&&(l[p]=v)}else i(v)&&!/^(aria|data)-/.test(y)?l[y]=v:t(v)&&l.setAttribute(y,""+v)}return t(c)&&("current"in c?c.current=l:r(c)&&c(l)),l};export{u as Fragment,l as jsx,l as jsxs};
{
"name": "jsx-runtime",
"amdName": "jsxRuntime",
"version": "1.0.0",

@@ -5,0 +4,0 @@ "description": "JSX runtime",

{
"name": "jsx-dom-runtime",
"version": "0.2.0",
"version": "0.3.0",
"description": "JSX syntax for DOM Element",

@@ -13,3 +13,4 @@ "main": "jsx-runtime/jsxRuntime.cjs.js",

"pretest": "npm run build",
"posttest": "npm run lint"
"posttest": "npm run lint && size-limit",
"size": "npm run build && size-limit"
},

@@ -24,5 +25,5 @@ "dependencies": {

"@rollup/plugin-babel": "^5.3.0",
"@size-limit/preset-small-lib": "^4.10.1",
"@testing-library/dom": "^7.29.6",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/user-event": "^12.8.1",
"@types/testing-library__jest-dom": "^5.9.5",

@@ -38,2 +39,3 @@ "@typescript-eslint/eslint-plugin": "^4.16.1",

"rollup-plugin-terser": "^7.0.2",
"size-limit": "^4.10.1",
"typescript": "^4.2.3"

@@ -58,2 +60,16 @@ },

},
"size-limit": [
{
"path": "jsx-runtime/jsxRuntime.esm.js",
"limit": "495 B"
},
{
"path": "jsx-runtime/jsxRuntime.cjs.js",
"limit": "491 B"
},
{
"path": "jsx-runtime/jsxRuntime.module.js",
"limit": "502 B"
}
],
"engines": {

@@ -60,0 +76,0 @@ "node": "14",

@@ -9,6 +9,7 @@ let properties = new Set([

let isNil = (val) => val == null;
let isNotNil = (val) => val != null;
let isString = (val) => typeof val === 'string';
let isNumber = (val) => typeof val === 'number';
let isFunction = (val) => typeof val === 'function';
let isBoolean = (val) => typeof val === 'boolean';

@@ -23,3 +24,3 @@ let isArray = Array.isArray;

let appendChildren = (node, children) => {
if (!isNil(children) && children !== false) {
if (isNotNil(children) && children !== false) {
if (isArray(children)) {

@@ -39,6 +40,6 @@ for (let i = 0; children.length > i;) {

let Fragment = ({ children }) => {
let Fragment = (props) => {
let fragment = doc.createDocumentFragment();
appendChildren(fragment, children);
appendChildren(fragment, props.children);
return fragment;

@@ -64,3 +65,3 @@ };

appendChildren(node, val);
} else if (properties.has(key) && key in node) {
} else if (properties.has(key)) {
node[key] = val;

@@ -75,3 +76,4 @@ } else if (key === 'style') {

}
} else if (key[0] === 'o' && key[1] === 'n' && isFunction(val)) {
// Benchmark for comparison (thanks preact): https://esbench.com/bench/574c954bdb965b9a00965ac6
} else if (key[0] === 'o' && key[1] === 'n') {
let name = key.toLowerCase();

@@ -82,8 +84,10 @@

}
} else if (!isNil(val)) {
node.setAttribute(key, String(val));
} else if (isBoolean(val) && !/^(aria|data)-/.test(key)) {
node[key] = val;
} else if (isNotNil(val)) {
node.setAttribute(key, '' + val);
}
}
if (!isNil(ref)) {
if (isNotNil(ref)) {
if ('current' in ref) {

@@ -90,0 +94,0 @@ ref.current = node;

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