Comparing version 2.1.0 to 2.1.1
@@ -1,1 +0,1 @@ | ||
!function(){var n=function(t,e,r,u){for(var o=1;o<e.length;o++){var f=e[o++],s="number"==typeof f?r[f]:f;1===e[o]?u[0]=s:2===e[o]?(u[1]=u[1]||{})[e[++o]]=s:3===e[o]?u[1]=Object.assign(u[1]||{},s):u.push(e[o]?t.apply(null,n(t,s,r,["",null])):s)}return u},t=function(n){for(var t,e,r=1,u="",o="",f=[0],s=function(n){1===r&&(n||(u=u.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?f.push(n||u,0):3===r&&(n||u)?(f.push(n||u,1),r=2):2===r&&"..."===u&&n?f.push(n,3):2===r&&u&&!n?f.push(!0,2,u):4===r&&e&&(f.push(n||u,2,e),e=""),u=""},p=0;p<n.length;p++){p&&(1===r&&s(),s(p));for(var h=0;h<n[p].length;h++)t=n[p][h],1===r?"<"===t?(s(),f=[f],r=3):u+=t:o?t===o?o="":u+=t:'"'===t||"'"===t?o=t:">"===t?(s(),r=1):r&&("="===t?(r=4,e=u,u=""):"/"===t?(s(),3===r&&(f=f[0]),r=f,(f=f[0]).push(r,4),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(s(),r=2):u+=t)}return s(),f},e="function"==typeof Map,r=e?new Map:{},u=e?function(n){var e=r.get(n);return e||r.set(n,e=t(n)),e}:function(n){for(var e="",u=0;u<n.length;u++)e+=n[u].length+"-"+n[u];return r[e]||(r[e]=t(n))},o=function(t){var e=n(this,u(t),arguments,[]);return e.length>1?e:e[0]};"undefined"!=typeof module?module.exports=o:self.htm=o}(); | ||
!function(){var n=function(n){for(var e,l,s=arguments,t=1,u="",r="",o=[0],f=function(n){1===t&&(n||(u=u.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?o.push(n?s[n]:u):3===t&&(n||u)?(o[1]=n?s[n]:u,t=2):2===t&&"..."===u&&n?o[2]=Object.assign(o[2]||{},s[n]):2===t&&u&&!n?(o[2]=o[2]||{})[u]=!0:4===t&&l&&((o[2]=o[2]||{})[l]=n?s[n]:u,l=""),u=""},i=0;i<n.length;i++){i&&(1===t&&f(),f(i));for(var c=0;c<n[i].length;c++)e=n[i][c],1===t?"<"===e?(f(),o=[o,"",null],t=3):u+=e:r?e===r?r="":u+=e:'"'===e||"'"===e?r=e:">"===e?(f(),t=1):t&&("="===e?(t=4,l=u,u=""):"/"===e?(f(),3===t&&(o=o[0]),t=o,(o=o[0]).push(this.apply(null,t.slice(1))),t=0):" "===e||"\t"===e||"\n"===e||"\r"===e?(f(),t=2):u+=e)}return f(),o.length>2?o.slice(1):o[1]};"undefined"!=typeof module?module.exports=n:self.htm=n}(); |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):n.htm=e()}(this,function(){var n=function(e,t,r,u){for(var o=1;o<t.length;o++){var f=t[o++],p="number"==typeof f?r[f]:f;1===t[o]?u[0]=p:2===t[o]?(u[1]=u[1]||{})[t[++o]]=p:3===t[o]?u[1]=Object.assign(u[1]||{},p):u.push(t[o]?e.apply(null,n(e,p,r,["",null])):p)}return u},e=function(n){for(var e,t,r=1,u="",o="",f=[0],p=function(n){1===r&&(n||(u=u.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?f.push(n||u,0):3===r&&(n||u)?(f.push(n||u,1),r=2):2===r&&"..."===u&&n?f.push(n,3):2===r&&u&&!n?f.push(!0,2,u):4===r&&t&&(f.push(n||u,2,t),t=""),u=""},s=0;s<n.length;s++){s&&(1===r&&p(),p(s));for(var i=0;i<n[s].length;i++)e=n[s][i],1===r?"<"===e?(p(),f=[f],r=3):u+=e:o?e===o?o="":u+=e:'"'===e||"'"===e?o=e:">"===e?(p(),r=1):r&&("="===e?(r=4,t=u,u=""):"/"===e?(p(),3===r&&(f=f[0]),r=f,(f=f[0]).push(r,4),r=0):" "===e||"\t"===e||"\n"===e||"\r"===e?(p(),r=2):u+=e)}return p(),f},t="function"==typeof Map,r=t?new Map:{},u=t?function(n){var t=r.get(n);return t||r.set(n,t=e(n)),t}:function(n){for(var t="",u=0;u<n.length;u++)t+=n[u].length+"-"+n[u];return r[t]||(r[t]=e(n))};return function(e){var t=n(this,u(e),arguments,[]);return t.length>1?t:t[0]}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.htm=n()}(this,function(){return function(e){for(var n,t,o=arguments,f=1,i="",s="",u=[0],l=function(e){1===f&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?u.push(e?o[e]:i):3===f&&(e||i)?(u[1]=e?o[e]:i,f=2):2===f&&"..."===i&&e?u[2]=Object.assign(u[2]||{},o[e]):2===f&&i&&!e?(u[2]=u[2]||{})[i]=!0:4===f&&t&&((u[2]=u[2]||{})[t]=e?o[e]:i,t=""),i=""},r=0;r<e.length;r++){r&&(1===f&&l(),l(r));for(var c=0;c<e[r].length;c++)n=e[r][c],1===f?"<"===n?(l(),u=[u,"",null],f=3):i+=n:s?n===s?s="":i+=n:'"'===n||"'"===n?s=n:">"===n?(l(),f=1):f&&("="===n?(f=4,t=i,i=""):"/"===n?(l(),3===f&&(u=u[0]),f=u,(u=u[0]).push(this.apply(null,f.slice(1))),f=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(l(),f=2):i+=n)}return l(),u.length>2?u.slice(1):u[1]}}); |
{ | ||
"name": "htm", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "The Tagged Template syntax for Virtual DOM. Only browser-compatible syntax.", | ||
@@ -9,6 +9,7 @@ "main": "dist/htm.js", | ||
"scripts": { | ||
"build": "npm run -s build:main && npm run -s build:mini && npm run -s build:preact && npm run -s build:babel && npm run -s build:babel-transform-jsx", | ||
"build": "npm run -s build:main && npm run -s build:mini && npm run -s build:preact && npm run -s build:react && npm run -s build:babel && npm run -s build:babel-transform-jsx", | ||
"build:main": "microbundle src/index.mjs -f es,umd --no-sourcemap --target web && microbundle src/cjs.mjs -f iife --no-sourcemap --target web", | ||
"build:mini": "microbundle src/index.mjs -o ./mini/index.js -f es,umd --no-sourcemap --target web --alias ./constants=./constants-mini && microbundle src/cjs.mjs -o ./mini/index.js -f iife --no-sourcemap --target web --alias ./constants=./constants-mini", | ||
"build:mini": "microbundle src/index.mjs -o ./mini/index.js -f es,umd --no-sourcemap --target web --alias ./constants.mjs=./constants-mini.mjs && microbundle src/cjs.mjs -o ./mini/index.js -f iife --no-sourcemap --target web --alias ./constants.mjs=./constants-mini.mjs", | ||
"build:preact": "cd src/integrations/preact && npm run build", | ||
"build:react": "cd src/integrations/react && npm run build", | ||
"build:babel": "cd packages/babel-plugin-htm && npm run build", | ||
@@ -24,2 +25,3 @@ "build:babel-transform-jsx": "cd packages/babel-plugin-transform-jsx-to-htm && npm run build", | ||
"preact", | ||
"react", | ||
"src" | ||
@@ -79,3 +81,4 @@ ], | ||
"microbundle": "^0.10.1", | ||
"preact": "^8.4.2" | ||
"preact": "^8.4.2", | ||
"react": "^16.8.3" | ||
}, | ||
@@ -82,0 +85,0 @@ "dependencies": {}, |
@@ -18,9 +18,11 @@ | ||
🐣 **< 700 bytes** when used directly in the browser | ||
🐣 **< 600 bytes** when used directly in the browser | ||
⚛️ **< 500 bytes** when used with Preact _(thanks gzip 🌈)_ | ||
🏅 **0 bytes** when compiled using [babel-plugin-htm] | ||
🥚 **< 400 byte** `htm/mini` version | ||
🏅 **0 bytes** if compiled using [babel-plugin-htm] | ||
## Syntax: like JSX but also lit | ||
@@ -46,2 +48,3 @@ | ||
- Syntax highlighting and language support via the [lit-html VSCode extension] and [vim-jsx-pretty plugin]. | ||
- Multiple root element (fragments): `<div /><div />` | ||
@@ -112,2 +115,24 @@ ## Installation | ||
If the template has multiple element at the root level | ||
the output is an array of `h` results: | ||
```js | ||
console.log(html` | ||
<h1 id=hello>Hello</h1> | ||
<div class=world>World!</div> | ||
`); | ||
// [ | ||
// { | ||
// type: 'h1', | ||
// props: { id: 'hello' }, | ||
// children: ['Hello'] | ||
// }, | ||
// { | ||
// type: 'div', | ||
// props: { class: 'world' }, | ||
// children: ['world!'] | ||
// } | ||
// ] | ||
``` | ||
## Example | ||
@@ -146,3 +171,3 @@ | ||
} | ||
const Header = ({ name }) => html`<h1>${name} List</h1>` | ||
@@ -220,3 +245,3 @@ | ||
As of 2.0.0, `htm` is stable, well-tested and ready for production use. | ||
As of 2.1.0, `htm` is stable, well-tested and ready for production use. | ||
@@ -223,0 +248,0 @@ [Tagged Templates]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_templates |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
57531
30
375
252
10
1