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 5.1.2 to 5.1.3

2

build/index.js

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

var e,t,n,i={},r={},u="euid",d=[],o=[],s={},a={},f=[];function c(e){var t;if(void 0!==e){if("function"==typeof e.element){var n=Object.assign({},e.attributes.props)||{};delete e.attributes.props,(e=e.element(n)).render&&(t=e.uuid,(e=new e.render).uuid=t)}else"function"==typeof e.render&&(t=e.uuid,(e=new e.render).uuid=t);if(e.children)for(var i=0;i<e.children.length;i++)e.children[i]=c(e.children[i]);return e}}function h(e,t){void 0===t&&(t=!1);var n=typeof e;if("string"===n||"number"===n)return document.createTextNode(e);if("boolean"===n||"undefined"===n)return document.createTextNode("");var i,r=document.createElement(e.element);if(t&&e.element&&e.uuid&&function(e){var t=a[e];t.mounted&&f.push(t.mounted);m()}(e.uuid),e.attributes&&"object"==typeof e.attributes)for(var u=0,d=Object.entries(e.attributes);u<d.length;u+=1){var o=d[u],s=o[0],c=o[1];"events"===s?v(c,r):"style"===s?l(c,r):r.setAttribute(s,c)}if(e.children&&e.children.length)for(var b=0;b<e.children.length;b++)i=h(e.children[b],t),r.appendChild(i);return r}function v(t,n){if(n){!function(t){for(var n=Object.keys(t),i=0;i<n.length;i++)d.push(n[i]);!function(){var t;for(;t=d.pop();)o.includes(t)||(o.push(t),e.addEventListener(t,function(e){var t=e.target.getAttribute("data-"+u);if(t&&s[t]){var n=e.type,i=s[t][n];i&&i(e)}}))}()}(t);var i=p();n.setAttribute("data-"+u,i),s[i]=t}}function l(e,t){if(e&&"object"==typeof e)for(var n=0,i=Object.entries(e);n<i.length;n+=1){var r=i[n];t.style[r[0]]=r[1]}}function b(i){var r=c(t()),d=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var d=typeof n;var o=typeof i;var c=t.childNodes[r];if("undefined"===o)t.appendChild(h(n)),C(n,"mounted");else if("undefined"===d)O(c),t.removeChild(c),C(i,"unmounted");else if(!1!==i||!n.element&&"string"!==d&&"number"!==d)if(!1!==n||!i.element&&"string"!==o&&"number"!==o){if(function(e,t,n,i){return n!==i||"string"===n&&e!==t||e.element!==t.element||e.uuid&&t.uuid&&e.uuid!==t.uuid}(n,i,d,o))O(c),t.replaceChild(h(n),c),C(i,"unmounted"),C(n,"mounted");else if(n.element){!function(e,t,n){for(var i=0,r=Object.entries(t.attributes);i<r.length;i+=1){var u=r[i],d=u[0],o=u[1],s=n.attributes?n.attributes[d]:void 0;"style"===d?(void 0,void 0,h=typeof(f=s),"object"===(c=typeof(a=o))&&"object"===h&&JSON.stringify(a)===JSON.stringify(f)||"undefined"===c&&"undefined"===h||(e.removeAttribute("style"),l(o,e))):"events"===d?(O(e),v(o,e)):"value"===d&&o!==s?e.value=o:s&&o===s||e.setAttribute(d,o)}var a,f,c,h}(c,n,i),C(n,"updated");var b=n.children?n.children.length:0,p=i.children?i.children.length:0;if(b<p)for(var g=p-1;g>0;g--)if(void 0===n.children[g]){var y=c.lastChild;O(y),y&&y.remove(),C(i.children[g],"unmounted")}for(var j=0;j<b;j++)e(c,n.children[j],i.children[j],j)}}else O(c),t.replaceChild(h(n),c),C(i,"unmounted");else O(c),t.replaceChild(h(n),c),C(n,"mounted");function O(e){if(e&&e.getAttribute){var t=e.getAttribute("data-"+u);t&&delete s[t]}}function C(e,t){if(e&&e.uuid){var n=a[e.uuid][t];n&&(f.push(n),m())}}}(e,r,d,0)}function m(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}function p(){return Math.random().toString(36).substring(2)+(new Date).getTime().toString(36)}module.exports={component:function(e){void 0===e&&(e={});var t=e.state;void 0===t&&(t={});var n=e.mounted;void 0===n&&(n=function(){});var u=e.updated;void 0===u&&(u=function(){});var d=e.unmounted;void 0===d&&(d=function(){});var o=e.methods;void 0===o&&(o=function(){});var s=e.render;void 0===s&&(s=function(){});var f=p();return r[f]=t,function(e){return void 0===e&&(e={}),{uuid:f,render:function(){for(var t in this.uuid=f,this.props=e,this.mounted=n.bind(this),this.updated=u.bind(this),this.unmounted=d.bind(this),a[this.uuid]={mounted:this.mounted,updated:this.updated,unmounted:this.unmounted},this.getState=function(){return Object.assign({},r[this.uuid])}.bind(this),this.setState=function(e){var t=Object.assign({},this.getState(),e);r[this.uuid]=t,b()}.bind(this),this.getStore=function(){return Object.assign({},i)},this.setStore=function(e){var t=Object.assign({},this.getStore(),e);i=t,b()}.bind(this),"function"==typeof o&&(o=o.bind(this)()),o)this[t]=o[t].bind(this);return s.bind(this)()}}}},render:function(r,u,d){void 0===d&&(d={}),i=Object.assign({},i,d),e=document.getElementById(u);var o=c(r());function s(){for(var e;e=f.pop();)e()}t=r,n=Object.assign({},o),e.appendChild(h(o,!0)),s(),window.addEventListener("__LITERAL_LIFECYCLE__",s)},h:function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];return{element:e,attributes:Object.assign({},t),children:function e(t,n){for(var i=0;i<t.length;i++)Array.isArray(t[i])?e(t[i],n):n.push(t[i]);return n}(n,[])}}};
var e,t,n,i={},r={},u="euid",d=[],o=[],a={},s={},c=["abort","blur","error","focus","load","mouseenter","mouseleave","resize","scroll","unload"],f=[];function l(e){var t;if(void 0!==e){if("function"==typeof e.element){var n=Object.assign({},e.attributes.props)||{};delete e.attributes.props,(e=e.element(n)).render&&(t=e.uuid,(e=new e.render).uuid=t)}else"function"==typeof e.render&&(t=e.uuid,(e=new e.render).uuid=t);if(e.children)for(var i=0;i<e.children.length;i++)e.children[i]=l(e.children[i]);return e}}function v(e,t){void 0===t&&(t=!1);var n=typeof e;if("string"===n||"number"===n)return document.createTextNode(e);if("boolean"===n||"undefined"===n)return document.createTextNode("");var i,r=document.createElement(e.element);if(t&&e.element&&e.uuid&&function(e){var t=s[e];t.mounted&&f.push(t.mounted);p()}(e.uuid),e.attributes&&"object"==typeof e.attributes)for(var u=0,d=Object.entries(e.attributes);u<d.length;u+=1){var o=d[u],a=o[0],c=o[1];"events"===a?h(c,r):"style"===a?b(c,r):r.setAttribute(a,c)}if(e.children&&e.children.length)for(var l=0;l<e.children.length;l++)i=v(e.children[l],t),r.appendChild(i);return r}function h(t,n){if(n){var i=Object.keys(t),r=i.length;if(r){var s,f=g();n.setAttribute("data-"+u,f),a[f]=t,function(t){for(var n=Object.keys(t),i=0;i<n.length;i++)c.includes(n[i])||d.push(n[i]);!function(){var t,n=function(e){if("#document"!==e.parentNode.nodeName){var t=e.getAttribute("data-"+u);return t||n(e.parentNode)}};for(;t=d.pop();)o.includes(t)||(o.push(t),e.addEventListener(t,function(e){var t=n(e.target);if(t&&a[t]){var i=a[t][e.type];i&&i(e)}}))}()}(t);for(var l=0;l<r;l++)c.includes(s=i[l])&&n.addEventListener(s,a[f][s])}}}function b(e,t){if(e&&"object"==typeof e)for(var n=0,i=Object.entries(e);n<i.length;n+=1){var r=i[n];t.style[r[0]]=r[1]}}function m(i){var r=l(t()),d=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var d=typeof n;var o=typeof i;var l=t.childNodes[r];if("undefined"===o)t.appendChild(v(n)),C(n,"mounted");else if("undefined"===d)E(l),t.removeChild(l),C(i,"unmounted");else if(!1!==i||!n.element&&"string"!==d&&"number"!==d)if(!1!==n||!i.element&&"string"!==o&&"number"!==o){if(function(e,t,n,i){return n!==i||"string"===n&&e!==t||e.element!==t.element||e.uuid&&t.uuid&&e.uuid!==t.uuid}(n,i,d,o))E(l),t.replaceChild(v(n),l),C(i,"unmounted"),C(n,"mounted");else if(n.element){!function(e,t,n){for(var i=0,r=Object.entries(t.attributes);i<r.length;i+=1){var u=r[i],d=u[0],o=u[1],a=n.attributes?n.attributes[d]:void 0;"style"===d?(void 0,void 0,l=typeof(c=a),"object"===(f=typeof(s=o))&&"object"===l&&JSON.stringify(s)===JSON.stringify(c)||"undefined"===f&&"undefined"===l||(e.removeAttribute("style"),b(o,e))):"events"===d?(A(e),E(e),h(o,e)):"value"===d&&o!==a?e.value=o:a&&o===a||e.setAttribute(d,o)}var s,c,f,l}(l,n,i),C(n,"updated");var m=n.children?n.children.length:0,g=i.children?i.children.length:0;if(m<g)for(var y=g-1;y>0;y--)if(void 0===n.children[y]){var j=l.lastChild;E(j),j&&j.remove(),C(i.children[y],"unmounted")}for(var O=0;O<m;O++)e(l,n.children[O],i.children[O],O)}}else E(l),t.replaceChild(v(n),l),C(i,"unmounted");else E(l),t.replaceChild(v(n),l),C(n,"mounted");function E(e){if(e&&e.getAttribute){var t=e.getAttribute("data-"+u);t&&delete a[t]}}function A(e){for(var t=e.getAttribute("data-"+u),n=Object.keys(a[t]),i=0;i<n.length;i++)c.includes(n[i])&&e.removeEventListener(n[i],a[t][n[i]])}function C(e,t){if(e&&e.uuid){var n=s[e.uuid][t];n&&(f.push(n),p())}}}(e,r,d,0)}function p(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}function g(){return Math.random().toString(36).substring(2)+(new Date).getTime().toString(36)}module.exports={component:function(e){void 0===e&&(e={});var t=e.state;void 0===t&&(t={});var n=e.mounted;void 0===n&&(n=function(){});var u=e.updated;void 0===u&&(u=function(){});var d=e.unmounted;void 0===d&&(d=function(){});var o=e.methods;void 0===o&&(o=function(){});var a=e.render;void 0===a&&(a=function(){});var c=g();return r[c]=t,function(e){return void 0===e&&(e={}),{uuid:c,render:function(){for(var t in this.uuid=c,this.props=e,this.mounted=n.bind(this),this.updated=u.bind(this),this.unmounted=d.bind(this),s[this.uuid]={mounted:this.mounted,updated:this.updated,unmounted:this.unmounted},this.getState=function(){return Object.assign({},r[this.uuid])}.bind(this),this.setState=function(e){var t=Object.assign({},this.getState(),e);r[this.uuid]=t,m()}.bind(this),this.getStore=function(){return Object.assign({},i)},this.setStore=function(e){var t=Object.assign({},this.getStore(),e);i=t,m()}.bind(this),"function"==typeof o&&(o=o.bind(this)()),o)this[t]=o[t].bind(this);return a.bind(this)()}}}},render:function(r,u,d){void 0===d&&(d={}),i=Object.assign({},i,d),e=document.getElementById(u);var o=l(r());function a(){for(var e;e=f.pop();)e()}t=r,n=Object.assign({},o),e.appendChild(v(o,!0)),a(),window.addEventListener("__LITERAL_LIFECYCLE__",a)},h:function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];return{element:e,attributes:Object.assign({},t),children:function e(t,n){for(var i=0;i<t.length;i++)Array.isArray(t[i])?e(t[i],n):n.push(t[i]);return n}(n,[])}}};
//# sourceMappingURL=index.js.map

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

