sinuous
Version:
🧬 Small, fast, reactive render engine
2 lines (1 loc) • 2.31 kB
JavaScript
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).h={})}(this,function(e){var n={},f=[],t="__g";function i(e,n,f,i){if(f){if(n){if(!i){var o=(i=f.previousSibling||e.lastChild)[t];if(o)for(i=i.previousSibling;i&&i[t]!==o;)i=i.previousSibling}for(var r;i&&i!==f;)r=i.nextSibling,e.removeChild(i),i[t]=0,i=r}}else e.textContent=""}var o=0;function r(e,u,s,c){e=s&&s.parentNode||e;var l=typeof u;return u===c||(!u&&0!==u||!0===u?(i(e,c,s),c=null):c&&"string"!=typeof c||!("string"===l||"number"===l&&(u+=""))?"function"===l?n.subscribe(function(){c=r(e,u(),s,c)}):(i(e,c,s),u instanceof Node||(u=n.h(f,u)),11===u.nodeType&&u.firstChild!==u.lastChild&&(u.firstChild[t]=u.lastChild[t]=++o),e.insertBefore(u,s||null),c=u):(null!=c&&e.firstChild?s?(s.previousSibling||e.lastChild).data=u:e.firstChild.data=u:s?e.insertBefore(document.createTextNode(u),s):e.textContent=u,c=u)),c}function u(e,f,t,i,o){if("o"!==e[0]||"n"!==e[1]||f.$o)if("function"==typeof f)f.$t?f.$t(2,u,t,e):n.subscribe(function(){u(e,f(),t,i,o)});else if(o)t.style.setProperty(e,f);else if(i||"data-"===e.slice(0,5)||"aria-"===e.slice(0,5))t.setAttribute(e,f);else if("style"===e)if("string"==typeof f)t.style.cssText=f;else for(e in f)u(e,f[e],t,i,!0);else if("attrs"===e)for(e in f)u(e,f[e],t,!0);else"class"===e&&(e+="Name"),t[e]=f;else!function(e,f,t){f=f.slice(2);var i=n.cleanup(function(){return e.removeEventListener(f,s)});t?e.addEventListener(f,s):i(),(e.t||(e.t={}))[f]=t}(t,e,f)}function s(e){return this.t[e.type](e)}e.api=n,e.context=function(e,t){for(var i in e)n[i]=e[i];function o(){var e,n=f.slice.call(arguments);function i(f){var o=typeof f;if(null==f);else if("string"===o)e?e.appendChild(document.createTextNode(f)):e=t?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f);else if(Array.isArray(f))e||(e=document.createDocumentFragment()),f.forEach(i);else if(f instanceof Node)e?e.appendChild(f):e=f;else if("object"===o)for(var s in f)u(s,f[s],e,t);else if("function"===o)if(e){var c=e.appendChild(document.createTextNode(""));f.$t?f.$t(1,r,e,""):r(e,f,c)}else e=f.apply(null,n.splice(0));else e.appendChild(document.createTextNode(""+f))}for(;n.length;)i(n.shift());return e}return n.h=o,o}});