You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
snabbdom/dist/snabbdom.min.js

1 line
4.9 KiB
JavaScript

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.snabbdom=e()}}(function(){return function e(t,n,r){function o(l,f){if(!n[l]){if(!t[l]){var a="function"==typeof require&&require;if(!f&&a)return a(l,!0);if(i)return i(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[l]={exports:{}};t[l][0].call(d.exports,function(e){var n=t[l][1][e];return o(n?n:e)},d,d.exports,e,t,n,r)}return n[l].exports}for(var i="function"==typeof require&&require,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(e,t,n){function r(e){return document.createElement(e)}function o(e,t){return document.createElementNS(e,t)}function i(e){return document.createTextNode(e)}function l(e,t,n){e.insertBefore(t,n)}function f(e,t){e.removeChild(t)}function a(e,t){e.appendChild(t)}function u(e){return e.parentElement}function d(e){return e.nextSibling}function c(e){return e.tagName}function s(e,t){e.textContent=t}t.exports={createElement:r,createElementNS:o,createTextNode:i,appendChild:a,removeChild:f,insertBefore:l,parentNode:u,nextSibling:d,tagName:c,setTextContent:s}},{}],2:[function(e,t,n){t.exports={array:Array.isArray,primitive:function(e){return"string"==typeof e||"number"==typeof e}}},{}],3:[function(e,t,n){"use strict";function r(e){return void 0===e}function o(e){return void 0!==e}function i(e,t){return e.key===t.key&&e.sel===t.sel}function l(e,t,n){var r,i,l={};for(r=t;r<=n;++r)i=e[r].key,o(i)&&(l[i]=r);return l}function f(e,t){function n(e){var n=e.id?"#"+e.id:"",r=e.className?"."+e.className.split(" ").join("."):"";return a(t.tagName(e).toLowerCase()+n+r,{},[],void 0,e)}function f(e,n){return function(){if(0===--n){var r=t.parentNode(e);t.removeChild(r,e)}}}function m(e,n){var r,i=e.data;o(i)&&o(r=i.hook)&&o(r=r.init)&&(r(e),i=e.data);var l,f=e.children,a=e.sel;if(o(a)){var d=a.indexOf("#"),s=a.indexOf(".",d),p=d>0?d:a.length,h=s>0?s:a.length,v=d!==-1||s!==-1?a.slice(0,Math.min(p,h)):a;if(l=e.elm=o(i)&&o(r=i.ns)?t.createElementNS(r,v):t.createElement(v),p<h&&(l.id=a.slice(p+1,h)),s>0&&(l.className=a.slice(h+1).replace(/\./g," ")),u.array(f))for(r=0;r<f.length;++r)t.appendChild(l,m(f[r],n));else u.primitive(e.text)&&t.appendChild(l,t.createTextNode(e.text));for(r=0;r<C.create.length;++r)C.create[r](c,e);r=e.data.hook,o(r)&&(r.create&&r.create(c,e),r.insert&&n.push(e))}else l=e.elm=t.createTextNode(e.text);return e.elm}function p(e,n,r,o,i,l){for(;o<=i;++o)t.insertBefore(e,m(r[o],l),n)}function h(e){var t,n,r=e.data;if(o(r)){for(o(t=r.hook)&&o(t=t.destroy)&&t(e),t=0;t<C.destroy.length;++t)C.destroy[t](e);if(o(t=e.children))for(n=0;n<e.children.length;++n)h(e.children[n])}}function v(e,n,r,i){for(;r<=i;++r){var l,a,u,d=n[r];if(o(d))if(o(d.sel)){for(h(d),a=C.remove.length+1,u=f(d.elm,a),l=0;l<C.remove.length;++l)C.remove[l](d,u);o(l=d.data)&&o(l=l.hook)&&o(l=l.remove)?l(d,u):u()}else t.removeChild(e,d.elm)}}function x(e,n,o,f){for(var a,u,d,c,s=0,h=0,x=n.length-1,y=n[0],N=n[x],C=o.length-1,k=o[0],b=o[C];s<=x&&h<=C;)r(y)?y=n[++s]:r(N)?N=n[--x]:i(y,k)?(g(y,k,f),y=n[++s],k=o[++h]):i(N,b)?(g(N,b,f),N=n[--x],b=o[--C]):i(y,b)?(g(y,b,f),t.insertBefore(e,y.elm,t.nextSibling(N.elm)),y=n[++s],b=o[--C]):i(N,k)?(g(N,k,f),t.insertBefore(e,N.elm,y.elm),N=n[--x],k=o[++h]):(r(a)&&(a=l(n,s,x)),u=a[k.key],r(u)?(t.insertBefore(e,m(k,f),y.elm),k=o[++h]):(d=n[u],g(d,k,f),n[u]=void 0,t.insertBefore(e,d.elm,y.elm),k=o[++h]));s>x?(c=r(o[C+1])?null:o[C+1].elm,p(e,c,o,h,C,f)):h>C&&v(e,n,s,x)}function g(e,n,l){var f,a;o(f=n.data)&&o(a=f.hook)&&o(f=a.prepatch)&&f(e,n);var u=n.elm=e.elm,d=e.children,c=n.children;if(e!==n){if(!i(e,n)){var s=t.parentNode(e.elm);return u=m(n,l),t.insertBefore(s,u,e.elm),void v(s,[e],0,0)}if(o(n.data)){for(f=0;f<C.update.length;++f)C.update[f](e,n);f=n.data.hook,o(f)&&o(f=f.update)&&f(e,n)}r(n.text)?o(d)&&o(c)?d!==c&&x(u,d,c,l):o(c)?(o(e.text)&&t.setTextContent(u,""),p(u,null,c,0,c.length-1,l)):o(d)?v(u,d,0,d.length-1):o(e.text)&&t.setTextContent(u,""):e.text!==n.text&&t.setTextContent(u,n.text),o(a)&&o(f=a.postpatch)&&f(e,n)}}var y,N,C={};for(r(t)&&(t=d),y=0;y<s.length;++y)for(C[s[y]]=[],N=0;N<e.length;++N)void 0!==e[N][s[y]]&&C[s[y]].push(e[N][s[y]]);return function(e,o){var l,f,a,u=[];for(l=0;l<C.pre.length;++l)C.pre[l]();for(r(e.sel)&&(e=n(e)),i(e,o)?g(e,o,u):(f=e.elm,a=t.parentNode(f),m(o,u),null!==a&&(t.insertBefore(a,o.elm,t.nextSibling(f)),v(a,[e],0,0))),l=0;l<u.length;++l)u[l].data.hook.insert(u[l]);for(l=0;l<C.post.length;++l)C.post[l]();return o}}var a=e("./vnode"),u=e("./is"),d=e("./htmldomapi"),c=a("",{},[],void 0,void 0),s=["create","update","remove","destroy","pre","post"];t.exports={init:f}},{"./htmldomapi":1,"./is":2,"./vnode":4}],4:[function(e,t,n){t.exports=function(e,t,n,r,o){var i=void 0===t?void 0:t.key;return{sel:e,data:t,children:n,text:r,elm:o,key:i}}},{}]},{},[3])(3)});null//# sourceMappingURL=snabbdom.min.js.mapnull