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.12.0 to 0.13.0

24

jsx-dev-runtime/index.js

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

let properties = new Set(['innerHTML', 'textContent', 'value', 'htmlFor']);
let properties = new Set(['className', 'innerHTML', 'textContent', 'value', 'htmlFor']);
let jsx = (el, props) => {

@@ -29,5 +29,3 @@ if (typeof el === 'function') {

if (key === 'className') {
node.setAttribute('class', Array.isArray(val) ? val.filter(Boolean).join(' ') : val);
} else if (properties.has(key)) {
if (properties.has(key)) {
node[key] = val;

@@ -158,3 +156,3 @@ } else if (key === 'style') {

const preciseType = getPreciseType(value);
return new PropTypeError(`Invalid prop \`${key}\` of type \`${preciseType}\`, expected "true", "false" or \`boolean\``, ['`boolean`', 'true', 'false']);
return new PropTypeError(`Invalid prop \`${key}\` of type \`${preciseType}\`, expected "true", "false" or \`boolean\``, ['"true", "false", `boolean`']);
});

@@ -170,4 +168,5 @@

const preciseType = String(value).slice(0, 100);
return new PropTypeError(`Invalid prop \`${key}\` of type "${preciseType}", expected one of "${list.join('", "')}"`, list);
const preciseType = getPreciseType(value);
const type = preciseType === 'string' ? `"${value}"` : `\`${preciseType}\``;
return new PropTypeError(`Invalid prop \`${key}\` of type ${type}, expected one of "${list.join('", "')}"`, [list.join('", "')]);
});

@@ -271,2 +270,3 @@ };

