UNPKG

pop

Version:

Pop is a [Hyperapp](https://github.com/hyperapp/hyperapp) / [Ultradom](https://github.com/ultradom/ultradom) spin-off project — yet another micro-framework for creating graphical user interfaces. This is not the final title, but let's go with that for now

2 lines 3.02 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.Pop=n()}(this,function(){"use strict";function N(e,n){var t={};for(var r in e)t[r]=e[r];for(var r in n)t[r]=n[r];return t}function i(e){return e.currentTarget.events[e.type](e)}function g(e,n,t,r,o){if("key"===n);else if("style"===n)for(var l in N(r,t)){var u=null==t||null==t[l]?"":t[l];"-"===l[0]?e[n].setProperty(l,u):e[n][l]=u}else"o"===n[0]&&"n"===n[1]?(e.events||(e.events={}),(e.events[n=n.slice(2)]=t)?r||e.addEventListener(n,i):e.removeEventListener(n,i)):n in e&&"list"!==n&&!o?e[n]=null==t?"":t:null!=t&&!1!==t&&e.setAttribute(n,t),null!=t&&!1!==t||e.removeAttribute(n)}function b(e,n,t){function r(){e.removeChild(function e(n,t){var r=t.attributes;if(r){for(var o=0;o<t.children.length;o++)e(n.childNodes[o],t.children[o]);r.ondestroy&&r.ondestroy(n)}return n}(n,t))}var o=t.attributes&&t.attributes.onremove;o?o(n,r):r()}function k(e){return e?e.key:null}function w(e,n,t,r,o,l,u){if(r===t);else if(null==t||t.nodeName!==r.nodeName){var i=function e(n,t,r){var o="string"==typeof n||"number"==typeof n?document.createTextNode(n):(r=r||"svg"===n.nodeName)?document.createElementNS("http://www.w3.org/2000/svg",n.nodeName):document.createElement(n.nodeName),l=n.attributes;if(l){l.oncreate&&t.push(function(){l.oncreate(o)});for(var u=0;u<n.children.length;u++)o.appendChild(e(n.children[u],t,r));for(var i in l)g(o,i,l[i],null,r)}return o}(r,o,u);e&&(e.insertBefore(i,n),null!=t&&b(e,n,t)),n=i}else if(null==t.nodeName)n.nodeValue=r;else{!function(e,n,t,r,o,l){for(var u in N(n,t))t[u]!==("value"===u||"checked"===u?e[u]:n[u])&&g(e,u,t[u],n[u],l);var i=o?t.oncreate:t.onupdate;i&&r.push(function(){i(e,n)})}(n,t.attributes,r.attributes,o,l,u=u||"svg"===r.nodeName);for(var a={},f={},d=[],c=t.children,s=r.children,v=0;v<c.length;v++){d[v]=n.childNodes[v],null!=(p=k(c[v]))&&(a[p]=[d[v],c[v]])}v=0;for(var h=0;h<s.length;){var p=k(c[v]),m=k(s[h]);if(f[p])v++;else if(null==m||l)null==p&&(w(n,d[v],c[v],s[h],o,l,u),h++),v++;else{var y=a[m]||[];p===m?(w(n,y[0],y[1],s[h],o,l,u),v++):y[0]?w(n,n.insertBefore(y[0],d[v]),y[1],s[h],o,l,u):w(n,d[v],null,s[h],o,l,u),f[m]=s[h],h++}}for(;v<c.length;)null==k(c[v])&&b(n,d[v],c[v]),v++;for(var v in a)f[v]||b(n,a[v][0],a[v][1])}return n}function r(e,n){var t=[];for((n=n?w(n.parentNode,n,null==n.node?function n(e,t){return{nodeName:e.nodeName.toLowerCase(),attributes:{},children:t.call(e.childNodes,function(e){return 3===e.nodeType?e.nodeValue:n(e,t)})}}(n,[].map):n.node,e,t,null==n.node):w(null,null,null,e,t)).node=e;t.length;)t.pop()();return n}return{h:function(e,n){for(var t=[],r=[],o=arguments.length;2<o--;)t.push(arguments[o]);for(;t.length;){var l=t.pop();if(l&&l.pop)for(o=l.length;o--;)t.push(l[o]);else null!=l&&!0!==l&&!1!==l&&r.push(l)}return"function"==typeof e?e(n||{},r):{nodeName:e,attributes:n||{},children:r,key:n&&n.key}},create:function(e,n){var t=r(n(e),t);return t}}}); //# sourceMappingURL=pop.js.map