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

literaljs

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

literaljs - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

2

build/index.js

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

var e=function(e,o,d){void 0===d&&(d={}),n(d),window.addEventListener("DOMContentLoaded",function(){var n=document.getElementById(o);t(e,n);var d=r(e(),window.__LITERAL_STORE__),c=i(d);n.appendChild(c)})},n=function(e){return window.__LITERAL_STORE__=e},t=function(e,n){window.addEventListener("__LITERAL_UPDATE__",function(t){return Promise.all([r(e(),t.detail.oldState),r(e(),t.detail.newState)]).then(function(e){return l(n,e[1],e[0])})})},r=function(e,n){if((e="function"==typeof e?e(n):e).children)for(var t=0;t<e.children.length;t++)e.children[t]=r(e.children[t],n);return e},i=function(e){var n=document.createElement(e.element);!function(e){var n=new MutationObserver(function(e){for(var n=0;n<e.length;n++)"childList"===e[n].type&&Promise.all([t("mounted",e[n].addedNodes),t("unmounted",e[n].removedNodes)])}),t=function(e,n){for(var t=0;t<n.length;t++){var r=new CustomEvent(e);n[t].dispatchEvent(r)}};n.observe(e,{childList:!0})}(n);for(var t=0,r=Object.entries(e);t<r.length;t+=1){var c=r[t],a=c[0],u=c[1];if("text"===a&&o(u,n),"events"===a&&d(u,n),"children"===a)for(var l=0;l<u.length;l++)n.appendChild(i(u[l]));["children","element","text","events"].includes(a)||n.setAttribute(a,u)}return n},o=function(e,n){var t=document.createTextNode(e);n.appendChild(t)},d=function(e,n){if(e instanceof Array)for(var t=0;t<e.length;t++)n.addEventListener(e[t].type,e[t].action);else e instanceof Object&&n.addEventListener(e.type,e.action)},c=function(e){return void 0===e&&(e=window.__LITERAL_STORE__),Object.assign({},e)},a=function(e){var n=c(),t=Object.assign({},n,e);window.__LITERAL_STORE__=t;var r=new CustomEvent("__LITERAL_UPDATE__",{detail:{newState:t,oldState:n}});return window.dispatchEvent(r)},u=function(e){void 0===e&&(e={});var n=e.methods;void 0===n&&(n=function(){});var t=e.render;return void 0===t&&(t=function(){}),function(e){void 0===e&&(e={});var r=e.props;return void 0===r&&(r={}),function(e){return t({getState:function(){return c(e)},setState:a,props:r,methods:n({getState:function(){return c()},setState:a})})}}},l=function(e,n,t,r){void 0===r&&(r=0);var o=e.children[r];!t&&n?!1===t?e.insertBefore(i(n),o):void 0===t&&e.appendChild(i(n)):!n&&t?e.removeChild(o):n&&(Promise.all([h(o,n,t),s(e,o,n,t)]),(n.children||t.children)&&Promise.all([v(n.children,t.children),v(t.children,n.children)]).then(function(e){for(var n=e[0],t=e[1],r=0;r<f(n,t);r++)l(o,n[r],t[r],r)}))},v=function(e,n){return e.filter(function(e,t){return!1!==e||!1!==n[t]})},f=function(e,n){var t=e.length,r=n.length;return t>=r?t:r},s=function(e,n,t,r){for(var o=0,d=Object.entries(t);o<d.length;o+=1){var c=d[o],a=c[0],u=c[1],l=r[a];"element"===a||"text"===a?u!==l&&e.replaceChild(i(t),n):["children","events","element","text"].includes(a)||l&&u===l||n.setAttribute(name,value)}},h=function(e,n,t){for(var r=0,i=Object.entries(t);r<i.length;r+=1){var o=i[r];n[o[0]]||e.removeAttribute(o[1])}},_={component:u,render:e};exports.render=e,exports.component=u,exports.default=_;
var e={},t=[],n=function(t){return e=Object.assign({},e,t)},r=function(e,n){window.addEventListener("__LITERAL_UPDATE__",function(){var r=t.pop();i(e,n,{oldState:r.oldState,newState:r.newState})})},i=function(e,t,n){var r=o(t(),n.oldState),i=o(t(),n.newState);return f(e,i,r)},o=function(e,t){if((e="function"==typeof e?e(t):e).children)for(var n=0;n<e.children.length;n++)e.children[n]=o(e.children[n],t);return e},d=function(e){var t=new MutationObserver(function(e){for(var t=0;t<e.length;t++)"childList"===e[t].type&&(n("mounted",e[t].addedNodes),n("unmounted",e[t].removedNodes))}),n=function(e,t){for(var n=0;n<t.length;n++){var r=new CustomEvent(e);t[n].dispatchEvent(r)}};t.observe(e,{childList:!0})},c=function(e){for(var t=document.createElement(e.element),n=0,r=Object.entries(e);n<r.length;n+=1){var i=r[n],o=i[0],d=i[1];if("text"===o&&a(d,t),"events"===o&&u(d,t),["children","element","text","events"].includes(o)||t.setAttribute(o,d),"children"===o)for(var l=0;l<d.length;l++)t.appendChild(c(d[l]))}return t},a=function(e,t){var n=document.createTextNode(e);t.appendChild(n)},u=function(e,t){if(e instanceof Array)for(var n=0;n<e.length;n++)["mounted","unmounted"].includes(e[n].type)&&d(newNode),t.addEventListener(e[n].type,e[n].action);else e instanceof Object&&(["mounted","unmounted"].includes(e.type)&&d(newNode),t.addEventListener(e.type,e.action))},l=function(t){return void 0===t&&(t=e),Object.assign({},t)},v=function(n){var r=l(),i={oldState:r,nextState:Object.assign({},r,n)};e=i.nextState,t.push(i);var o=new Event("__LITERAL_UPDATE__");return window.dispatchEvent(o)},f=function(e,t,n,r){void 0===r&&(r=0);var i=e.children[r];if(!n&&t)!1===n?e.insertBefore(c(t),i):void 0===n&&e.appendChild(c(t));else if(!t&&n)e.removeChild(i);else if(t&&(m(i,t,n),p(e,i,t,n),t.children||n.children))for(var o=s(t.children,n.children),d=s(n.children,t.children),a=0;a<h(o,d);a++)f(i,o[a],d[a],a)},s=function(e,t){for(var n=[],r=0;r<e.length;r++)!1===e[r]&&!1===t[r]||n.push(e[r]);return n},h=function(e,t){var n=e.length,r=t.length;return n>=r?n:r},p=function(e,t,n,r){for(var i=0,o=Object.entries(n);i<o.length;i+=1){var d=o[i],a=d[0],u=d[1],l=r[a];"element"===a||"text"===a?u!==l&&e.replaceChild(c(n),t):["children","events","element","text"].includes(a)||l&&u===l||t.setAttribute(name,value)}},m=function(e,t,n){for(var r=0,i=Object.entries(n);r<i.length;r+=1){var o=i[r];t[o[0]]||e.removeAttribute(o[1])}};module.exports={component:function(e){void 0===e&&(e={});var t=e.methods;void 0===t&&(t=function(){});var n=e.render;return void 0===n&&(n=function(){}),function(e){void 0===e&&(e={});var r=e.props;return void 0===r&&(r={}),function(e){return n({getState:function(){return l(e)},setState:v,props:r,methods:t({getState:function(){return l()},setState:v})})}}},render:function(t,i,d){void 0===d&&(d={});var a=document.getElementById(i);n(d),r(a,t);var u=o(t(),e),l=c(u);a.appendChild(l)}};
//# sourceMappingURL=index.js.map

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