var e,t,n,i={},r={},u="euid",d=[],o=[],s={},a={},f=[],c=function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];return{element:e,attributes:Object.assign({},t),children:function e(t,n){for(var i=0;i<t.length;i++)Array.isArray(t[i])?e(t[i],n):n.push(t[i]);return n}(n,[])}},h=function(r,u,d){void 0===d&&(d={}),i=Object.assign({},i,d),e=document.getElementById(u);var o=l(r());function s(){for(var e;e=f.pop();)e()}t=r,n=Object.assign({},o),e.appendChild(b(o,!0)),s(),window.addEventListener("__LITERAL_LIFECYCLE__",s)},v=function(e){void 0===e&&(e={});var t=e.state;void 0===t&&(t={});var n=e.mounted;void 0===n&&(n=function(){});var u=e.updated;void 0===u&&(u=function(){});var d=e.unmounted;void 0===d&&(d=function(){});var o=e.methods;void 0===o&&(o=function(){});var s=e.render;void 0===s&&(s=function(){});var f=j();return r[f]=t,function(e){return void 0===e&&(e={}),{uuid:f,render:function(){for(var t in this.uuid=f,this.props=e,this.mounted=n.bind(this),this.updated=u.bind(this),this.unmounted=d.bind(this),a[this.uuid]={mounted:this.mounted,updated:this.updated,unmounted:this.unmounted},this.getState=function(){return Object.assign({},r[this.uuid])}.bind(this),this.setState=function(e){var t=Object.assign({},this.getState(),e);r[this.uuid]=t,g(this.uuid)}.bind(this),this.getStore=function(){return Object.assign({},i)},this.setStore=function(e){var t=Object.assign({},this.getStore(),e);i=t,g()}.bind(this),"function"==typeof o&&(o=o.bind(this)()),o)this[t]=o[t].bind(this);return s.bind(this)()}}}};function l(e){var t;if(void 0!==e){if("function"==typeof e.element){var n=Object.assign({},e.attributes.props)||{};delete e.attributes.props,(e=e.element(n)).render&&(t=e.uuid,(e=new e.render).uuid=t)}else"function"==typeof e.render&&(t=e.uuid,(e=new e.render).uuid=t);if(e.children)for(var i=0;i<e.children.length;i++)e.children[i]=l(e.children[i]);return e}}function b(e,t){void 0===t&&(t=!1);var n=typeof e;if("string"===n||"number"===n)return document.createTextNode(e);if("boolean"===n||"undefined"===n)return document.createTextNode("");var i,r=document.createElement(e.element);if(t&&e.element&&e.uuid&&function(e){var t=a[e];t.mounted&&f.push(t.mounted);y()}(e.uuid),e.attributes&&"object"==typeof e.attributes)for(var u=0,d=Object.entries(e.attributes);u<d.length;u+=1){var o=d[u],s=o[0],c=o[1];"events"===s?p(c,r):"style"===s?m(c,r):r.setAttribute(s,c)}if(e.children&&e.children.length)for(var h=0;h<e.children.length;h++)i=b(e.children[h],t),r.appendChild(i);return r}function p(t,n){if(n){!function(t){for(var n=Object.keys(t),i=0;i<n.length;i++)d.push(n[i]);!function(){var t;for(;t=d.pop();)o.includes(t)||(o.push(t),e.addEventListener(t,function(e){var t=e.target.getAttribute("data-"+u);if(t&&s[t]){var n=e.type,i=s[t][n];i&&i(e)}}))}()}(t);var i=j();n.setAttribute("data-"+u,i),s[i]=t}}function m(e,t){if(e&&"object"==typeof e)for(var n=0,i=Object.entries(e);n<i.length;n+=1){var r=i[n];t.style[r[0]]=r[1]}}function g(i){var r=l(t()),d=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var d=typeof n;var o=typeof i;var c=t.childNodes[r];if("undefined"===o)t.appendChild(b(n)),C(n,"mounted");else if("undefined"===d)O(c),t.removeChild(c),C(i,"unmounted");else if(!1!==i||!n.element&&"string"!==d&&"number"!==d)if(!1!==n||!i.element&&"string"!==o&&"number"!==o){if(function(e,t,n,i){return n!==i||"string"===n&&e!==t||e.element!==t.element||e.uuid&&t.uuid&&e.uuid!==t.uuid}(n,i,d,o))O(c),t.replaceChild(b(n),c),C(i,"unmounted"),C(n,"mounted");else if(n.element){!function(e,t,n){for(var i=0,r=Object.entries(t.attributes);i<r.length;i+=1){var u=r[i],d=u[0],o=u[1],s=n.attributes?n.attributes[d]:void 0;"style"===d?(void 0,void 0,h=typeof(f=s),"object"===(c=typeof(a=o))&&"object"===h&&JSON.stringify(a)===JSON.stringify(f)||"undefined"===c&&"undefined"===h||(e.removeAttribute("style"),m(o,e))):"events"===d?(O(e),p(o,e)):"value"===d&&o!==s?e.value=o:s&&o===s||e.setAttribute(d,o)}var a,f,c,h}(c,n,i),C(n,"updated");var h=n.children?n.children.length:0,v=i.children?i.children.length:0;if(h<v)for(var l=v-1;l>0;l--)if(void 0===n.children[l]){var g=c.lastChild;O(g),g&&g.remove(),C(i.children[l],"unmounted")}for(var j=0;j<h;j++)e(c,n.children[j],i.children[j],j)}}else O(c),t.replaceChild(b(n),c),C(i,"unmounted");else O(c),t.replaceChild(b(n),c),C(n,"mounted");function O(e){if(e&&e.getAttribute){var t=e.getAttribute("data-"+u);t&&delete s[t]}}function C(e,t){if(e&&e.uuid){var n=a[e.uuid][t];n&&(f.push(n),y())}}}(e,r,d,0)}function y(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}function j(){return Math.random().toString(36).substring(2)+(new Date).getTime().toString(36)}export default{component:v,render:h,h:c};export{c as h,h as render,v as component};
var e,t,n,i={},r={},u="euid",d=[],o=[],a={},s={},c=["abort","blur","error","focus","load","mouseenter","mouseleave","resize","scroll","unload"],f=[],l=function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];return{element:e,attributes:Object.assign({},t),children:function e(t,n){for(var i=0;i<t.length;i++)Array.isArray(t[i])?e(t[i],n):n.push(t[i]);return n}(n,[])}},v=function(r,u,d){void 0===d&&(d={}),i=Object.assign({},i,d),e=document.getElementById(u);var o=b(r());function a(){for(var e;e=f.pop();)e()}t=r,n=Object.assign({},o),e.appendChild(m(o,!0)),a(),window.addEventListener("__LITERAL_LIFECYCLE__",a)},h=function(e){void 0===e&&(e={});var t=e.state;void 0===t&&(t={});var n=e.mounted;void 0===n&&(n=function(){});var u=e.updated;void 0===u&&(u=function(){});var d=e.unmounted;void 0===d&&(d=function(){});var o=e.methods;void 0===o&&(o=function(){});var a=e.render;void 0===a&&(a=function(){});var c=O();return r[c]=t,function(e){return void 0===e&&(e={}),{uuid:c,render:function(){for(var t in this.uuid=c,this.props=e,this.mounted=n.bind(this),this.updated=u.bind(this),this.unmounted=d.bind(this),s[this.uuid]={mounted:this.mounted,updated:this.updated,unmounted:this.unmounted},this.getState=function(){return Object.assign({},r[this.uuid])}.bind(this),this.setState=function(e){var t=Object.assign({},this.getState(),e);r[this.uuid]=t,y(this.uuid)}.bind(this),this.getStore=function(){return Object.assign({},i)},this.setStore=function(e){var t=Object.assign({},this.getStore(),e);i=t,y()}.bind(this),"function"==typeof o&&(o=o.bind(this)()),o)this[t]=o[t].bind(this);return a.bind(this)()}}}};function b(e){var t;if(void 0!==e){if("function"==typeof e.element){var n=Object.assign({},e.attributes.props)||{};delete e.attributes.props,(e=e.element(n)).render&&(t=e.uuid,(e=new e.render).uuid=t)}else"function"==typeof e.render&&(t=e.uuid,(e=new e.render).uuid=t);if(e.children)for(var i=0;i<e.children.length;i++)e.children[i]=b(e.children[i]);return e}}function m(e,t){void 0===t&&(t=!1);var n=typeof e;if("string"===n||"number"===n)return document.createTextNode(e);if("boolean"===n||"undefined"===n)return document.createTextNode("");var i,r=document.createElement(e.element);if(t&&e.element&&e.uuid&&function(e){var t=s[e];t.mounted&&f.push(t.mounted);j()}(e.uuid),e.attributes&&"object"==typeof e.attributes)for(var u=0,d=Object.entries(e.attributes);u<d.length;u+=1){var o=d[u],a=o[0],c=o[1];"events"===a?p(c,r):"style"===a?g(c,r):r.setAttribute(a,c)}if(e.children&&e.children.length)for(var l=0;l<e.children.length;l++)i=m(e.children[l],t),r.appendChild(i);return r}function p(t,n){if(n){var i=Object.keys(t),r=i.length;if(r){var s,f=O();n.setAttribute("data-"+u,f),a[f]=t,function(t){for(var n=Object.keys(t),i=0;i<n.length;i++)c.includes(n[i])||d.push(n[i]);!function(){var t,n=function(e){if("#document"!==e.parentNode.nodeName){var t=e.getAttribute("data-"+u);return t||n(e.parentNode)}};for(;t=d.pop();)o.includes(t)||(o.push(t),e.addEventListener(t,function(e){var t=n(e.target);if(t&&a[t]){var i=a[t][e.type];i&&i(e)}}))}()}(t);for(var l=0;l<r;l++)c.includes(s=i[l])&&n.addEventListener(s,a[f][s])}}}function g(e,t){if(e&&"object"==typeof e)for(var n=0,i=Object.entries(e);n<i.length;n+=1){var r=i[n];t.style[r[0]]=r[1]}}function y(i){var r=b(t()),d=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var d=typeof n;var o=typeof i;var l=t.childNodes[r];if("undefined"===o)t.appendChild(m(n)),C(n,"mounted");else if("undefined"===d)E(l),t.removeChild(l),C(i,"unmounted");else if(!1!==i||!n.element&&"string"!==d&&"number"!==d)if(!1!==n||!i.element&&"string"!==o&&"number"!==o){if(function(e,t,n,i){return n!==i||"string"===n&&e!==t||e.element!==t.element||e.uuid&&t.uuid&&e.uuid!==t.uuid}(n,i,d,o))E(l),t.replaceChild(m(n),l),C(i,"unmounted"),C(n,"mounted");else if(n.element){!function(e,t,n){for(var i=0,r=Object.entries(t.attributes);i<r.length;i+=1){var u=r[i],d=u[0],o=u[1],a=n.attributes?n.attributes[d]:void 0;"style"===d?(void 0,void 0,l=typeof(c=a),"object"===(f=typeof(s=o))&&"object"===l&&JSON.stringify(s)===JSON.stringify(c)||"undefined"===f&&"undefined"===l||(e.removeAttribute("style"),g(o,e))):"events"===d?(A(e),E(e),p(o,e)):"value"===d&&o!==a?e.value=o:a&&o===a||e.setAttribute(d,o)}var s,c,f,l}(l,n,i),C(n,"updated");var v=n.children?n.children.length:0,h=i.children?i.children.length:0;if(v<h)for(var b=h-1;b>0;b--)if(void 0===n.children[b]){var y=l.lastChild;E(y),y&&y.remove(),C(i.children[b],"unmounted")}for(var O=0;O<v;O++)e(l,n.children[O],i.children[O],O)}}else E(l),t.replaceChild(m(n),l),C(i,"unmounted");else E(l),t.replaceChild(m(n),l),C(n,"mounted");function E(e){if(e&&e.getAttribute){var t=e.getAttribute("data-"+u);t&&delete a[t]}}function A(e){for(var t=e.getAttribute("data-"+u),n=Object.keys(a[t]),i=0;i<n.length;i++)c.includes(n[i])&&e.removeEventListener(n[i],a[t][n[i]])}function C(e,t){if(e&&e.uuid){var n=s[e.uuid][t];n&&(f.push(n),j())}}}(e,r,d,0)}function j(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}function O(){return Math.random().toString(36).substring(2)+(new Date).getTime().toString(36)}export default{component:h,render:v,h:l};export{l as h,v as render,h as component};
//# sourceMappingURL=index.m.js.map

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