const contentEditable = T.oneOfType([T.booleanish, T.oneOf(['inherit'])]);
const element = {

@@ -280,3 +280,3 @@ accesskey: T.string,

class: T.string,
className: T.oneOfType([T.string, T.array]),
className: T.string,
style: T.oneOfType([T.string, T.object]),

@@ -286,2 +286,6 @@ tabindex: T.number,

hidden: T.bool,
spellCheck: T.oneOf(['true', 'false']),
spellcheck: T.oneOf(['true', 'false']),
contentEditable,
contenteditable: contentEditable,
textContent: T.string,

@@ -377,3 +381,5 @@ innerHTML: T.string

if (error != null) {
console.error(`<${tagName} ${key}=${printValue(value)}>\n\n`, `${error?.message}\n\n`, `at [${stack.lineNumber}:${stack.columnNumber}] - ${stack.fileName}`);
var _error;
console.error(`<${tagName} ${key}=${printValue(value)}>\n\n`, `${(_error = error) == null ? void 0 : _error.message}\n\n`, `at [${stack.lineNumber}:${stack.columnNumber}] - ${stack.fileName}`);
break;

@@ -380,0 +386,0 @@ }

@@ -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 Set(["innerHTML","textContent","value","htmlFor"]),r=function(r,n){if("function"==typeof r)return r(n);var o,i="string"==typeof r?document.createElement(r):r;for(var s in n)if("ref"!==s&&"children"!==s)if(o=n[s],"className"===s)i.setAttribute("class",Array.isArray(o)?o.filter(Boolean).join(" "):o);else if(t.has(s))i[s]=o;else if("style"===s)if("string"==typeof o)i.style.cssText=o;else for(s in o)"-"===s[0]?i.style.setProperty(s,o[s]):i.style[s]=o[s];else"o"===s[0]&&"n"===s[1]?(s=s.toLowerCase())in i&&(i[s]=o):null!=o?"boolean"!=typeof o||/^(ari|dat)a-/.test(s)?i.setAttribute(s,o):o?i.setAttribute(s,""):i.removeAttribute(s):i.removeAttribute(s);return e("TEMPLATE"===i.tagName?i.content:i,n.children),null!=(o=n.ref)&&("function"==typeof o?o(i):o.current=i),i};exports.Fragment=function(t){var r=document.createDocumentFragment();return e(r,t.children),r},exports.jsx=r,exports.jsxs=r;
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 Set(["className","innerHTML","textContent","value","htmlFor"]),r=function(r,n){if("function"==typeof r)return r(n);var o,i="string"==typeof r?document.createElement(r):r;for(var s in n)if("ref"!==s&&"children"!==s)if(o=n[s],t.has(s))i[s]=o;else if("style"===s)if("string"==typeof o)i.style.cssText=o;else for(s in o)"-"===s[0]?i.style.setProperty(s,o[s]):i.style[s]=o[s];else"o"===s[0]&&"n"===s[1]?(s=s.toLowerCase())in i&&(i[s]=o):null!=o?"boolean"!=typeof o||/^(ari|dat)a-/.test(s)?i.setAttribute(s,o):o?i.setAttribute(s,""):i.removeAttribute(s):i.removeAttribute(s);return e("TEMPLATE"===i.tagName?i.content:i,n.children),null!=(o=n.ref)&&("function"==typeof o?o(i):o.current=i),i};exports.Fragment=function(t){var r=document.createDocumentFragment();return e(r,t.children),r},exports.jsx=r,exports.jsxs=r;

@@ -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 Set(["innerHTML","textContent","value","htmlFor"]),n=(t,n)=>{if("function"==typeof t)return t(n);let o,l="string"==typeof t?document.createElement(t):t;for(let e in n)if("ref"!==e&&"children"!==e)if(o=n[e],"className"===e)l.setAttribute("class",Array.isArray(o)?o.filter(Boolean).join(" "):o);else if(r.has(e))l[e]=o;else if("style"===e)if("string"==typeof o)l.style.cssText=o;else for(e in o)"-"===e[0]?l.style.setProperty(e,o[e]):l.style[e]=o[e];else"o"===e[0]&&"n"===e[1]?(e=e.toLowerCase(),e in l&&(l[e]=o)):null!=o?"boolean"!=typeof o||/^(ari|dat)a-/.test(e)?l.setAttribute(e,o):o?l.setAttribute(e,""):l.removeAttribute(e):l.removeAttribute(e);return e("TEMPLATE"===l.tagName?l.content:l,n.children),o=n.ref,null!=o&&("function"==typeof o?o(l):o.current=l),l};export{t as Fragment,n as jsx,n 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 Set(["className","innerHTML","textContent","value","htmlFor"]),n=(t,n)=>{if("function"==typeof t)return t(n);let o,l="string"==typeof t?document.createElement(t):t;for(let e in n)if("ref"!==e&&"children"!==e)if(o=n[e],r.has(e))l[e]=o;else if("style"===e)if("string"==typeof o)l.style.cssText=o;else for(e in o)"-"===e[0]?l.style.setProperty(e,o[e]):l.style[e]=o[e];else"o"===e[0]&&"n"===e[1]?(e=e.toLowerCase(),e in l&&(l[e]=o)):null!=o?"boolean"!=typeof o||/^(ari|dat)a-/.test(e)?l.setAttribute(e,o):o?l.setAttribute(e,""):l.removeAttribute(e):l.removeAttribute(e);return e("TEMPLATE"===l.tagName?l.content:l,n.children),o=n.ref,null!=o&&("function"==typeof o?o(l):o.current=l),l};export{t as Fragment,n as jsx,n as jsxs};

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

let properties = new Set([
'className',
'innerHTML',

@@ -42,10 +43,3 @@ 'textContent',

if (key === 'className') {
node.setAttribute(
'class',
Array.isArray(val)
? val.filter(Boolean).join(' ')
: val
);
} else if (properties.has(key)) {
if (properties.has(key)) {
node[key] = val;

@@ -52,0 +46,0 @@ } else if (key === 'style') {

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

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=function(t){var r=document.createDocumentFragment();return e(r,t.children),r},r=new Set(["innerHTML","textContent","value","htmlFor"]),n=function(t,n){if("function"==typeof t)return t(n);var o,i="string"==typeof t?document.createElement(t):t;for(var a in n)if("ref"!==a&&"children"!==a)if(o=n[a],"className"===a)i.setAttribute("class",Array.isArray(o)?o.filter(Boolean).join(" "):o);else if(r.has(a))i[a]=o;else if("style"===a)if("string"==typeof o)i.style.cssText=o;else for(a in o)"-"===a[0]?i.style.setProperty(a,o[a]):i.style[a]=o[a];else"o"===a[0]&&"n"===a[1]?(a=a.toLowerCase())in i&&(i[a]=o):null!=o?"boolean"!=typeof o||/^(ari|dat)a-/.test(a)?i.setAttribute(a,o):o?i.setAttribute(a,""):i.removeAttribute(a):i.removeAttribute(a);return e("TEMPLATE"===i.tagName?i.content:i,n.children),null!=(o=n.ref)&&("function"==typeof o?o(i):o.current=i),i};export{t as Fragment,n as jsx,n 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 Set(["className","innerHTML","textContent","value","htmlFor"]),r=function(t,r){if("function"==typeof t)return t(r);var o,i="string"==typeof t?document.createElement(t):t;for(var a in r)if("ref"!==a&&"children"!==a)if(o=r[a],n.has(a))i[a]=o;else if("style"===a)if("string"==typeof o)i.style.cssText=o;else for(a in o)"-"===a[0]?i.style.setProperty(a,o[a]):i.style[a]=o[a];else"o"===a[0]&&"n"===a[1]?(a=a.toLowerCase())in i&&(i[a]=o):null!=o?"boolean"!=typeof o||/^(ari|dat)a-/.test(a)?i.setAttribute(a,o):o?i.setAttribute(a,""):i.removeAttribute(a):i.removeAttribute(a);return e("TEMPLATE"===i.tagName?i.content:i,r.children),null!=(o=r.ref)&&("function"==typeof o?o(i):o.current=i),i};export{t as Fragment,r as jsx,r as jsxs};
{
"name": "jsx-dom-runtime",
"version": "0.12.0",
"version": "0.13.0",
"description": "A tiny in 500 bytes library to JSX syntax templates for DOM",

@@ -22,7 +22,7 @@ "main": "dist/index.cjs.js",

"@babel/helper-plugin-utils": "^7.13.0",
"@babel/plugin-transform-react-jsx": "^7.12.17",
"@babel/plugin-transform-react-jsx": "^7.13.12",
"csstype": "^3.0.7"
},
"devDependencies": {
"@babel/preset-env": "^7.13.10",
"@babel/preset-env": "^7.13.12",
"@babel/preset-typescript": "^7.13.0",

@@ -33,7 +33,7 @@ "@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/dom": "^7.30.1",
"@testing-library/jest-dom": "^5.11.10",
"@types/testing-library__jest-dom": "^5.9.5",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@typescript-eslint/eslint-plugin": "^4.19.0",
"@typescript-eslint/parser": "^4.19.0",
"babel-jest": "^26.6.3",

@@ -44,3 +44,3 @@ "eslint": "^7.22.0",

"jest": "^26.6.3",
"rollup": "^2.42.2",
"rollup": "^2.42.4",
"rollup-plugin-terser": "^7.0.2",

@@ -67,11 +67,11 @@ "size-limit": "^4.10.1",

"path": "jsx-runtime/jsxRuntime.esm.js",
"limit": "491 B"
"limit": "458 B"
},
{
"path": "jsx-runtime/jsxRuntime.cjs.js",
"limit": "475 B"
"limit": "439 B"
},
{
"path": "jsx-runtime/jsxRuntime.module.js",
"limit": "483 B"
"limit": "454 B"
}

@@ -78,0 +78,0 @@ ],

@@ -130,3 +130,3 @@ # jsx-dom-runtime

<document.body>
<p ref={bindRef(ref, callback, ready /*...*/)} />
<p ref={bindRef(ref, callback, ready /*,...*/)} />
</document.body>;

@@ -133,0 +133,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