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.4.3 to 2.4.4

2

build/index.js

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

var e={},t=[],n=[],r={};module.exports={component:function(n){void 0===n&&(n={});var r=n.methods;void 0===r&&(r=function(){});var i=n.render;return void 0===i&&(i=function(){}),function(n){return void 0===n&&(n={}),function(o){var d=function(t){return void 0===t&&(t=e),Object.assign({},t)},u=function(n){var r=d(),i={oldState:r,nextState:Object.assign({},r,n)};e=i.nextState,t.push(i);var o=new Event("__LITERAL_UPDATE__");return window.dispatchEvent(o)};return i({state:d(o),getState:d,setState:u,props:n,methods:r({getState:d,setState:u})})}}},render:function(i,o,d){void 0===d&&(d={});var u=document.getElementById(o);e=Object.assign({},e,d),window.addEventListener("__LITERAL_UPDATE__",function(){return setTimeout(function(){var e=t.pop(),o=s(i(),e.newState),d=Object.assign({},r);return r=Object.assign({},o),function e(t,r,i,o){if(void 0===o&&(o=0),t){var d=t.childNodes[o];if(!1===i)t.insertBefore(v(r),d),p(r,"mounted");else if(void 0===i)t.appendChild(v(r)),p(r,"mounted");else if(!r&&i)t.removeChild(d),p(i,"unmounted");else if(r&&(function(e,t,n,r){"object"==typeof n&&"object"==typeof r||n!==r&&h(e,t,n);for(var i=0,o=Object.entries(n);i<o.length;i+=1){var d=o[i],u=d[0],a=d[1],c=r[u];"element"===u||"text"===u?a!==c&&h(e,t,n):["children","events","element","text"].includes(u)||c&&a===c||(t.setAttribute(u,a),p(n,"updated"))}}(t,d,r,i),r.children||i.children))for(var u=function(e,t){for(var n=[],r=[],i=0;i<l(e,t);i++)!1===e[i]&&!1===t[i]||(n.push(e[i]),r.push(t[i]));return{nChildren:n,oChildren:r}}(r.children,i.children),a=u.nChildren,c=u.oChildren,s=0;s<l(a,c);s++)e(d,a[s],c[s],s)}function l(e,t){var n=e.length||0,r=t.length||0;return n>=r?n:r}function h(e,t,n){e.replaceChild(v(n,{mount:!1}),t),p(n,"mounted")}function p(e,t){if(e.events){for(var r=0,i=Object.entries(e.events);r<i.length;r+=1){var o=i[r],d=o[0],u=o[1];d===t&&n.push(u)}f()}}}(u,o,d)})});var a=s(i(),e);function c(){var e;return setTimeout(function(){for(;e=n.pop();)e()})}function s(e,t){if((e="function"==typeof e?e(t):e).children)for(var n=0;n<e.children.length;n++)e.children[n]=s(e.children[n],t);return e}function v(e,t){void 0===t&&(t={});var r=t.mount;void 0===r&&(r=!0);var i=t.initial;void 0===i&&(i=!1);var o=typeof e;if("object"!==o&&"boolean"!==o)return document.createTextNode(e);for(var d=document.createElement(e.element),u=0,a=Object.entries(e);u<a.length;u+=1){var c=a[u],s=c[0],l=c[1];if("text"===s&&d.appendChild(document.createTextNode(l)),"events"===s&&p(l,d,r,i),["children","element","text","events"].includes(s)||d.setAttribute(s,l),"children"===s)for(var h=0;h<l.length;h++)d.appendChild(v(l[h],{mount:r,initial:i}))}return d;function p(e,t,r,i){for(var o=0,d=Object.entries(e);o<d.length;o+=1){var u=d[o],a=u[0],c=u[1];["mounted","unmounted","updated"].includes(a)||t.addEventListener(a,c),s(a,c,r,i)}function s(e,t,r,i){i&&(r&&"mounted"===e&&n.push(t),r||"updated"!==e||n.push(t),f())}}}function f(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}r=Object.assign({},a),u.appendChild(v(a,{initial:!0})),c(),window.addEventListener("__LITERAL_LIFECYCLE__",c)},h:function(e,t){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];return"function"==typeof e?e:Object.assign({},{element:e},t,{children:function e(t,n){for(var r=0;r<t.length;r++)Array.isArray(t[r])?e(t[r],n):n.push(t[r]);return n}(n,[])})}};
var e,n,t,i={},r=[],o=[];function d(e){return void 0===e&&(e=i),Object.assign({},e)}function c(c){var s=Object.assign({},d(),c);i=s,r.push(s),function(){var i=r.pop(),d=u(n(),i),c=Object.assign({},t);t=Object.assign({},d),function e(n,t,i,r){void 0===r&&(r=0);if(!n)return;var d=n.childNodes[r];if(!1===i)n.insertBefore(a(t),d),f(t,"mounted");else if(void 0===i)n.appendChild(a(t)),f(t,"mounted");else if(!t&&i)n.removeChild(d),f(i,"unmounted");else if(t&&(function(e,n,t,i){"object"==typeof t&&"object"==typeof i||t!==i&&v(e,n,t);for(var r=0,o=Object.entries(t);r<o.length;r+=1){var d=o[r],c=d[0],u=d[1],a=i[c];"element"===c||"text"===c?u!==a&&v(e,n,t):["children","events","element","text"].includes(c)||a&&u===a||(n.setAttribute(c,u),f(t,"updated"))}}(n,d,t,i),t.children||i.children))for(var c=0;c<(void 0,void 0,(u=t.children.length||0)>=(s=i.children.length||0)?u:s);c++)!1===t.children[c]&&!1===i.children[c]||e(d,t.children[c],i.children[c],c);var u,s;function v(e,n,t){e.replaceChild(a(t,{mount:!1}),n),f(t,"mounted")}function f(e,n){if(e.events){for(var t=0,i=Object.entries(e.events);t<i.length;t+=1){var r=i[t],d=r[0],c=r[1];d===n&&o.push(c)}l()}}}(e,d,c)}()}function u(e,n){if((e="function"==typeof e?e(n):e).children)for(var t=0;t<e.children.length;t++)e.children[t]=u(e.children[t],n);return e}function a(e,n){void 0===n&&(n={});var t=n.mount;void 0===t&&(t=!0);var i=n.initial;void 0===i&&(i=!1);var r=typeof e;if("object"!==r&&"boolean"!==r)return document.createTextNode(e);for(var d=document.createElement(e.element),c=0,u=Object.entries(e);c<u.length;c+=1){var s=u[c],v=s[0],f=s[1];if("text"===v&&d.appendChild(document.createTextNode(f)),"events"===v&&p(f,d,t,i),["children","element","text","events"].includes(v)||d.setAttribute(v,f),"children"===v)for(var h=0;h<f.length;h++)d.appendChild(a(f[h],{mount:t,initial:i}))}return d;function p(e,n,t,i){for(var r=0,d=Object.entries(e);r<d.length;r+=1){var c=d[r],u=c[0],a=c[1];["mounted","unmounted","updated"].includes(u)||n.addEventListener(u,a),s(u,a,t,i)}function s(e,n,t,i){i&&(t&&"mounted"===e&&o.push(n),t||"updated"!==e||o.push(n),l())}}}function l(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}module.exports={component: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){return void 0===e&&(e={}),function(i){return t({state:d(i),getState:d,setState:c,props:e,methods:n({getState:d,setState:c})})}}},render:function(r,d,c){void 0===c&&(c={}),i=Object.assign({},i,c),e=document.getElementById(d),n=r;var l=u(r(),i);function s(){for(var e;e=o.pop();)e()}t=Object.assign({},l),e.appendChild(a(l,{initial:!0})),s(),window.addEventListener("__LITERAL_LIFECYCLE__",s)},h:function(e,n){for(var t=[],i=arguments.length-2;i-- >0;)t[i]=arguments[i+2];return"function"==typeof e?e:Object.assign({},{element:e},n,{children:function e(n,t){for(var i=0;i<n.length;i++)Array.isArray(n[i])?e(n[i],t):t.push(n[i]);return t}(t,[])})}};
//# sourceMappingURL=index.js.map

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

