Bundled output for commit 201bdc702a [skip ci]
This commit is contained in:
parent
201bdc702a
commit
8c5b5c7f30
2 changed files with 4 additions and 4 deletions
4
mithril.min.js
vendored
4
mithril.min.js
vendored
|
|
@ -6,7 +6,7 @@ b(c)},0)}function g(a){var c=e(),d=this;return A(c,[d],function(){return m(c,a(d
|
|||
!1)};d.map(g)["catch"](function(a){g();throw{__error:a};});if(0===d._state.state)return D;if(d._state.error)throw{__error:d._state.error};c=d._state.value}return c}function A(c,d,g,b){var e=c._state;e.derive=g;e.recover=b;e.parents=d.filter(a);w(c,e.parents);n(c,!0);return c}function w(a,c){for(var d=0;d<c.length;d++)c[d]._state.deps[a._state.id]=a,w(a,c[d]._state.parents)}function v(a){for(var c=0;c<a._state.parents.length;c++)delete a._state.parents[c]._state.deps[a._state.id];for(var d in a._state.deps){var c=
|
||||
a._state.deps[d],g=c._state.parents.indexOf(a);-1<g&&c._state.parents.splice(g,1)}a._state.state=2;a._state.deps={}}function F(a){return z(function(c){return a(c())},[this])}function u(a){return z(function(a,c){return a()(c())},[this,a])}function q(){return this._state.value}function B(){return null!=this._state.value&&"function"===typeof this._state.value.toJSON?this._state.value.toJSON():this._state.value}function E(a){return 1===a._state.state}function c(a){return a._state.changed}function a(a){return 2!==
|
||||
a._state.state}function d(a){return a._state.error}var N=0,K=function(){},D={};return{stream:e,merge:function(a){return z(function(){return a.map(function(a){return a()})},a)},combine:z,reject:function(a){var c=e();c.error(a);return c},HALT:D}}(u);w.normalize=function(b){return b instanceof Array?w("[",void 0,void 0,w.normalizeChildren(b),void 0,void 0):null!=b&&"object"!==typeof b?w("#",void 0,void 0,b,void 0,void 0):b};w.normalizeChildren=function(b){for(var e=0;e<b.length;e++)b[e]=w.normalize(b[e]);
|
||||
return b};var O=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,H={},v=function(b){if(null==b||"string"!==typeof b&&!b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b&&void 0===H[b]){for(var e,p,f=[],k={};e=O.exec(b);){var h=e[1],n=e[2];""===h&&""!==n?p=n:"#"===h?k.id=n:"."===h?f.push(n):"["===e[3][0]&&((h=e[6])&&(h=h.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),k[e[4]]=h||!0)}0<f.length&&(k.className=f.join(" "));
|
||||
return b};var O=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,H={},v=function(b){if(null==b||"string"!==typeof b&&null==b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b&&void 0===H[b]){for(var e,p,f=[],k={};e=O.exec(b);){var h=e[1],n=e[2];""===h&&""!==n?p=n:"#"===h?k.id=n:"."===h?f.push(n):"["===e[3][0]&&((h=e[6])&&(h=h.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),k[e[4]]=h||!0)}0<f.length&&(k.className=f.join(" "));
|
||||
H[b]=function(b,e){var g=!1,f,h,m=b.className||b["class"],n;for(n in k)b[n]=k[n];void 0!==m&&(void 0!==b["class"]&&(b["class"]=void 0,b.className=m),void 0!==k.className&&(b.className=k.className+" "+m));for(n in b)if("key"!==n){g=!0;break}e instanceof Array&&1==e.length&&null!=e[0]&&"#"===e[0].tag?h=e[0].children:f=e;return w(p||"div",b.key,g?b:void 0,f,h,void 0)}}var t;null!=arguments[1]&&("object"!==typeof arguments[1]||void 0!==arguments[1].tag||arguments[1]instanceof Array)?f=1:(t=arguments[1],
|
||||
f=2);if(arguments.length===f+1)e=arguments[f]instanceof Array?arguments[f]:[arguments[f]];else for(e=[];f<arguments.length;f++)e.push(arguments[f]);return"string"===typeof b?H[b](t||{},w.normalizeChildren(e)):w(b,t&&t.key,t||{},w.normalizeChildren(e),void 0,void 0)},I=function(b){function e(c,a,d,b,g,e,f){for(;d<b;d++){var h=a[d];null!=h&&r(c,p(h,g,f),e)}}function p(c,a,d){var b=c.tag;null!=c.attrs&&C(c.attrs,c,a);if("string"===typeof b)switch(b){case "#":return c.dom=q.createTextNode(c.children);
|
||||
case "<":return f(c);case "[":var g=q.createDocumentFragment();null!=c.children&&(b=c.children,e(g,b,0,b.length,a,null,d));c.dom=g.firstChild;c.domSize=g.childNodes.length;return g;default:var h=c.tag;switch(c.tag){case "svg":d="http://www.w3.org/2000/svg";break;case "math":d="http://www.w3.org/1998/Math/MathML"}var r=(b=c.attrs)&&b.is,h=d?r?q.createElementNS(d,h,{is:r}):q.createElementNS(d,h):r?q.createElement(h,{is:r}):q.createElement(h);c.dom=h;if(null!=b)for(g in r=d,b)z(c,g,null,b[g],r);null!=
|
||||
|
|
@ -36,6 +36,6 @@ n[r],x=n[r+1],x=""==x||!isNaN(parseInt(x,10)),g=r===n.length-1;""===h&&(h=n.slic
|
|||
1)),e)g[h]=e[h];return b.slice(0,m)}function f(){switch(t.charAt(0)){case "#":return e("hash").slice(t.length);case "?":return e("search").slice(t.length)+e("hash");default:return e("pathname").slice(t.length)+e("search")+e("hash")}}function k(e,f,g){var k={},n={};e=p(e,k,n);if(null!=f){for(var m in f)k[m]=f[m];e=e.replace(/:([^\/]+)/g,function(b,e){delete k[e];return f[e]})}(m=J(k))&&(e+="?"+m);(n=J(n))&&(e+="#"+n);h?(g&&g.replace?b.history.replaceState(null,null,t+e):b.history.pushState(null,null,
|
||||
t+e),b.onpopstate()):b.location.href=t+e}var h="function"===typeof b.history.pushState,n="function"===typeof setImmediate?setImmediate:setTimeout,t="#!";return{setPrefix:function(b){t=b},getPath:f,setPath:k,defineRoutes:function(e,k,g){function l(){var b=f(),m={},h=p(b,m,m);n(function(){for(var f in e){var l=new RegExp("^"+f.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(l.test(h)){h.replace(l,function(){for(var g=f.match(/:[^\/]+/g)||[],h=[].slice.call(arguments,1,-2),
|
||||
l=0;l<g.length;l++)m[g[l].replace(/:|\./g,"")]=decodeURIComponent(h[l]);k(e[f],m,b,f)});return}}g(b,m)})}h?b.onpopstate=l:"#"===t.charAt(0)&&(b.onhashchange=l);l();return l},link:function(b){b.dom.setAttribute("href",t+b.attrs.href);b.dom.onclick=function(e){e.preventDefault();e.redraw=!1;k(b.attrs.href,void 0,void 0)}}}},Q=function(b){var e=0,p=null,f="function"===typeof requestAnimationFrame?requestAnimationFrame:setTimeout;return function(k){var h=Date.now();!0===k||0===e||16<=h-e?(e=h,b()):null===
|
||||
p&&(p=f(function(){p=null;b();e=Date.now()},16-(h-e)))}},M=function(b,e,p,f){f=Q(f);null!=e&&e.setEventCallback(function(b){!1!==b.redraw&&p.publish()});null!=p&&(b.redraw&&p.unsubscribe(b.redraw),p.subscribe(f));return b.redraw=f};v.route=function(b,e,p){var f=P(b);b=function(b,h,n){var t=null,r=null;n=f.defineRoutes(n,function(f,g,l,h){if("function"!==typeof f.view){"function"!==typeof f.render&&(f.render=function(b){return b});var m=function(h){t=l;r=h;e.render(b,f.render(w(h,null,g,void 0,void 0,
|
||||
p&&(p=f(function(){p=null;b();e=Date.now()},16-(h-e)))}},M=function(b,e,p,f){f=Q(f);null!=e&&e.setEventCallback(function(b){!1!==b.redraw&&p.publish()});null!=p&&(b.redraw&&p.unsubscribe(b.redraw),p.subscribe(f));return b.redraw=f};v.route=function(b,e,p){var f=P(b);b=function(b,h,n){var t=null,r="div";n=f.defineRoutes(n,function(f,g,l,h){if("function"!==typeof f.view){"function"!==typeof f.render&&(f.render=function(b){return b});var m=function(h){t=l;r=h;e.render(b,f.render(w(h,null,g,void 0,void 0,
|
||||
void 0)))};"function"!==typeof f.resolve&&(f.resolve=function(){m(r)});l!==t?f.resolve(m,g,l,h):m(r)}else e.render(b,w(f,null,g,void 0,void 0,void 0))},function(){f.setPath(h,null,{replace:!0})});M(b,e,p,n)};b.link=f.link;b.prefix=f.setPrefix;b.set=f.setPath;b.get=f.getPath;return b}(window,I,G);var R={view:function(){}};v.mount=function(b,e){return function(p,f){e.unsubscribe(p.redraw);M(p,b,e,function(){b.render(p,w(null===f?R:f,void 0,void 0,void 0,void 0,void 0))})();null===f&&(e.unsubscribe(p.redraw),
|
||||
delete p.redraw)}}(I,G);v.trust=function(b){return w("<",void 0,void 0,b,void 0,void 0)};v.withAttr=function(b,e,p){return function(f){return e.call(p||this,b in f.currentTarget?f.currentTarget[b]:f.currentTarget.getAttribute(b))}};v.prop=B.stream;v.prop.combine=B.combine;v.prop.reject=B.reject;v.prop.merge=B.merge;v.prop.HALT=B.HALT;v.render=I.render;v.redraw=G.publish;v.request=u.xhr;v.jsonp=u.jsonp;v.version="1.0.0";"undefined"!==typeof module?module.exports=v:window.m=v};
|
||||
Loading…
Add table
Add a link
Reference in a new issue