var e=function(e,o,d){void 0===d&&(d={}),n(d),window.addEventListener("DOMContentLoaded",function(){var n=document.getElementById(o);t(e,n);var d=r(e(),window.__LITERAL_STORE__),a=i(d);n.appendChild(a)})},n=function(e){return window.__LITERAL_STORE__=e},t=function(e,n){window.addEventListener("__LITERAL_UPDATE__",function(t){return Promise.all([r(e(),t.detail.oldState),r(e(),t.detail.newState)]).then(function(e){return l(n,e[1],e[0])})})},r=function(e,n){if((e="function"==typeof e?e(n):e).children)for(var t=0;t<e.children.length;t++)e.children[t]=r(e.children[t],n);return e},i=function(e){var n=document.createElement(e.element);!function(e){var n=new MutationObserver(function(e){for(var n=0;n<e.length;n++)"childList"===e[n].type&&Promise.all([t("mounted",e[n].addedNodes),t("unmounted",e[n].removedNodes)])}),t=function(e,n){for(var t=0;t<n.length;t++){var r=new CustomEvent(e);n[t].dispatchEvent(r)}};n.observe(e,{childList:!0})}(n);for(var t=0,r=Object.entries(e);t<r.length;t+=1){var a=r[t],c=a[0],u=a[1];if("text"===c&&o(u,n),"events"===c&&d(u,n),"children"===c)for(var l=0;l<u.length;l++)n.appendChild(i(u[l]));["children","element","text","events"].includes(c)||n.setAttribute(c,u)}return n},o=function(e,n){var t=document.createTextNode(e);n.appendChild(t)},d=function(e,n){if(e instanceof Array)for(var t=0;t<e.length;t++)n.addEventListener(e[t].type,e[t].action);else e instanceof Object&&n.addEventListener(e.type,e.action)},a=function(e){return void 0===e&&(e=window.__LITERAL_STORE__),Object.assign({},e)},c=function(e){var n=a(),t=Object.assign({},n,e);window.__LITERAL_STORE__=t;var r=new CustomEvent("__LITERAL_UPDATE__",{detail:{newState:t,oldState:n}});return window.dispatchEvent(r)},u=function(e){void 0===e&&(e={});var n=e.methods;void 0===n&&(n=function(){});var t=e.render;return void 0===t&&(t=function(){}),function(e){void 0===e&&(e={});var r=e.props;return void 0===r&&(r={}),function(e){return t({getState:function(){return a(e)},setState:c,props:r,methods:n({getState:function(){return a()},setState:c})})}}},l=function(e,n,t,r){void 0===r&&(r=0);var o=e.children[r];!t&&n?!1===t?e.insertBefore(i(n),o):void 0===t&&e.appendChild(i(n)):!n&&t?e.removeChild(o):n&&(Promise.all([h(o,n,t),s(e,o,n,t)]),(n.children||t.children)&&Promise.all([v(n.children,t.children),v(t.children,n.children)]).then(function(e){for(var n=e[0],t=e[1],r=0;r<f(n,t);r++)l(o,n[r],t[r],r)}))},v=function(e,n){return e.filter(function(e,t){return!1!==e||!1!==n[t]})},f=function(e,n){var t=e.length,r=n.length;return t>=r?t:r},s=function(e,n,t,r){for(var o=0,d=Object.entries(t);o<d.length;o+=1){var a=d[o],c=a[0],u=a[1],l=r[c];"element"===c||"text"===c?u!==l&&e.replaceChild(i(t),n):["children","events","element","text"].includes(c)||l&&u===l||n.setAttribute(name,value)}},h=function(e,n,t){for(var r=0,i=Object.entries(t);r<i.length;r+=1){var o=i[r];n[o[0]]||e.removeAttribute(o[1])}};export default{component:u,render:e};export{e as render,u as component};
var e={},t=[],n=function(t,n,o){void 0===o&&(o={});var c=document.getElementById(n);r(o),i(c,t);var u=d(t(),e),l=a(u);c.appendChild(l)},r=function(t){return e=Object.assign({},e,t)},i=function(e,n){window.addEventListener("__LITERAL_UPDATE__",function(){var r=t.pop();o(e,n,{oldState:r.oldState,newState:r.newState})})},o=function(e,t,n){var r=d(t(),n.oldState),i=d(t(),n.newState);return h(e,i,r)},d=function(e,t){if((e="function"==typeof e?e(t):e).children)for(var n=0;n<e.children.length;n++)e.children[n]=d(e.children[n],t);return e},c=function(e){var t=new MutationObserver(function(e){for(var t=0;t<e.length;t++)"childList"===e[t].type&&(n("mounted",e[t].addedNodes),n("unmounted",e[t].removedNodes))}),n=function(e,t){for(var n=0;n<t.length;n++){var r=new CustomEvent(e);t[n].dispatchEvent(r)}};t.observe(e,{childList:!0})},a=function(e){for(var t=document.createElement(e.element),n=0,r=Object.entries(e);n<r.length;n+=1){var i=r[n],o=i[0],d=i[1];if("text"===o&&u(d,t),"events"===o&&l(d,t),["children","element","text","events"].includes(o)||t.setAttribute(o,d),"children"===o)for(var c=0;c<d.length;c++)t.appendChild(a(d[c]))}return t},u=function(e,t){var n=document.createTextNode(e);t.appendChild(n)},l=function(e,t){if(e instanceof Array)for(var n=0;n<e.length;n++)["mounted","unmounted"].includes(e[n].type)&&c(newNode),t.addEventListener(e[n].type,e[n].action);else e instanceof Object&&(["mounted","unmounted"].includes(e.type)&&c(newNode),t.addEventListener(e.type,e.action))},v=function(t){return void 0===t&&(t=e),Object.assign({},t)},f=function(n){var r=v(),i={oldState:r,nextState:Object.assign({},r,n)};e=i.nextState,t.push(i);var o=new Event("__LITERAL_UPDATE__");return window.dispatchEvent(o)},s=function(e){void 0===e&&(e={});var t=e.methods;void 0===t&&(t=function(){});var n=e.render;return void 0===n&&(n=function(){}),function(e){void 0===e&&(e={});var r=e.props;return void 0===r&&(r={}),function(e){return n({getState:function(){return v(e)},setState:f,props:r,methods:t({getState:function(){return v()},setState:f})})}}},h=function(e,t,n,r){void 0===r&&(r=0);var i=e.children[r];if(!n&&t)!1===n?e.insertBefore(a(t),i):void 0===n&&e.appendChild(a(t));else if(!t&&n)e.removeChild(i);else if(t&&(E(i,t,n),g(e,i,t,n),t.children||n.children))for(var o=p(t.children,n.children),d=p(n.children,t.children),c=0;c<m(o,d);c++)h(i,o[c],d[c],c)},p=function(e,t){for(var n=[],r=0;r<e.length;r++)!1===e[r]&&!1===t[r]||n.push(e[r]);return n},m=function(e,t){var n=e.length,r=t.length;return n>=r?n:r},g=function(e,t,n,r){for(var i=0,o=Object.entries(n);i<o.length;i+=1){var d=o[i],c=d[0],u=d[1],l=r[c];"element"===c||"text"===c?u!==l&&e.replaceChild(a(n),t):["children","events","element","text"].includes(c)||l&&u===l||t.setAttribute(name,value)}},E=function(e,t,n){for(var r=0,i=Object.entries(n);r<i.length;r+=1){var o=i[r];t[o[0]]||e.removeAttribute(o[1])}};export default{component:s,render:n};export{n as render,s as component};
//# sourceMappingURL=index.m.js.map

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.literaljs={})}(this,function(e){var n=function(e,n,d){void 0===d&&(d={}),t(d),window.addEventListener("DOMContentLoaded",function(){var t=document.getElementById(n);r(e,t);var d=i(e(),window.__LITERAL_STORE__),c=o(d);t.appendChild(c)})},t=function(e){return window.__LITERAL_STORE__=e},r=function(e,n){window.addEventListener("__LITERAL_UPDATE__",function(t){return Promise.all([i(e(),t.detail.oldState),i(e(),t.detail.newState)]).then(function(e){return f(n,e[1],e[0])})})},i=function(e,n){if((e="function"==typeof e?e(n):e).children)for(var t=0;t<e.children.length;t++)e.children[t]=i(e.children[t],n);return e},o=function(e){var n=document.createElement(e.element);!function(e){var n=new MutationObserver(function(e){for(var n=0;n<e.length;n++)"childList"===e[n].type&&Promise.all([t("mounted",e[n].addedNodes),t("unmounted",e[n].removedNodes)])}),t=function(e,n){for(var t=0;t<n.length;t++){var r=new CustomEvent(e);n[t].dispatchEvent(r)}};n.observe(e,{childList:!0})}(n);for(var t=0,r=Object.entries(e);t<r.length;t+=1){var i=r[t],a=i[0],u=i[1];if("text"===a&&d(u,n),"events"===a&&c(u,n),"children"===a)for(var l=0;l<u.length;l++)n.appendChild(o(u[l]));["children","element","text","events"].includes(a)||n.setAttribute(a,u)}return n},d=function(e,n){var t=document.createTextNode(e);n.appendChild(t)},c=function(e,n){if(e instanceof Array)for(var t=0;t<e.length;t++)n.addEventListener(e[t].type,e[t].action);else e instanceof Object&&n.addEventListener(e.type,e.action)},a=function(e){return void 0===e&&(e=window.__LITERAL_STORE__),Object.assign({},e)},u=function(e){var n=a(),t=Object.assign({},n,e);window.__LITERAL_STORE__=t;var r=new CustomEvent("__LITERAL_UPDATE__",{detail:{newState:t,oldState:n}});return window.dispatchEvent(r)},l=function(e){void 0===e&&(e={});var n=e.methods;void 0===n&&(n=function(){});var t=e.render;return void 0===t&&(t=function(){}),function(e){void 0===e&&(e={});var r=e.props;return void 0===r&&(r={}),function(e){return t({getState:function(){return a(e)},setState:u,props:r,methods:n({getState:function(){return a()},setState:u})})}}},f=function(e,n,t,r){void 0===r&&(r=0);var i=e.children[r];!t&&n?!1===t?e.insertBefore(o(n),i):void 0===t&&e.appendChild(o(n)):!n&&t?e.removeChild(i):n&&(Promise.all([_(i,n,t),h(e,i,n,t)]),(n.children||t.children)&&Promise.all([v(n.children,t.children),v(t.children,n.children)]).then(function(e){for(var n=e[0],t=e[1],r=0;r<s(n,t);r++)f(i,n[r],t[r],r)}))},v=function(e,n){return e.filter(function(e,t){return!1!==e||!1!==n[t]})},s=function(e,n){var t=e.length,r=n.length;return t>=r?t:r},h=function(e,n,t,r){for(var i=0,d=Object.entries(t);i<d.length;i+=1){var c=d[i],a=c[0],u=c[1],l=r[a];"element"===a||"text"===a?u!==l&&e.replaceChild(o(t),n):["children","events","element","text"].includes(a)||l&&u===l||n.setAttribute(name,value)}},_=function(e,n,t){for(var r=0,i=Object.entries(t);r<i.length;r+=1){var o=i[r];n[o[0]]||e.removeAttribute(o[1])}},m={component:l,render:n};e.render=n,e.component=l,e.default=m});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.literaljs=t()}(this,function(){var e={},t=[],n=function(t){return e=Object.assign({},e,t)},r=function(e,n){window.addEventListener("__LITERAL_UPDATE__",function(){var r=t.pop();i(e,n,{oldState:r.oldState,newState:r.newState})})},i=function(e,t,n){var r=o(t(),n.oldState),i=o(t(),n.newState);return v(e,i,r)},o=function(e,t){if((e="function"==typeof e?e(t):e).children)for(var n=0;n<e.children.length;n++)e.children[n]=o(e.children[n],t);return e},d=function(e){var t=new MutationObserver(function(e){for(var t=0;t<e.length;t++)"childList"===e[t].type&&(n("mounted",e[t].addedNodes),n("unmounted",e[t].removedNodes))}),n=function(e,t){for(var n=0;n<t.length;n++){var r=new CustomEvent(e);t[n].dispatchEvent(r)}};t.observe(e,{childList:!0})},c=function(e){for(var t=document.createElement(e.element),n=0,r=Object.entries(e);n<r.length;n+=1){var i=r[n],o=i[0],d=i[1];if("text"===o&&u(d,t),"events"===o&&a(d,t),["children","element","text","events"].includes(o)||t.setAttribute(o,d),"children"===o)for(var f=0;f<d.length;f++)t.appendChild(c(d[f]))}return t},u=function(e,t){var n=document.createTextNode(e);t.appendChild(n)},a=function(e,t){if(e instanceof Array)for(var n=0;n<e.length;n++)["mounted","unmounted"].includes(e[n].type)&&d(newNode),t.addEventListener(e[n].type,e[n].action);else e instanceof Object&&(["mounted","unmounted"].includes(e.type)&&d(newNode),t.addEventListener(e.type,e.action))},f=function(t){return void 0===t&&(t=e),Object.assign({},t)},l=function(n){var r=f(),i={oldState:r,nextState:Object.assign({},r,n)};e=i.nextState,t.push(i);var o=new Event("__LITERAL_UPDATE__");return window.dispatchEvent(o)},v=function(e,t,n,r){void 0===r&&(r=0);var i=e.children[r];if(!n&&t)!1===n?e.insertBefore(c(t),i):void 0===n&&e.appendChild(c(t));else if(!t&&n)e.removeChild(i);else if(t&&(m(i,t,n),p(e,i,t,n),t.children||n.children))for(var o=s(t.children,n.children),d=s(n.children,t.children),u=0;u<h(o,d);u++)v(i,o[u],d[u],u)},s=function(e,t){for(var n=[],r=0;r<e.length;r++)!1===e[r]&&!1===t[r]||n.push(e[r]);return n},h=function(e,t){var n=e.length,r=t.length;return n>=r?n:r},p=function(e,t,n,r){for(var i=0,o=Object.entries(n);i<o.length;i+=1){var d=o[i],u=d[0],a=d[1],f=r[u];"element"===u||"text"===u?a!==f&&e.replaceChild(c(n),t):["children","events","element","text"].includes(u)||f&&a===f||t.setAttribute(name,value)}},m=function(e,t,n){for(var r=0,i=Object.entries(n);r<i.length;r+=1){var o=i[r];t[o[0]]||e.removeAttribute(o[1])}};return{component:function(e){void 0===e&&(e={});var t=e.methods;void 0===t&&(t=function(){});var n=e.render;return void 0===n&&(n=function(){}),function(e){void 0===e&&(e={});var r=e.props;return void 0===r&&(r={}),function(e){return n({getState:function(){return f(e)},setState:l,props:r,methods:t({getState:function(){return f()},setState:l})})}}},render:function(t,i,d){void 0===d&&(d={});var u=document.getElementById(i);n(d),r(u,t);var a=o(t(),e),f=c(a);u.appendChild(f)}}});
//# sourceMappingURL=index.umd.js.map
{
"name": "literaljs",
"version": "2.1.0",
"version": "2.1.1",
"description": "~1kb gzip JavaScript library for building user interfaces.",

@@ -5,0 +5,0 @@ "main": "build/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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