var e={},t=[],n=[],r={},i=function(e,t){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];return"function"==typeof e?e:Object.assign({},{element:e},t,{children:function e(t,n){for(var r=0;r<t.length;r++)Array.isArray(t[r])?e(t[r],n):n.push(t[r]);return n}(n,[])})},o=function(i,o,d){void 0===d&&(d={});var u=document.getElementById(o);e=Object.assign({},e,d),window.addEventListener("__LITERAL_UPDATE__",function(){return setTimeout(function(){var e=t.pop(),o=f(i(),e.newState),d=Object.assign({},r);return r=Object.assign({},o),function e(t,r,i,o){void 0===o&&(o=0);if(!t)return;var d=t.childNodes[o];if(!1===i)t.insertBefore(s(r),d),p(r,"mounted");else if(void 0===i)t.appendChild(s(r)),p(r,"mounted");else if(!r&&i)t.removeChild(d),p(i,"unmounted");else if(r&&(function(e,t,n,r){"object"==typeof n&&"object"==typeof r||n!==r&&h(e,t,n);for(var i=0,o=Object.entries(n);i<o.length;i+=1){var d=o[i],u=d[0],a=d[1],c=r[u];"element"===u||"text"===u?a!==c&&h(e,t,n):["children","events","element","text"].includes(u)||c&&a===c||(t.setAttribute(u,a),p(n,"updated"))}}(t,d,r,i),r.children||i.children))for(var u=function(e,t){for(var n=[],r=[],i=0;i<l(e,t);i++)!1===e[i]&&!1===t[i]||(n.push(e[i]),r.push(t[i]));return{nChildren:n,oChildren:r}}(r.children,i.children),a=u.nChildren,c=u.oChildren,f=0;f<l(a,c);f++)e(d,a[f],c[f],f);function l(e,t){var n=e.length||0,r=t.length||0;return n>=r?n:r}function h(e,t,n){e.replaceChild(s(n,{mount:!1}),t),p(n,"mounted")}function p(e,t){if(e.events){for(var r=0,i=Object.entries(e.events);r<i.length;r+=1){var o=i[r],d=o[0],u=o[1];d===t&&n.push(u)}v()}}}(u,o,d)})});var a=f(i(),e);function c(){var e;return setTimeout(function(){for(;e=n.pop();)e()})}function f(e,t){if((e="function"==typeof e?e(t):e).children)for(var n=0;n<e.children.length;n++)e.children[n]=f(e.children[n],t);return e}function s(e,t){void 0===t&&(t={});var r=t.mount;void 0===r&&(r=!0);var i=t.initial;void 0===i&&(i=!1);var o=typeof e;if("object"!==o&&"boolean"!==o)return document.createTextNode(e);for(var d=document.createElement(e.element),u=0,a=Object.entries(e);u<a.length;u+=1){var c=a[u],f=c[0],l=c[1];if("text"===f&&d.appendChild(document.createTextNode(l)),"events"===f&&p(l,d,r,i),["children","element","text","events"].includes(f)||d.setAttribute(f,l),"children"===f)for(var h=0;h<l.length;h++)d.appendChild(s(l[h],{mount:r,initial:i}))}return d;function p(e,t,r,i){for(var o=0,d=Object.entries(e);o<d.length;o+=1){var u=d[o],a=u[0],c=u[1];["mounted","unmounted","updated"].includes(a)||t.addEventListener(a,c),f(a,c,r,i)}function f(e,t,r,i){i&&(r&&"mounted"===e&&n.push(t),r||"updated"!==e||n.push(t),v())}}}function v(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}r=Object.assign({},a),u.appendChild(s(a,{initial:!0})),c(),window.addEventListener("__LITERAL_LIFECYCLE__",c)},d=function(n){void 0===n&&(n={});var r=n.methods;void 0===r&&(r=function(){});var i=n.render;return void 0===i&&(i=function(){}),function(n){return void 0===n&&(n={}),function(o){var d=function(t){return void 0===t&&(t=e),Object.assign({},t)},u=function(n){var r=d(),i={oldState:r,nextState:Object.assign({},r,n)};e=i.nextState,t.push(i);var o=new Event("__LITERAL_UPDATE__");return window.dispatchEvent(o)};return i({state:d(o),getState:d,setState:u,props:n,methods:r({getState:d,setState:u})})}}};export default{component:d,render:o,h:i};export{i as h,o as render,d as component};
var e,t,n,i={},r=[],o=[],d=function(e,t){for(var n=[],i=arguments.length-2;i-- >0;)n[i]=arguments[i+2];return"function"==typeof e?e:Object.assign({},{element:e},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,[])})},c=function(r,d,c){void 0===c&&(c={}),i=Object.assign({},i,c),e=document.getElementById(d),t=r;var u=f(r(),i);function a(){for(var e;e=o.pop();)e()}n=Object.assign({},u),e.appendChild(v(u,{initial:!0})),a(),window.addEventListener("__LITERAL_LIFECYCLE__",a)},u=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){return void 0===e&&(e={}),function(i){return n({state:a(i),getState:a,setState:l,props:e,methods:t({getState:a,setState:l})})}}};function a(e){return void 0===e&&(e=i),Object.assign({},e)}function l(d){var c=Object.assign({},a(),d);i=c,r.push(c),function(){var i=r.pop(),d=f(t(),i),c=Object.assign({},n);n=Object.assign({},d),function e(t,n,i,r){void 0===r&&(r=0);if(!t)return;var d=t.childNodes[r];if(!1===i)t.insertBefore(v(n),d),f(n,"mounted");else if(void 0===i)t.appendChild(v(n)),f(n,"mounted");else if(!n&&i)t.removeChild(d),f(i,"unmounted");else if(n&&(function(e,t,n,i){"object"==typeof n&&"object"==typeof i||n!==i&&l(e,t,n);for(var r=0,o=Object.entries(n);r<o.length;r+=1){var d=o[r],c=d[0],u=d[1],a=i[c];"element"===c||"text"===c?u!==a&&l(e,t,n):["children","events","element","text"].includes(c)||a&&u===a||(t.setAttribute(c,u),f(n,"updated"))}}(t,d,n,i),n.children||i.children))for(var c=0;c<(void 0,void 0,(u=n.children.length||0)>=(a=i.children.length||0)?u:a);c++)!1===n.children[c]&&!1===i.children[c]||e(d,n.children[c],i.children[c],c);var u,a;function l(e,t,n){e.replaceChild(v(n,{mount:!1}),t),f(n,"mounted")}function f(e,t){if(e.events){for(var n=0,i=Object.entries(e.events);n<i.length;n+=1){var r=i[n],d=r[0],c=r[1];d===t&&o.push(c)}s()}}}(e,d,c)}()}function f(e,t){if((e="function"==typeof e?e(t):e).children)for(var n=0;n<e.children.length;n++)e.children[n]=f(e.children[n],t);return e}function v(e,t){void 0===t&&(t={});var n=t.mount;void 0===n&&(n=!0);var i=t.initial;void 0===i&&(i=!1);var r=typeof e;if("object"!==r&&"boolean"!==r)return document.createTextNode(e);for(var d=document.createElement(e.element),c=0,u=Object.entries(e);c<u.length;c+=1){var a=u[c],l=a[0],f=a[1];if("text"===l&&d.appendChild(document.createTextNode(f)),"events"===l&&p(f,d,n,i),["children","element","text","events"].includes(l)||d.setAttribute(l,f),"children"===l)for(var h=0;h<f.length;h++)d.appendChild(v(f[h],{mount:n,initial:i}))}return d;function p(e,t,n,i){for(var r=0,d=Object.entries(e);r<d.length;r+=1){var c=d[r],u=c[0],a=c[1];["mounted","unmounted","updated"].includes(u)||t.addEventListener(u,a),l(u,a,n,i)}function l(e,t,n,i){i&&(n&&"mounted"===e&&o.push(t),n||"updated"!==e||o.push(t),s())}}}function s(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}export default{component:u,render:c,h:d};export{d as h,c as render,u 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=[],r={};return{component:function(n){void 0===n&&(n={});var r=n.methods;void 0===r&&(r=function(){});var i=n.render;return void 0===i&&(i=function(){}),function(n){return void 0===n&&(n={}),function(o){var d=function(t){return void 0===t&&(t=e),Object.assign({},t)},u=function(n){var r=d(),i={oldState:r,nextState:Object.assign({},r,n)};e=i.nextState,t.push(i);var o=new Event("__LITERAL_UPDATE__");return window.dispatchEvent(o)};return i({state:d(o),getState:d,setState:u,props:n,methods:r({getState:d,setState:u})})}}},render:function(i,o,d){void 0===d&&(d={});var u=document.getElementById(o);e=Object.assign({},e,d),window.addEventListener("__LITERAL_UPDATE__",function(){return setTimeout(function(){var e=t.pop(),o=f(i(),e.newState),d=Object.assign({},r);return r=Object.assign({},o),function e(t,r,i,o){if(void 0===o&&(o=0),t){var d=t.childNodes[o];if(!1===i)t.insertBefore(s(r),d),p(r,"mounted");else if(void 0===i)t.appendChild(s(r)),p(r,"mounted");else if(!r&&i)t.removeChild(d),p(i,"unmounted");else if(r&&(function(e,t,n,r){"object"==typeof n&&"object"==typeof r||n!==r&&h(e,t,n);for(var i=0,o=Object.entries(n);i<o.length;i+=1){var d=o[i],u=d[0],c=d[1],a=r[u];"element"===u||"text"===u?c!==a&&h(e,t,n):["children","events","element","text"].includes(u)||a&&c===a||(t.setAttribute(u,c),p(n,"updated"))}}(t,d,r,i),r.children||i.children))for(var u=function(e,t){for(var n=[],r=[],i=0;i<v(e,t);i++)!1===e[i]&&!1===t[i]||(n.push(e[i]),r.push(t[i]));return{nChildren:n,oChildren:r}}(r.children,i.children),c=u.nChildren,a=u.oChildren,f=0;f<v(c,a);f++)e(d,c[f],a[f],f)}function v(e,t){var n=e.length||0,r=t.length||0;return n>=r?n:r}function h(e,t,n){e.replaceChild(s(n,{mount:!1}),t),p(n,"mounted")}function p(e,t){if(e.events){for(var r=0,i=Object.entries(e.events);r<i.length;r+=1){var o=i[r],d=o[0],u=o[1];d===t&&n.push(u)}l()}}}(u,o,d)})});var c=f(i(),e);function a(){var e;return setTimeout(function(){for(;e=n.pop();)e()})}function f(e,t){if((e="function"==typeof e?e(t):e).children)for(var n=0;n<e.children.length;n++)e.children[n]=f(e.children[n],t);return e}function s(e,t){void 0===t&&(t={});var r=t.mount;void 0===r&&(r=!0);var i=t.initial;void 0===i&&(i=!1);var o=typeof e;if("object"!==o&&"boolean"!==o)return document.createTextNode(e);for(var d=document.createElement(e.element),u=0,c=Object.entries(e);u<c.length;u+=1){var a=c[u],f=a[0],v=a[1];if("text"===f&&d.appendChild(document.createTextNode(v)),"events"===f&&p(v,d,r,i),["children","element","text","events"].includes(f)||d.setAttribute(f,v),"children"===f)for(var h=0;h<v.length;h++)d.appendChild(s(v[h],{mount:r,initial:i}))}return d;function p(e,t,r,i){for(var o=0,d=Object.entries(e);o<d.length;o+=1){var u=d[o],c=u[0],a=u[1];["mounted","unmounted","updated"].includes(c)||t.addEventListener(c,a),f(c,a,r,i)}function f(e,t,r,i){i&&(r&&"mounted"===e&&n.push(t),r||"updated"!==e||n.push(t),l())}}}function l(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}r=Object.assign({},c),u.appendChild(s(c,{initial:!0})),a(),window.addEventListener("__LITERAL_LIFECYCLE__",a)},h:function(e,t){for(var n=[],r=arguments.length-2;r-- >0;)n[r]=arguments[r+2];return"function"==typeof e?e:Object.assign({},{element:e},t,{children:function e(t,n){for(var r=0;r<t.length;r++)Array.isArray(t[r])?e(t[r],n):n.push(t[r]);return n}(n,[])})}}});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.literaljs=n()}(this,function(){var e,n,t,i={},r=[],o=[];function d(e){return void 0===e&&(e=i),Object.assign({},e)}function c(c){var l=Object.assign({},d(),c);i=l,r.push(l),function(){var i=r.pop(),d=u(n(),i),c=Object.assign({},t);t=Object.assign({},d),function e(n,t,i,r){void 0===r&&(r=0);if(!n)return;var d=n.childNodes[r];if(!1===i)n.insertBefore(a(t),d),v(t,"mounted");else if(void 0===i)n.appendChild(a(t)),v(t,"mounted");else if(!t&&i)n.removeChild(d),v(i,"unmounted");else if(t&&(function(e,n,t,i){"object"==typeof t&&"object"==typeof i||t!==i&&s(e,n,t);for(var r=0,o=Object.entries(t);r<o.length;r+=1){var d=o[r],c=d[0],u=d[1],a=i[c];"element"===c||"text"===c?u!==a&&s(e,n,t):["children","events","element","text"].includes(c)||a&&u===a||(n.setAttribute(c,u),v(t,"updated"))}}(n,d,t,i),t.children||i.children))for(var c=0;c<(void 0,void 0,(u=t.children.length||0)>=(l=i.children.length||0)?u:l);c++)!1===t.children[c]&&!1===i.children[c]||e(d,t.children[c],i.children[c],c);var u,l;function s(e,n,t){e.replaceChild(a(t,{mount:!1}),n),v(t,"mounted")}function v(e,n){if(e.events){for(var t=0,i=Object.entries(e.events);t<i.length;t+=1){var r=i[t],d=r[0],c=r[1];d===n&&o.push(c)}f()}}}(e,d,c)}()}function u(e,n){if((e="function"==typeof e?e(n):e).children)for(var t=0;t<e.children.length;t++)e.children[t]=u(e.children[t],n);return e}function a(e,n){void 0===n&&(n={});var t=n.mount;void 0===t&&(t=!0);var i=n.initial;void 0===i&&(i=!1);var r=typeof e;if("object"!==r&&"boolean"!==r)return document.createTextNode(e);for(var d=document.createElement(e.element),c=0,u=Object.entries(e);c<u.length;c+=1){var l=u[c],s=l[0],v=l[1];if("text"===s&&d.appendChild(document.createTextNode(v)),"events"===s&&p(v,d,t,i),["children","element","text","events"].includes(s)||d.setAttribute(s,v),"children"===s)for(var h=0;h<v.length;h++)d.appendChild(a(v[h],{mount:t,initial:i}))}return d;function p(e,n,t,i){for(var r=0,d=Object.entries(e);r<d.length;r+=1){var c=d[r],u=c[0],a=c[1];["mounted","unmounted","updated"].includes(u)||n.addEventListener(u,a),l(u,a,t,i)}function l(e,n,t,i){i&&(t&&"mounted"===e&&o.push(n),t||"updated"!==e||o.push(n),f())}}}function f(){var e=new Event("__LITERAL_LIFECYCLE__");return window.dispatchEvent(e)}return{component: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){return void 0===e&&(e={}),function(i){return t({state:d(i),getState:d,setState:c,props:e,methods:n({getState:d,setState:c})})}}},render:function(r,d,c){void 0===c&&(c={}),i=Object.assign({},i,c),e=document.getElementById(d),n=r;var f=u(r(),i);function l(){for(var e;e=o.pop();)e()}t=Object.assign({},f),e.appendChild(a(f,{initial:!0})),l(),window.addEventListener("__LITERAL_LIFECYCLE__",l)},h:function(e,n){for(var t=[],i=arguments.length-2;i-- >0;)t[i]=arguments[i+2];return"function"==typeof e?e:Object.assign({},{element:e},n,{children:function e(n,t){for(var i=0;i<n.length;i++)Array.isArray(n[i])?e(n[i],t):t.push(n[i]);return t}(t,[])})}}});
//# sourceMappingURL=index.umd.js.map
{
"name": "literaljs",
"version": "2.4.3",
"version": "2.4.4",
"description": "~1kb JavaScript library for building user interfaces.",

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

@@ -15,5 +15,5 @@ <p align="center">

Build output to build:
1.39 kB: index.js
1.43 kB: index.m.js
1.44 kB: index.umd.js
1.28 kB: index.js
1.29 kB: index.m.js
1.33 kB: index.umd.js
```

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

@@ -45,37 +45,34 @@ import { render, component, h } from '../src';

// test('Lifecycle unmounted works with getState and setState', done => {
// const Comp2 = component({
// render: ({ state, getState, setState }) =>
// h(
// 'button',
// {
// id: 'button',
// test('Lifecycle unmounted works with getState and setState', () => {
// const Comp2 = component({
// render: ({ state, getState, setState }) =>
// h(
// 'button',
// {
// id: 'button',
// events: {
// mounted: () => setState({ show: !getState().show })
// }
// },
// state.show &&
// h('span', {
// events: {
// mounted: () => setState({ show: !getState().show })
// unmounted: () => {
// setState({ count: getState().count + 1 });
// }
// }
// },
// state.show &&
// h('span', {
// events: {
// unmounted: () => {
// console.log('UNMOUNTED!');
// setState({ count: getState().count + 1 });
// expect(getState().count).toBe('2');
// done();
// }
// }
// }),
// h('span', { id: 'count' }, state.count)
// )
// });
// }),
// h('span', { id: 'count' }, state.count)
// )
// });
// const Comp = component({
// render: ({ state }) => h('div', { class: 'container' }, Comp2())
// });
// const Comp = component({
// render: ({ state }) => h('div', { class: 'container' }, Comp2())
// });
// render(Comp, 'root', { show: true, count: 1 });
// render(Comp, 'root', { show: true, count: 1 });
// document.getElementById('button').click();
// // expect(document.getElementById('count').innerHTML).toBe('2');
// });
// document.getElementById('button').click();
// expect(document.getElementById('count').innerHTML).toBe('2');
// });
});

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