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.5 to 5.1.6

2

build/index.js

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

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){var t=typeof e;if("string"===t||"number"===t)return document.createTextNode(e);if("boolean"===t||"undefined"===t)return document.createTextNode("");var n,i=document.createElement(e.element);if(e.attributes&&"object"==typeof e.attributes)for(var r=0,u=Object.entries(e.attributes);r<u.length;r+=1){var d=u[r],o=d[0],a=d[1];"events"===o?h(a,i):"style"===o?b(a,i):i.setAttribute(o,a)}if(p(e,"mounted"),e.children&&e.children.length)for(var s=0;s<e.children.length;s++)n=v(e.children[s]),i.appendChild(n);return i}function h(t,n){if(n){var i=Object.keys(t),r=i.length;if(r){var s,f=m();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 g(i){var r=l(t()),u=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var u=typeof n;var d=typeof i;var o=t.childNodes[r];if("undefined"===d)t.appendChild(v(n));else if("undefined"===u)j(o),y(i,function(){t.removeChild(o)});else if(!1!==i||!n.element&&"string"!==u&&"number"!==u)if(!1!==n||!i.element&&"string"!==d&&"number"!==d){if(function(e,t,n,i){return n!==i||("string"===n||"number"===n)&&e!==t||e.element!==t.element||e.uuid!==t.uuid}(n,i,u,d))j(o),y(i,function(){t.replaceChild(v(n),o)});else if(n.element){!function(e,t,n){for(var i,r,u,d=Object.keys(t.attributes),o=0;o<d.length;o++)r=t.attributes[u=d[o]],i=n.attributes?n.attributes[u]:void 0,"style"===u?(void 0,void 0,f=typeof(s=i),"object"===(c=typeof(a=r))&&"object"===f&&JSON.stringify(a)===JSON.stringify(s)||"undefined"===c&&"undefined"===f||(e.removeAttribute("style"),b(r,e))):"events"===u?(O(e,n.uuid),j(n.uuid),h(r,e)):"value"===u&&r!==i?e.value=r:i&&r===i||e.setAttribute(u,r);var a,s,c,f}(o,n,i),p(n,"updated");var s=n.children?n.children.length:0,f=i.children?i.children.length:0;if(s<f)for(var l=f-1;l>0;l--)if(void 0===n.children[l]){var g=o.lastChild;g&&(j(g),y(i.children[l],function(){g.remove()}))}for(var m=0;m<s;m++)e(o,n.children[m],i.children[m],m)}}else j(o),y(i,function(){t.replaceChild(v(n),o)});else j(o),t.replaceChild(v(n),o);function y(e,t){if(void 0===t&&(t=function(){}),p(e,"unmounted"),e&&e.children)for(var n=e.children.length,i=0;i<n;i++)y(e.children[i]);t()}function j(e){e&&delete a[e]}function O(e,t){if(t)for(var n=Object.keys(a[t]),i=0;i<n.length;i++)c.includes(n[i])&&e.removeEventListener(n[i],a[t][n[i]])}}(e,r,u,0)}function p(e,t){if(e&&e.uuid){var n=s[e.uuid];n[t]&&(f.push(n[t]),i=new Event("__LITERAL_LIFECYCLE__"),window.dispatchEvent(i))}var i}function m(){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=m();return r[c]=t,function(e){return void 0===e&&(e={}),{uuid:c,render:function(){var f=this;for(var l in this.uuid=c,this.props=e,s[this.uuid]={mounted:n.bind(this),updated:u.bind(this),unmounted:function(){r[f.uuid]=t,d.bind(f)()}},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()}.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)f[l]=o[l].bind(f);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.shift();)e()}t=r,n=Object.assign({},o),e.appendChild(v(o)),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,[])}}};
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){var t=typeof e;if("string"===t||"number"===t)return document.createTextNode(e);if("boolean"===t||"undefined"===t)return document.createTextNode("");var n,i=document.createElement(e.element);if(e.attributes&&"object"==typeof e.attributes)for(var r=0,u=Object.entries(e.attributes);r<u.length;r+=1){var d=u[r],o=d[0],a=d[1];"events"===o?(e.euid=m(),h(e.euid,a,i)):"style"===o?b(a,i):i.setAttribute(o,a)}if(p(e,"mounted"),e.children&&e.children.length)for(var s=0;s<e.children.length;s++)n=v(e.children[s]),i.appendChild(n);return i}function h(t,n,i){if(i){var r=Object.keys(n),s=r.length;if(s){var f;i.setAttribute("data-"+u,t),a[t]=n,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)}}))}()}(n);for(var l=0;l<s;l++)c.includes(f=r[l])&&i.addEventListener(f,a[t][f])}}}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 g(i){var r=l(t()),u=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var u=typeof n;var d=typeof i;var o=t.childNodes[r];if("undefined"===d)t.appendChild(v(n));else if("undefined"===u)j(i),t.removeChild(o);else if(!1!==i||!n.element&&"string"!==u&&"number"!==u)if(!1!==n||!i.element&&"string"!==d&&"number"!==d){if(function(e,t,n,i){return n!==i||("string"===n||"number"===n)&&e!==t||e.element!==t.element||e.uuid!==t.uuid}(n,i,u,d))j(i),t.replaceChild(v(n),o);else if(n.element){!function(e,t,n){for(var i,r,u,d=Object.keys(t.attributes),o=0;o<d.length;o++)r=t.attributes[u=d[o]],i=n.attributes?n.attributes[u]:void 0,"style"===u?(void 0,void 0,l=typeof(c=i),"object"===(f=typeof(s=r))&&"object"===l&&JSON.stringify(s)===JSON.stringify(c)||"undefined"===f&&"undefined"===l||(e.removeAttribute("style"),b(r,e))):"events"===u?(E(e,n.euid),O(n.euid),console.log("updateNodes: ",{ApplicationEventsCacheLength:Object.keys(a).length}),t.euid=m(),h(t.euid,r,e)):"value"===u&&r!==i?e.value=r:i&&r===i||e.setAttribute(u,r);var s,c,f,l}(o,n,i),p(n,"updated");var s=n.children?n.children.length:0,f=i.children?i.children.length:0;if(s<f)for(var l=f-1;l>0;l--)if(void 0===n.children[l]){var g=o.lastChild;g&&(j(i.children[l]),g.remove())}for(var y=0;y<s;y++)e(o,n.children[y],i.children[y],y)}}else j(i),t.replaceChild(v(n),o);else t.replaceChild(v(n),o);function j(e){if(p(e,"unmounted"),e&&(O(e.euid),e.children))for(var t=e.children.length,n=0;n<t;n++)j(e.children[n])}function O(e){e&&delete a[e]}function E(e,t){if(t)for(var n=Object.keys(a[t]),i=0;i<n.length;i++)c.includes(n[i])&&e.removeEventListener(n[i],a[t][n[i]])}}(e,r,u,0)}function p(e,t){if(e&&e.uuid){var n=s[e.uuid];n[t]&&(f.push(n[t]),i=new Event("__LITERAL_LIFECYCLE__"),window.dispatchEvent(i))}var i}function m(){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=m();return r[c]=t,function(e){return void 0===e&&(e={}),{uuid:c,render:function(){var f=this;for(var l in this.uuid=c,this.props=e,s[this.uuid]={mounted:n.bind(this),updated:u.bind(this),unmounted:function(){r[f.uuid]=t,d.bind(f)()}},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()}.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)f[l]=o[l].bind(f);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.shift();)e()}t=r,n=Object.assign({},o),e.appendChild(v(o)),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=[],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.shift();)e()}t=r,n=Object.assign({},o),e.appendChild(g(o)),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(){var f=this;for(var l in this.uuid=c,this.props=e,s[this.uuid]={mounted:n.bind(this),updated:u.bind(this),unmounted:function(){r[f.uuid]=t,d.bind(f)()}},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)f[l]=o[l].bind(f);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 g(e){var t=typeof e;if("string"===t||"number"===t)return document.createTextNode(e);if("boolean"===t||"undefined"===t)return document.createTextNode("");var n,i=document.createElement(e.element);if(e.attributes&&"object"==typeof e.attributes)for(var r=0,u=Object.entries(e.attributes);r<u.length;r+=1){var d=u[r],o=d[0],a=d[1];"events"===o?p(a,i):"style"===o?m(a,i):i.setAttribute(o,a)}if(j(e,"mounted"),e.children&&e.children.length)for(var s=0;s<e.children.length;s++)n=g(e.children[s]),i.appendChild(n);return i}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 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 y(i){var r=b(t()),u=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var u=typeof n;var d=typeof i;var o=t.childNodes[r];if("undefined"===d)t.appendChild(g(n));else if("undefined"===u)y(o),b(i,function(){t.removeChild(o)});else if(!1!==i||!n.element&&"string"!==u&&"number"!==u)if(!1!==n||!i.element&&"string"!==d&&"number"!==d){if(function(e,t,n,i){return n!==i||("string"===n||"number"===n)&&e!==t||e.element!==t.element||e.uuid!==t.uuid}(n,i,u,d))y(o),b(i,function(){t.replaceChild(g(n),o)});else if(n.element){!function(e,t,n){for(var i,r,u,d=Object.keys(t.attributes),o=0;o<d.length;o++)r=t.attributes[u=d[o]],i=n.attributes?n.attributes[u]:void 0,"style"===u?(void 0,void 0,f=typeof(s=i),"object"===(c=typeof(a=r))&&"object"===f&&JSON.stringify(a)===JSON.stringify(s)||"undefined"===c&&"undefined"===f||(e.removeAttribute("style"),m(r,e))):"events"===u?(O(e,n.uuid),y(n.uuid),p(r,e)):"value"===u&&r!==i?e.value=r:i&&r===i||e.setAttribute(u,r);var a,s,c,f}(o,n,i),j(n,"updated");var s=n.children?n.children.length:0,f=i.children?i.children.length:0;if(s<f)for(var l=f-1;l>0;l--)if(void 0===n.children[l]){var v=o.lastChild;v&&(y(v),b(i.children[l],function(){v.remove()}))}for(var h=0;h<s;h++)e(o,n.children[h],i.children[h],h)}}else y(o),b(i,function(){t.replaceChild(g(n),o)});else y(o),t.replaceChild(g(n),o);function b(e,t){if(void 0===t&&(t=function(){}),j(e,"unmounted"),e&&e.children)for(var n=e.children.length,i=0;i<n;i++)b(e.children[i]);t()}function y(e){e&&delete a[e]}function O(e,t){if(t)for(var n=Object.keys(a[t]),i=0;i<n.length;i++)c.includes(n[i])&&e.removeEventListener(n[i],a[t][n[i]])}}(e,r,u,0)}function j(e,t){if(e&&e.uuid){var n=s[e.uuid];n[t]&&(f.push(n[t]),i=new Event("__LITERAL_LIFECYCLE__"),window.dispatchEvent(i))}var i}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};
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.shift();)e()}t=r,n=Object.assign({},o),e.appendChild(g(o)),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(){var f=this;for(var l in this.uuid=c,this.props=e,s[this.uuid]={mounted:n.bind(this),updated:u.bind(this),unmounted:function(){r[f.uuid]=t,d.bind(f)()}},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)f[l]=o[l].bind(f);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 g(e){var t=typeof e;if("string"===t||"number"===t)return document.createTextNode(e);if("boolean"===t||"undefined"===t)return document.createTextNode("");var n,i=document.createElement(e.element);if(e.attributes&&"object"==typeof e.attributes)for(var r=0,u=Object.entries(e.attributes);r<u.length;r+=1){var d=u[r],o=d[0],a=d[1];"events"===o?(e.euid=O(),p(e.euid,a,i)):"style"===o?m(a,i):i.setAttribute(o,a)}if(j(e,"mounted"),e.children&&e.children.length)for(var s=0;s<e.children.length;s++)n=g(e.children[s]),i.appendChild(n);return i}function p(t,n,i){if(i){var r=Object.keys(n),s=r.length;if(s){var f;i.setAttribute("data-"+u,t),a[t]=n,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)}}))}()}(n);for(var l=0;l<s;l++)c.includes(f=r[l])&&i.addEventListener(f,a[t][f])}}}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 y(i){var r=b(t()),u=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var u=typeof n;var d=typeof i;var o=t.childNodes[r];if("undefined"===d)t.appendChild(g(n));else if("undefined"===u)b(i),t.removeChild(o);else if(!1!==i||!n.element&&"string"!==u&&"number"!==u)if(!1!==n||!i.element&&"string"!==d&&"number"!==d){if(function(e,t,n,i){return n!==i||("string"===n||"number"===n)&&e!==t||e.element!==t.element||e.uuid!==t.uuid}(n,i,u,d))b(i),t.replaceChild(g(n),o);else if(n.element){!function(e,t,n){for(var i,r,u,d=Object.keys(t.attributes),o=0;o<d.length;o++)r=t.attributes[u=d[o]],i=n.attributes?n.attributes[u]:void 0,"style"===u?(void 0,void 0,l=typeof(c=i),"object"===(f=typeof(s=r))&&"object"===l&&JSON.stringify(s)===JSON.stringify(c)||"undefined"===f&&"undefined"===l||(e.removeAttribute("style"),m(r,e))):"events"===u?(E(e,n.euid),y(n.euid),console.log("updateNodes: ",{ApplicationEventsCacheLength:Object.keys(a).length}),t.euid=O(),p(t.euid,r,e)):"value"===u&&r!==i?e.value=r:i&&r===i||e.setAttribute(u,r);var s,c,f,l}(o,n,i),j(n,"updated");var s=n.children?n.children.length:0,f=i.children?i.children.length:0;if(s<f)for(var l=f-1;l>0;l--)if(void 0===n.children[l]){var v=o.lastChild;v&&(b(i.children[l]),v.remove())}for(var h=0;h<s;h++)e(o,n.children[h],i.children[h],h)}}else b(i),t.replaceChild(g(n),o);else t.replaceChild(g(n),o);function b(e){if(j(e,"unmounted"),e&&(y(e.euid),e.children))for(var t=e.children.length,n=0;n<t;n++)b(e.children[n])}function y(e){e&&delete a[e]}function E(e,t){if(t)for(var n=Object.keys(a[t]),i=0;i<n.length;i++)c.includes(n[i])&&e.removeEventListener(n[i],a[t][n[i]])}}(e,r,u,0)}function j(e,t){if(e&&e.uuid){var n=s[e.uuid];n[t]&&(f.push(n[t]),i=new Event("__LITERAL_LIFECYCLE__"),window.dispatchEvent(i))}var i}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",o=[],d=[],a={},f={},s=["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){var t=typeof e;if("string"===t||"number"===t)return document.createTextNode(e);if("boolean"===t||"undefined"===t)return document.createTextNode("");var n,i=document.createElement(e.element);if(e.attributes&&"object"==typeof e.attributes)for(var r=0,u=Object.entries(e.attributes);r<u.length;r+=1){var o=u[r],d=o[0],a=o[1];"events"===d?h(a,i):"style"===d?b(a,i):i.setAttribute(d,a)}if(g(e,"mounted"),e.children&&e.children.length)for(var f=0;f<e.children.length;f++)n=v(e.children[f]),i.appendChild(n);return i}function h(t,n){if(n){var i=Object.keys(t),r=i.length;if(r){var f,c=m();n.setAttribute("data-"+u,c),a[c]=t,function(t){for(var n=Object.keys(t),i=0;i<n.length;i++)s.includes(n[i])||o.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=o.pop();)d.includes(t)||(d.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++)s.includes(f=i[l])&&n.addEventListener(f,a[c][f])}}}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 p(i){var r=l(t()),u=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var u=typeof n;var o=typeof i;var d=t.childNodes[r];if("undefined"===o)t.appendChild(v(n));else if("undefined"===u)j(d),y(i,function(){t.removeChild(d)});else if(!1!==i||!n.element&&"string"!==u&&"number"!==u)if(!1!==n||!i.element&&"string"!==o&&"number"!==o){if(function(e,t,n,i){return n!==i||("string"===n||"number"===n)&&e!==t||e.element!==t.element||e.uuid!==t.uuid}(n,i,u,o))j(d),y(i,function(){t.replaceChild(v(n),d)});else if(n.element){!function(e,t,n){for(var i,r,u,o=Object.keys(t.attributes),d=0;d<o.length;d++)r=t.attributes[u=o[d]],i=n.attributes?n.attributes[u]:void 0,"style"===u?(void 0,void 0,c=typeof(f=i),"object"===(s=typeof(a=r))&&"object"===c&&JSON.stringify(a)===JSON.stringify(f)||"undefined"===s&&"undefined"===c||(e.removeAttribute("style"),b(r,e))):"events"===u?(O(e,n.uuid),j(n.uuid),h(r,e)):"value"===u&&r!==i?e.value=r:i&&r===i||e.setAttribute(u,r);var a,f,s,c}(d,n,i),g(n,"updated");var f=n.children?n.children.length:0,c=i.children?i.children.length:0;if(f<c)for(var l=c-1;l>0;l--)if(void 0===n.children[l]){var p=d.lastChild;p&&(j(p),y(i.children[l],function(){p.remove()}))}for(var m=0;m<f;m++)e(d,n.children[m],i.children[m],m)}}else j(d),y(i,function(){t.replaceChild(v(n),d)});else j(d),t.replaceChild(v(n),d);function y(e,t){if(void 0===t&&(t=function(){}),g(e,"unmounted"),e&&e.children)for(var n=e.children.length,i=0;i<n;i++)y(e.children[i]);t()}function j(e){e&&delete a[e]}function O(e,t){if(t)for(var n=Object.keys(a[t]),i=0;i<n.length;i++)s.includes(n[i])&&e.removeEventListener(n[i],a[t][n[i]])}}(e,r,u,0)}function g(e,t){if(e&&e.uuid){var n=f[e.uuid];n[t]&&(c.push(n[t]),i=new Event("__LITERAL_LIFECYCLE__"),window.dispatchEvent(i))}var i}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 o=e.unmounted;void 0===o&&(o=function(){});var d=e.methods;void 0===d&&(d=function(){});var a=e.render;void 0===a&&(a=function(){});var s=m();return r[s]=t,function(e){return void 0===e&&(e={}),{uuid:s,render:function(){var c=this;for(var l in this.uuid=s,this.props=e,f[this.uuid]={mounted:n.bind(this),updated:u.bind(this),unmounted:function(){r[c.uuid]=t,o.bind(c)()}},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,p()}.bind(this),this.getStore=function(){return Object.assign({},i)},this.setStore=function(e){var t=Object.assign({},this.getStore(),e);i=t,p()}.bind(this),"function"==typeof d&&(d=d.bind(this)()),d)c[l]=d[l].bind(c);return a.bind(this)()}}}},render:function(r,u,o){void 0===o&&(o={}),i=Object.assign({},i,o),e=document.getElementById(u);var d=l(r());function a(){for(var e;e=c.shift();)e()}t=r,n=Object.assign({},d),e.appendChild(v(d)),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,[])}}}});
!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){var t=typeof e;if("string"===t||"number"===t)return document.createTextNode(e);if("boolean"===t||"undefined"===t)return document.createTextNode("");var n,i=document.createElement(e.element);if(e.attributes&&"object"==typeof e.attributes)for(var r=0,u=Object.entries(e.attributes);r<u.length;r+=1){var d=u[r],o=d[0],s=d[1];"events"===o?(e.euid=m(),h(e.euid,s,i)):"style"===o?b(s,i):i.setAttribute(o,s)}if(g(e,"mounted"),e.children&&e.children.length)for(var a=0;a<e.children.length;a++)n=v(e.children[a]),i.appendChild(n);return i}function h(t,n,i){if(i){var r=Object.keys(n),a=r.length;if(a){var c;i.setAttribute("data-"+u,t),s[t]=n,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)}}))}()}(n);for(var l=0;l<a;l++)f.includes(c=r[l])&&i.addEventListener(c,s[t][c])}}}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 p(i){var r=l(t()),u=Object.assign({},n);return n=Object.assign({},r),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var u=typeof n;var d=typeof i;var o=t.childNodes[r];if("undefined"===d)t.appendChild(v(n));else if("undefined"===u)j(i),t.removeChild(o);else if(!1!==i||!n.element&&"string"!==u&&"number"!==u)if(!1!==n||!i.element&&"string"!==d&&"number"!==d){if(function(e,t,n,i){return n!==i||("string"===n||"number"===n)&&e!==t||e.element!==t.element||e.uuid!==t.uuid}(n,i,u,d))j(i),t.replaceChild(v(n),o);else if(n.element){!function(e,t,n){for(var i,r,u,d=Object.keys(t.attributes),o=0;o<d.length;o++)r=t.attributes[u=d[o]],i=n.attributes?n.attributes[u]:void 0,"style"===u?(void 0,void 0,l=typeof(f=i),"object"===(c=typeof(a=r))&&"object"===l&&JSON.stringify(a)===JSON.stringify(f)||"undefined"===c&&"undefined"===l||(e.removeAttribute("style"),b(r,e))):"events"===u?(E(e,n.euid),O(n.euid),console.log("updateNodes: ",{ApplicationEventsCacheLength:Object.keys(s).length}),t.euid=m(),h(t.euid,r,e)):"value"===u&&r!==i?e.value=r:i&&r===i||e.setAttribute(u,r);var a,f,c,l}(o,n,i),g(n,"updated");var a=n.children?n.children.length:0,c=i.children?i.children.length:0;if(a<c)for(var l=c-1;l>0;l--)if(void 0===n.children[l]){var p=o.lastChild;p&&(j(i.children[l]),p.remove())}for(var y=0;y<a;y++)e(o,n.children[y],i.children[y],y)}}else j(i),t.replaceChild(v(n),o);else t.replaceChild(v(n),o);function j(e){if(g(e,"unmounted"),e&&(O(e.euid),e.children))for(var t=e.children.length,n=0;n<t;n++)j(e.children[n])}function O(e){e&&delete s[e]}function E(e,t){if(t)for(var n=Object.keys(s[t]),i=0;i<n.length;i++)f.includes(n[i])&&e.removeEventListener(n[i],s[t][n[i]])}}(e,r,u,0)}function g(e,t){if(e&&e.uuid){var n=a[e.uuid];n[t]&&(c.push(n[t]),i=new Event("__LITERAL_LIFECYCLE__"),window.dispatchEvent(i))}var i}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(){var c=this;for(var l in this.uuid=f,this.props=e,a[this.uuid]={mounted:n.bind(this),updated:u.bind(this),unmounted:function(){r[c.uuid]=t,d.bind(c)()}},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,p()}.bind(this),this.getStore=function(){return Object.assign({},i)},this.setStore=function(e){var t=Object.assign({},this.getStore(),e);i=t,p()}.bind(this),"function"==typeof o&&(o=o.bind(this)()),o)c[l]=o[l].bind(c);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.shift();)e()}t=r,n=Object.assign({},o),e.appendChild(v(o)),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.5",
"version": "5.1.6",
"description": "A small JavaScript library for building reactive user interfaces.",

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

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

Recent 5.1.5 microbundle:
Recent 5.1.6 microbundle:
```js
$ microbundle
Build output to build:
1.91 kB: index.js
1.93 kB: index.m.js
1.97 kB: index.umd.js
2 kB: index.js
2.02 kB: index.m.js
2.06 kB: index.umd.js
```

@@ -21,0 +21,0 @@ ### [Features and stuff](#features)

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