!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,i={},r={},u="euid",d=[],o=[],s={},a={},f=[];function c(e){var t;if(void 0!==e){if("function"==typeof e.element){var n=Object.assign({},e.attributes.props)||{};delete e.attributes.props,(e=e.element(n)).render&&(t=e.uuid,(e=new e.render).uuid=t)}else"function"==typeof e.render&&(t=e.uuid,(e=new e.render).uuid=t);if(e.children)for(var i=0;i<e.children.length;i++)e.children[i]=c(e.children[i]);return e}}function h(e,t){void 0===t&&(t=!1);var n=typeof e;if("string"===n||"number"===n)return document.createTextNode(e);if("boolean"===n||"undefined"===n)return document.createTextNode("");var i,r=document.createElement(e.element);if(t&&e.element&&e.uuid&&function(e){var t=a[e];t.mounted&&f.push(t.mounted);p()}(e.uuid),e.attributes&&"object"==typeof e.attributes)for(var u=0,d=Object.entries(e.attributes);u<d.length;u+=1){var o=d[u],s=o[0],c=o[1];"events"===s?l(c,r):"style"===s?v(c,r):r.setAttribute(s,c)}if(e.children&&e.children.length)for(var b=0;b<e.children.length;b++)i=h(e.children[b],t),r.appendChild(i);return r}function l(t,n){if(n){!function(t){for(var n=Object.keys(t),i=0;i<n.length;i++)d.push(n[i]);!function(){var t;for(;t=d.pop();)o.includes(t)||(o.push(t),e.addEventListener(t,function(e){var t=e.target.getAttribute("data-"+u);if(t&&s[t]){var n=e.type,i=s[t][n];i&&i(e)}}))}()}(t);var i=m();n.setAttribute("data-"+u,i),s[i]=t}}function v(e,t){if(e&&"object"==typeof e)for(var n=0,i=Object.entries(e);n<i.length;n+=1){var r=i[n];t.style[r[0]]=r[1]}}function b(i){var r=c(t()),d=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var d=typeof n;var o=typeof i;var c=t.childNodes[r];if("undefined"===o)t.appendChild(h(n)),C(n,"mounted");else if("undefined"===d)O(c),t.removeChild(c),C(i,"unmounted");else if(!1!==i||!n.element&&"string"!==d&&"number"!==d)if(!1!==n||!i.element&&"string"!==o&&"number"!==o){if(function(e,t,n,i){return n!==i||"string"===n&&e!==t||e.element!==t.element||e.uuid&&t.uuid&&e.uuid!==t.uuid}(n,i,d,o))O(c),t.replaceChild(h(n),c),C(i,"unmounted"),C(n,"mounted");else if(n.element){!function(e,t,n){for(var i=0,r=Object.entries(t.attributes);i<r.length;i+=1){var u=r[i],d=u[0],o=u[1],s=n.attributes?n.attributes[d]:void 0;"style"===d?(void 0,void 0,h=typeof(f=s),"object"===(c=typeof(a=o))&&"object"===h&&JSON.stringify(a)===JSON.stringify(f)||"undefined"===c&&"undefined"===h||(e.removeAttribute("style"),v(o,e))):"events"===d?(O(e),l(o,e)):"value"===d&&o!==s?e.value=o:s&&o===s||e.setAttribute(d,o)}var a,f,c,h}(c,n,i),C(n,"updated");var b=n.children?n.children.length:0,m=i.children?i.children.length:0;if(b<m)for(var g=m-1;g>0;g--)if(void 0===n.children[g]){var y=c.lastChild;O(y),y&&y.remove(),C(i.children[g],"unmounted")}for(var j=0;j<b;j++)e(c,n.children[j],i.children[j],j)}}else O(c),t.replaceChild(h(n),c),C(i,"unmounted");else O(c),t.replaceChild(h(n),c),C(n,"mounted");function O(e){if(e&&e.getAttribute){var t=e.getAttribute("data-"+u);t&&delete s[t]}}function C(e,t){if(e&&e.uuid){var n=a[e.uuid][t];n&&(f.push(n),p())}}}(e,r,d,0)}function p(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}function m(){return Math.random().toString(36).substring(2)+(new Date).getTime().toString(36)}return{component:function(e){void 0===e&&(e={});var t=e.state;void 0===t&&(t={});var n=e.mounted;void 0===n&&(n=function(){});var u=e.updated;void 0===u&&(u=function(){});var d=e.unmounted;void 0===d&&(d=function(){});var o=e.methods;void 0===o&&(o=function(){});var s=e.render;void 0===s&&(s=function(){});var f=m();return r[f]=t,function(e){return void 0===e&&(e={}),{uuid:f,render:function(){for(var t in this.uuid=f,this.props=e,this.mounted=n.bind(this),this.updated=u.bind(this),this.unmounted=d.bind(this),a[this.uuid]={mounted:this.mounted,updated:this.updated,unmounted:this.unmounted},this.getState=function(){return Object.assign({},r[this.uuid])}.bind(this),this.setState=function(e){var t=Object.assign({},this.getState(),e);r[this.uuid]=t,b()}.bind(this),this.getStore=function(){return Object.assign({},i)},this.setStore=function(e){var t=Object.assign({},this.getStore(),e);i=t,b()}.bind(this),"function"==typeof o&&(o=o.bind(this)()),o)this[t]=o[t].bind(this);return s.bind(this)()}}}},render:function(r,u,d){void 0===d&&(d={}),i=Object.assign({},i,d),e=document.getElementById(u);var o=c(r());function s(){for(var e;e=f.pop();)e()}t=r,n=Object.assign({},o),e.appendChild(h(o,!0)),s(),window.addEventListener("__LITERAL_LIFECYCLE__",s)},h:function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];return{element:e,attributes:Object.assign({},t),children:function e(t,n){for(var i=0;i<t.length;i++)Array.isArray(t[i])?e(t[i],n):n.push(t[i]);return n}(n,[])}}}});
!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,i={},r={},u="euid",d=[],o=[],s={},a={},f=["abort","blur","error","focus","load","mouseenter","mouseleave","resize","scroll","unload"],c=[];function l(e){var t;if(void 0!==e){if("function"==typeof e.element){var n=Object.assign({},e.attributes.props)||{};delete e.attributes.props,(e=e.element(n)).render&&(t=e.uuid,(e=new e.render).uuid=t)}else"function"==typeof e.render&&(t=e.uuid,(e=new e.render).uuid=t);if(e.children)for(var i=0;i<e.children.length;i++)e.children[i]=l(e.children[i]);return e}}function v(e,t){void 0===t&&(t=!1);var n=typeof e;if("string"===n||"number"===n)return document.createTextNode(e);if("boolean"===n||"undefined"===n)return document.createTextNode("");var i,r=document.createElement(e.element);if(t&&e.element&&e.uuid&&function(e){var t=a[e];t.mounted&&c.push(t.mounted);p()}(e.uuid),e.attributes&&"object"==typeof e.attributes)for(var u=0,d=Object.entries(e.attributes);u<d.length;u+=1){var o=d[u],s=o[0],f=o[1];"events"===s?h(f,r):"style"===s?b(f,r):r.setAttribute(s,f)}if(e.children&&e.children.length)for(var l=0;l<e.children.length;l++)i=v(e.children[l],t),r.appendChild(i);return r}function h(t,n){if(n){var i=Object.keys(t),r=i.length;if(r){var a,c=g();n.setAttribute("data-"+u,c),s[c]=t,function(t){for(var n=Object.keys(t),i=0;i<n.length;i++)f.includes(n[i])||d.push(n[i]);!function(){var t,n=function(e){if("#document"!==e.parentNode.nodeName){var t=e.getAttribute("data-"+u);return t||n(e.parentNode)}};for(;t=d.pop();)o.includes(t)||(o.push(t),e.addEventListener(t,function(e){var t=n(e.target);if(t&&s[t]){var i=s[t][e.type];i&&i(e)}}))}()}(t);for(var l=0;l<r;l++)f.includes(a=i[l])&&n.addEventListener(a,s[c][a])}}}function b(e,t){if(e&&"object"==typeof e)for(var n=0,i=Object.entries(e);n<i.length;n+=1){var r=i[n];t.style[r[0]]=r[1]}}function m(i){var r=l(t()),d=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var d=typeof n;var o=typeof i;var l=t.childNodes[r];if("undefined"===o)t.appendChild(v(n)),C(n,"mounted");else if("undefined"===d)E(l),t.removeChild(l),C(i,"unmounted");else if(!1!==i||!n.element&&"string"!==d&&"number"!==d)if(!1!==n||!i.element&&"string"!==o&&"number"!==o){if(function(e,t,n,i){return n!==i||"string"===n&&e!==t||e.element!==t.element||e.uuid&&t.uuid&&e.uuid!==t.uuid}(n,i,d,o))E(l),t.replaceChild(v(n),l),C(i,"unmounted"),C(n,"mounted");else if(n.element){!function(e,t,n){for(var i=0,r=Object.entries(t.attributes);i<r.length;i+=1){var u=r[i],d=u[0],o=u[1],s=n.attributes?n.attributes[d]:void 0;"style"===d?(void 0,void 0,l=typeof(f=s),"object"===(c=typeof(a=o))&&"object"===l&&JSON.stringify(a)===JSON.stringify(f)||"undefined"===c&&"undefined"===l||(e.removeAttribute("style"),b(o,e))):"events"===d?(A(e),E(e),h(o,e)):"value"===d&&o!==s?e.value=o:s&&o===s||e.setAttribute(d,o)}var a,f,c,l}(l,n,i),C(n,"updated");var m=n.children?n.children.length:0,g=i.children?i.children.length:0;if(m<g)for(var y=g-1;y>0;y--)if(void 0===n.children[y]){var j=l.lastChild;E(j),j&&j.remove(),C(i.children[y],"unmounted")}for(var O=0;O<m;O++)e(l,n.children[O],i.children[O],O)}}else E(l),t.replaceChild(v(n),l),C(i,"unmounted");else E(l),t.replaceChild(v(n),l),C(n,"mounted");function E(e){if(e&&e.getAttribute){var t=e.getAttribute("data-"+u);t&&delete s[t]}}function A(e){for(var t=e.getAttribute("data-"+u),n=Object.keys(s[t]),i=0;i<n.length;i++)f.includes(n[i])&&e.removeEventListener(n[i],s[t][n[i]])}function C(e,t){if(e&&e.uuid){var n=a[e.uuid][t];n&&(c.push(n),p())}}}(e,r,d,0)}function p(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}function g(){return Math.random().toString(36).substring(2)+(new Date).getTime().toString(36)}return{component:function(e){void 0===e&&(e={});var t=e.state;void 0===t&&(t={});var n=e.mounted;void 0===n&&(n=function(){});var u=e.updated;void 0===u&&(u=function(){});var d=e.unmounted;void 0===d&&(d=function(){});var o=e.methods;void 0===o&&(o=function(){});var s=e.render;void 0===s&&(s=function(){});var f=g();return r[f]=t,function(e){return void 0===e&&(e={}),{uuid:f,render:function(){for(var t in this.uuid=f,this.props=e,this.mounted=n.bind(this),this.updated=u.bind(this),this.unmounted=d.bind(this),a[this.uuid]={mounted:this.mounted,updated:this.updated,unmounted:this.unmounted},this.getState=function(){return Object.assign({},r[this.uuid])}.bind(this),this.setState=function(e){var t=Object.assign({},this.getState(),e);r[this.uuid]=t,m()}.bind(this),this.getStore=function(){return Object.assign({},i)},this.setStore=function(e){var t=Object.assign({},this.getStore(),e);i=t,m()}.bind(this),"function"==typeof o&&(o=o.bind(this)()),o)this[t]=o[t].bind(this);return s.bind(this)()}}}},render:function(r,u,d){void 0===d&&(d={}),i=Object.assign({},i,d),e=document.getElementById(u);var o=l(r());function s(){for(var e;e=c.pop();)e()}t=r,n=Object.assign({},o),e.appendChild(v(o,!0)),s(),window.addEventListener("__LITERAL_LIFECYCLE__",s)},h:function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];return{element:e,attributes:Object.assign({},t),children:function e(t,n){for(var i=0;i<t.length;i++)Array.isArray(t[i])?e(t[i],n):n.push(t[i]);return n}(n,[])}}}});
//# sourceMappingURL=index.umd.js.map
{
"name": "literaljs",
"version": "5.1.2",
"version": "5.1.3",
"description": "A small JavaScript library for building reactive user interfaces.",

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

@@ -12,13 +12,13 @@ <p align="center">

Recent 5.1.2 microbundle:
Recent 5.1.3 microbundle:
```js
$ microbundle
Build output to build:
1.8 kB: index.js
1.82 kB: index.m.js
1.86 kB: index.umd.js
1.97 kB: index.js
1.99 kB: index.m.js
2.03 kB: index.umd.js
```
### [Features and stuff](#features)
- **Small**: Less than 2kb in size (using microbundle).
- **Small**: Around 2kb in size (using microbundle).
- **Fast**: Current and previous vDOM data is diffed instead of the actual DOM for performant updates and rendering.

@@ -30,2 +30,2 @@ - **Virtual DOM**: Diffing occurs only on state and store update for more efficient DOM updates.

- **Global Application Store**: One source of truth which makes other state management libraries (like Redux) less of a need.
- **Event Delegation**: Uses event delegation and only event types defined within the application for increased performance.
- **Event Delegation**: Uses event delegation for most events within the application for increased performance.

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