Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mithril

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mithril - npm Package Compare versions

Comparing version 0.1.32 to 0.1.33

mithril.min.js.map

6

mithril.js

@@ -141,2 +141,5 @@ var m = (function app(window, undefined) {

}
data = data.filter(function(x) {return x != null})
var guid = 0

@@ -146,5 +149,4 @@ for (var i = 0, len = data.length; i < len; i++) {

}
if (shouldMaintainIdentities) {
if (data.indexOf(null) > -1) data = data.filter(function(x) {return x != null})
var keysDiffer = false

@@ -151,0 +153,0 @@ if (data.length != cached.length) keysDiffer = true

/*
Mithril v0.1.32
Mithril v0.1.33
http://github.com/lhorie/mithril.js

@@ -7,3 +7,3 @@ (c) Leo Horie

*/
var m=function a(b,c){function d(a){C=a.document,D=a.location,F=a.cancelAnimationFrame||a.clearTimeout,E=a.requestAnimationFrame||a.setTimeout}function e(){var a,b=[].slice.call(arguments),c=!(null==b[1]||K.call(b[1])!==G||"tag"in b[1]||"subtree"in b[1]),d=c?b[1]:{},e="class"in d?"class":"className",f={tag:"div",attrs:{}},g=[];if(K.call(b[0])!=I)throw new Error("selector in m(selector, attrs, children) should be a string");for(;a=L.exec(b[0]);)if(""===a[1]&&a[2])f.tag=a[2];else if("#"===a[1])f.attrs.id=a[2];else if("."===a[1])g.push(a[2]);else if("["===a[3][0]){var h=M.exec(a[3]);f.attrs[h[1]]=h[3]||(h[2]?"":!0)}g.length>0&&(f.attrs[e]=g.join(" "));var i=b.slice(c?2:1);f.children=1===i.length&&K.call(i[0])===H?i[0]:i;for(var j in d)if(j===e){var k=f.attrs[j];f.attrs[j]=(k&&d[j]?k+" ":k||"")+d[j]}else f.attrs[j]=d[j];return f}function f(a,b,d,j,l,m,n,o,p,q,r){try{(null==l||null==l.toString())&&(l="")}catch(s){l=""}if("retain"===l.subtree)return m;var t=K.call(m),u=K.call(l);if(null==m||t!==u){if(null!=m)if(d&&d.nodes){var v=o-j,w=v+(u===H?l:m.nodes).length;i(d.nodes.slice(v,w),d.slice(v,w))}else m.nodes&&i(m.nodes,m);m=new l.constructor,m.tag&&(m={}),m.nodes=[]}if(u===H){for(var x=0,y=l.length;y>x;x++)K.call(l[x])===H&&(l=l.concat.apply([],l),x--,y=l.length);for(var z=[],A=m.length===l.length,B=0,D=1,E=2,F=3,L={},M=[],O=!1,x=0;x<m.length;x++)m[x]&&m[x].attrs&&null!=m[x].attrs.key&&(O=!0,L[m[x].attrs.key]={action:D,index:x});for(var P=0,x=0,y=l.length;y>x;x++)l[x]&&l[x].attrs&&null==l[x].attrs.key&&(l[x].attrs.key="__mithril__"+P++);if(O){l.indexOf(null)>-1&&(l=l.filter(function(a){return null!=a}));var Q=!1;if(l.length!=m.length)Q=!0;else for(var R,S,x=0;R=m[x],S=l[x];x++)if(R.attrs&&S.attrs&&R.attrs.key!=S.attrs.key){Q=!0;break}if(Q){for(var x=0,y=l.length;y>x;x++)if(l[x]&&l[x].attrs)if(null!=l[x].attrs.key){var T=l[x].attrs.key;L[T]=L[T]?{action:F,index:x,from:L[T].index,element:m.nodes[L[T].index]||C.createElement("div")}:{action:E,index:x}}else M.push({index:x,element:a.childNodes[x]||C.createElement("div")});var U=[];for(var V in L)U.push(L[V]);var W=U.sort(g),X=new Array(m.length);X.nodes=m.nodes.slice();for(var Y,x=0;Y=W[x];x++){if(Y.action===D&&(i(m[Y.index].nodes,m[Y.index]),X.splice(Y.index,1)),Y.action===E){var Z=C.createElement("div");Z.key=l[Y.index].attrs.key,a.insertBefore(Z,a.childNodes[Y.index]||null),X.splice(Y.index,0,{attrs:{key:l[Y.index].attrs.key},nodes:[Z]}),X.nodes[Y.index]=Z}Y.action===F&&(a.childNodes[Y.index]!==Y.element&&null!==Y.element&&a.insertBefore(Y.element,a.childNodes[Y.index]||null),X[Y.index]=m[Y.from],X.nodes[Y.index]=Y.element)}for(var x=0,y=M.length;y>x;x++){var Y=M[x];a.insertBefore(Y.element,a.childNodes[Y.index]||null),X[Y.index]=m[Y.index],X.nodes[Y.index]=Y.element}m=X}}for(var x=0,$=0,y=l.length;y>x;x++){var _=f(a,b,m,o,l[x],m[$],n,o+B||B,p,q,r);_!==c&&(_.nodes.intact||(A=!1),B+=_.$trusted?(_.match(/<[^\/]|\>\s*[^<]/g)||[0]).length:K.call(_)===H?_.length:1,m[$++]=_)}if(!A){for(var x=0,y=l.length;y>x;x++)null!=m[x]&&z.push.apply(z,m[x].nodes);for(var ab,x=0;ab=m.nodes[x];x++)null!=ab.parentNode&&z.indexOf(ab)<0&&i([ab],[m[x]]);l.length<m.length&&(m.length=l.length),m.nodes=z}}else if(null!=l&&u===G){l.attrs||(l.attrs={}),m.attrs||(m.attrs={});var bb=Object.keys(l.attrs),cb=bb.length>("key"in l.attrs?1:0);if((l.tag!=m.tag||bb.join()!=Object.keys(m.attrs).join()||l.attrs.id!=m.attrs.id||"all"==e.redraw.strategy()&&m.configContext&&m.configContext.retain!==!0||"diff"==e.redraw.strategy()&&m.configContext&&m.configContext.retain===!1)&&(m.nodes.length&&i(m.nodes),m.configContext&&typeof m.configContext.onunload===J&&m.configContext.onunload()),K.call(l.tag)!=I)return;var ab,db=0===m.nodes.length;if(l.attrs.xmlns?q=l.attrs.xmlns:"svg"===l.tag?q="http://www.w3.org/2000/svg":"math"===l.tag&&(q="http://www.w3.org/1998/Math/MathML"),db?(ab=l.attrs.is?q===c?C.createElement(l.tag,l.attrs.is):C.createElementNS(q,l.tag,l.attrs.is):q===c?C.createElement(l.tag):C.createElementNS(q,l.tag),m={tag:l.tag,attrs:cb?h(ab,l.tag,l.attrs,{},q):l.attrs,children:null!=l.children&&l.children.length>0?f(ab,l.tag,c,c,l.children,m.children,!0,0,l.attrs.contenteditable?ab:p,q,r):l.children,nodes:[ab]},m.children&&!m.children.nodes&&(m.children.nodes=[]),"select"===l.tag&&l.attrs.value&&h(ab,l.tag,{value:l.attrs.value},{},q),a.insertBefore(ab,a.childNodes[o]||null)):(ab=m.nodes[0],cb&&h(ab,l.tag,l.attrs,m.attrs,q),m.children=f(ab,l.tag,c,c,l.children,m.children,!1,0,l.attrs.contenteditable?ab:p,q,r),m.nodes.intact=!0,n===!0&&null!=ab&&a.insertBefore(ab,a.childNodes[o]||null)),typeof l.attrs.config===J){var eb=m.configContext=m.configContext||{retain:"diff"==e.redraw.strategy()||c},fb=function(a,b){return function(){return a.attrs.config.apply(a,b)}};r.push(fb(l,[ab,!db,eb,m]))}}else if(typeof l!=J){var z;0===m.nodes.length?(l.$trusted?z=k(a,o,l):(z=[C.createTextNode(l)],a.nodeName.match(N)||a.insertBefore(z[0],a.childNodes[o]||null)),m="string number boolean".indexOf(typeof l)>-1?new l.constructor(l):l,m.nodes=z):m.valueOf()!==l.valueOf()||n===!0?(z=m.nodes,p&&p===C.activeElement||(l.$trusted?(i(z,m),z=k(a,o,l)):"textarea"===b?a.value=l:p?p.innerHTML=l:((1===z[0].nodeType||z.length>1)&&(i(m.nodes,m),z=[C.createTextNode(l)]),a.insertBefore(z[0],a.childNodes[o]||null),z[0].nodeValue=l)),m=new l.constructor(l),m.nodes=z):m.nodes.intact=!0}return m}function g(a,b){return a.action-b.action||a.index-b.index}function h(a,b,c,d,e){for(var f in c){var g=c[f],h=d[f];if(f in d&&h===g)"value"===f&&"input"===b&&a.value!=g&&(a.value=g);else{d[f]=g;try{if("config"===f||"key"==f)continue;if(typeof g===J&&0===f.indexOf("on"))a[f]=l(g,a);else if("style"===f&&null!=g&&K.call(g)===G){for(var i in g)(null==h||h[i]!==g[i])&&(a.style[i]=g[i]);for(var i in h)i in g||(a.style[i]="")}else null!=e?"href"===f?a.setAttributeNS("http://www.w3.org/1999/xlink","href",g):"className"===f?a.setAttribute("class",g):a.setAttribute(f,g):f in a&&"list"!==f&&"style"!==f&&"form"!==f&&"type"!==f&&"width"!==f&&"height"!==f?("input"!==b||a[f]!==g)&&(a[f]=g):a.setAttribute(f,g)}catch(j){if(j.message.indexOf("Invalid argument")<0)throw j}}}return d}function i(a,b){for(var c=a.length-1;c>-1;c--)if(a[c]&&a[c].parentNode){try{a[c].parentNode.removeChild(a[c])}catch(d){}b=[].concat(b),b[c]&&j(b[c])}0!=a.length&&(a.length=0)}function j(a){if(a.configContext&&typeof a.configContext.onunload===J&&(a.configContext.onunload(),a.configContext.onunload=null),a.children)if(K.call(a.children)===H)for(var b,c=0;b=a.children[c];c++)j(b);else a.children.tag&&j(a.children)}function k(a,b,c){var d=a.childNodes[b];if(d){var e=1!=d.nodeType,f=C.createElement("span");e?(a.insertBefore(f,d||null),f.insertAdjacentHTML("beforebegin",c),a.removeChild(f)):d.insertAdjacentHTML("beforebegin",c)}else a.insertAdjacentHTML("beforeend",c);for(var g=[];a.childNodes[b]!==d;)g.push(a.childNodes[b]),b++;return g}function l(a,b){return function(c){c=c||event,e.redraw.strategy("diff"),e.startComputation();try{return a.call(b,c)}finally{ab()}}}function m(a){var b=Q.indexOf(a);return 0>b?Q.push(a)-1:b}function n(a){var b=function(){return arguments.length&&(a=arguments[0]),a};return b.toJSON=function(){return a},b}function o(){for(var a,b=0;a=T[b];b++)V[b]&&e.render(a,U[b].view?U[b].view(V[b]):$());Y&&(Y(),Y=null),W=null,X=new Date,e.redraw.strategy("diff")}function p(a){return a.slice(db[e.route.mode].length)}function q(a,b,c){bb={};var d=c.indexOf("?");-1!==d&&(bb=u(c.substr(d+1,c.length)),c=c.substr(0,d));var f=Object.keys(b),g=f.indexOf(c);if(-1!==g)return e.module(a,b[f[g]]),!0;for(var h in b){if(h===c)return e.module(a,b[h]),!0;var i=new RegExp("^"+h.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(i.test(c))return c.replace(i,function(){for(var c=h.match(/:[^\/]+/g)||[],d=[].slice.call(arguments,1,-2),f=0,g=c.length;g>f;f++)bb[c[f].replace(/:|\./g,"")]=decodeURIComponent(d[f]);e.module(a,b[h])}),!0}}function r(a){if(a=a||event,!a.ctrlKey&&!a.metaKey&&2!==a.which){a.preventDefault?a.preventDefault():a.returnValue=!1;for(var b=a.currentTarget||a.srcElement,c="pathname"===e.route.mode&&b.search?u(b.search.slice(1)):{};b&&"A"!=b.nodeName.toUpperCase();)b=b.parentNode;e.route(b[e.route.mode].slice(db[e.route.mode].length),c)}}function s(){"hash"!=e.route.mode&&D.hash?D.hash=D.hash:b.scrollTo(0,0)}function t(a,b){var d={},e=[];for(var f in a){var g=b?b+"["+f+"]":f,h=a[f],i=K.call(h),j=null===h?encodeURIComponent(g):i===G?t(h,g):i===H?h.reduce(function(a,b){return d[g]||(d[g]={}),d[g][b]?a:(d[g][b]=!0,a.concat(encodeURIComponent(g)+"="+encodeURIComponent(b)))},[]).join("&"):encodeURIComponent(g)+"="+encodeURIComponent(h);h!==c&&e.push(j)}return e.join("&")}function u(a){for(var b=a.split("&"),c={},d=0,e=b.length;e>d;d++){var f=b[d].split("="),g=decodeURIComponent(f[0]),h=2==f.length?decodeURIComponent(f[1]):null;null!=c[g]?(K.call(c[g])!==H&&(c[g]=[c[g]]),c[g].push(h)):c[g]=h}return c}function v(a){var b=m(a);i(a.childNodes,R[b]),R[b]=c}function w(a,b){var c=e.prop(b);return a.then(c),c.then=function(c,d){return w(a.then(c,d),b)},c}function x(a,b){function c(a){l=a||j,n.map(function(a){l===i&&a.resolve(m)||a.reject(m)})}function d(a,b,c,d){if((null!=m&&K.call(m)===G||typeof m===J)&&typeof a===J)try{var f=0;a.call(m,function(a){f++||(m=a,b())},function(a){f++||(m=a,c())})}catch(g){e.deferred.onerror(g),m=g,c()}else d()}function f(){var j;try{j=m&&m.then}catch(n){return e.deferred.onerror(n),m=n,l=h,f()}d(j,function(){l=g,f()},function(){l=h,f()},function(){try{l===g&&typeof a===J?m=a(m):l===h&&"function"==typeof b&&(m=b(m),l=g)}catch(f){return e.deferred.onerror(f),m=f,c()}m===k?(m=TypeError(),c()):d(j,function(){c(i)},c,function(){c(l===g&&i)})})}var g=1,h=2,i=3,j=4,k=this,l=0,m=0,n=[];k.promise={},k.resolve=function(a){return l||(m=a,l=g,f()),this},k.reject=function(a){return l||(m=a,l=h,f()),this},k.promise.then=function(a,b){var c=new x(a,b);return l===i?c.resolve(m):l===j?c.reject(m):n.push(c),c.promise}}function y(a){return a}function z(a){if(!a.dataType||"jsonp"!==a.dataType.toLowerCase()){var d=new b.XMLHttpRequest;if(d.open(a.method,a.url,!0,a.user,a.password),d.onreadystatechange=function(){4===d.readyState&&(d.status>=200&&d.status<300?a.onload({type:"load",target:d}):a.onerror({type:"error",target:d}))},a.serialize===JSON.stringify&&a.data&&"GET"!==a.method&&d.setRequestHeader("Content-Type","application/json; charset=utf-8"),a.deserialize===JSON.parse&&d.setRequestHeader("Accept","application/json, text/*"),typeof a.config===J){var e=a.config(d,a);null!=e&&(d=e)}var f="GET"!==a.method&&a.data?a.data:"";if(f&&K.call(f)!=I&&f.constructor!=b.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return d.send(f),d}var g="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),h=C.createElement("script");b[g]=function(d){h.parentNode.removeChild(h),a.onload({type:"load",target:{responseText:d}}),b[g]=c},h.onerror=function(){return h.parentNode.removeChild(h),a.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),b[g]=c,!1},h.onload=function(){return!1},h.src=a.url+(a.url.indexOf("?")>0?"&":"?")+(a.callbackKey?a.callbackKey:"callback")+"="+g+"&"+t(a.data||{}),C.body.appendChild(h)}function A(a,b,c){if("GET"===a.method&&"jsonp"!=a.dataType){var d=a.url.indexOf("?")<0?"?":"&",e=t(b);a.url=a.url+(e?d+e:"")}else a.data=c(b);return a}function B(a,b){var c=a.match(/:[a-z]\w+/gi);if(c&&b)for(var d=0;d<c.length;d++){var e=c[d].slice(1);a=a.replace(c[d],b[e]),delete b[e]}return a}var C,D,E,F,G="[object Object]",H="[object Array]",I="[object String]",J="function",K={}.toString,L=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,M=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/,N=/^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/;d(b);var O,P={appendChild:function(a){O===c&&(O=C.createElement("html")),C.documentElement&&C.documentElement!==a?C.replaceChild(a,C.documentElement):C.appendChild(a),this.childNodes=C.childNodes},insertBefore:function(a){this.appendChild(a)},childNodes:[]},Q=[],R={};e.render=function(a,b,d){var e=[];if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var g=m(a),h=a===C,j=h||a===C.documentElement?P:a;h&&"html"!=b.tag&&(b={tag:"html",attrs:{},children:b}),R[g]===c&&i(j.childNodes),d===!0&&v(a),R[g]=f(j,null,c,c,b,R[g],!1,0,null,c,e);for(var k=0,l=e.length;l>k;k++)e[k]()},e.trust=function(a){return a=new String(a),a.$trusted=!0,a},e.prop=function(a){return(null!=a&&K.call(a)===G||typeof a===J)&&typeof a.then===J?w(a):n(a)};var S,T=[],U=[],V=[],W=null,X=0,Y=null,Z=16;e.module=function(a,b){if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var c=T.indexOf(a);0>c&&(c=T.length);var d=!1;if(V[c]&&typeof V[c].onunload===J){var f={preventDefault:function(){d=!0}};V[c].onunload(f)}if(!d){e.redraw.strategy("all"),e.startComputation(),T[c]=a;var g=S=b=b||{},h=new(b.controller||function(){});return g===S&&(V[c]=h,U[c]=b),ab(),V[c]}},e.redraw=function(a){W&&a!==!0?(new Date-X>Z||E===b.requestAnimationFrame)&&(W>0&&F(W),W=E(o,Z)):(o(),W=E(function(){W=null},Z))},e.redraw.strategy=e.prop();var $=function(){return""},_=0;e.startComputation=function(){_++},e.endComputation=function(){_=Math.max(_-1,0),0===_&&e.redraw()};var ab=function(){"none"==e.redraw.strategy()?(_--,e.redraw.strategy("diff")):e.endComputation()};e.withAttr=function(a,b){return function(c){c=c||event;var d=c.currentTarget||this;b(a in d?d[a]:d.getAttribute(a))}};var bb,cb,db={pathname:"",hash:"#",search:"?"},eb=function(){};return e.route=function(){if(0===arguments.length)return cb;if(3===arguments.length&&K.call(arguments[1])===I){var a=arguments[0],c=arguments[1],d=arguments[2];eb=function(b){var f=cb=p(b);q(a,d,f)||e.route(c,!0)};var f="hash"===e.route.mode?"onhashchange":"onpopstate";b[f]=function(){var a=D[e.route.mode];"pathname"===e.route.mode&&(a+=D.search),cb!=p(a)&&eb(a)},Y=s,b[f]()}else if(arguments[0].addEventListener||arguments[0].attachEvent){{var g=arguments[0];arguments[1],arguments[2]}g.href=("pathname"!==e.route.mode?D.pathname:"")+db[e.route.mode]+this.attrs.href,g.addEventListener?(g.removeEventListener("click",r),g.addEventListener("click",r)):(g.detachEvent("onclick",r),g.attachEvent("onclick",r))}else if(K.call(arguments[0])===I){var h=cb;cb=arguments[0];var i=arguments[1]||{},j=cb.indexOf("?"),k=j>-1?u(cb.slice(j+1)):{};for(var l in i)k[l]=i[l];var m=t(k),n=j>-1?cb.slice(0,j):cb;m&&(cb=n+(-1===n.indexOf("?")?"?":"&")+m);var o=(3===arguments.length?arguments[2]:arguments[1])===!0||h===arguments[0];b.history.pushState?(Y=function(){b.history[o?"replaceState":"pushState"](null,C.title,db[e.route.mode]+cb),s()},eb(db[e.route.mode]+cb)):(D[e.route.mode]=cb,eb(db[e.route.mode]+cb))}},e.route.param=function(a){if(!bb)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return bb[a]},e.route.mode="search",e.route.buildQueryString=t,e.route.parseQueryString=u,e.deferred=function(){var a=new x;return a.promise=w(a.promise),a},e.deferred.onerror=function(a){if("[object Error]"===K.call(a)&&!a.constructor.toString().match(/ Error/))throw a},e.sync=function(a){function b(a,b){return function(e){return g[a]=e,b||(c="reject"),0===--f&&(d.promise(g),d[c](g)),e}}var c="resolve",d=e.deferred(),f=a.length,g=new Array(f);if(a.length>0)for(var h=0;h<a.length;h++)a[h].then(b(h,!0),b(h,!1));else d.resolve([]);return d.promise},e.request=function(a){a.background!==!0&&e.startComputation();var b=new x,c=a.dataType&&"jsonp"===a.dataType.toLowerCase(),d=a.serialize=c?y:a.serialize||JSON.stringify,f=a.deserialize=c?y:a.deserialize||JSON.parse,g=a.extract||function(a){return 0===a.responseText.length&&f===JSON.parse?null:a.responseText};return a.url=B(a.url,a.data),a=A(a,a.data,d),a.onload=a.onerror=function(c){try{c=c||event;var d=("load"===c.type?a.unwrapSuccess:a.unwrapError)||y,h=d(f(g(c.target,a)),c.target);if("load"===c.type)if(K.call(h)===H&&a.type)for(var i=0;i<h.length;i++)h[i]=new a.type(h[i]);else a.type&&(h=new a.type(h));b["load"===c.type?"resolve":"reject"](h)}catch(c){e.deferred.onerror(c),b.reject(c)}a.background!==!0&&e.endComputation()},z(a),b.promise=w(b.promise,a.initialValue),b.promise},e.deps=function(a){return d(b=a||b),b},e.deps.factory=a,e}("undefined"!=typeof window?window:{});"undefined"!=typeof module&&null!==module&&module.exports?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m});
var m=function a(b,c){function d(a){C=a.document,D=a.location,F=a.cancelAnimationFrame||a.clearTimeout,E=a.requestAnimationFrame||a.setTimeout}function e(){var a,b=[].slice.call(arguments),c=!(null==b[1]||K.call(b[1])!==G||"tag"in b[1]||"subtree"in b[1]),d=c?b[1]:{},e="class"in d?"class":"className",f={tag:"div",attrs:{}},g=[];if(K.call(b[0])!=I)throw new Error("selector in m(selector, attrs, children) should be a string");for(;a=L.exec(b[0]);)if(""===a[1]&&a[2])f.tag=a[2];else if("#"===a[1])f.attrs.id=a[2];else if("."===a[1])g.push(a[2]);else if("["===a[3][0]){var h=M.exec(a[3]);f.attrs[h[1]]=h[3]||(h[2]?"":!0)}g.length>0&&(f.attrs[e]=g.join(" "));var i=b.slice(c?2:1);f.children=1===i.length&&K.call(i[0])===H?i[0]:i;for(var j in d)if(j===e){var k=f.attrs[j];f.attrs[j]=(k&&d[j]?k+" ":k||"")+d[j]}else f.attrs[j]=d[j];return f}function f(a,b,d,j,l,m,n,o,p,q,r){try{(null==l||null==l.toString())&&(l="")}catch(s){l=""}if("retain"===l.subtree)return m;var t=K.call(m),u=K.call(l);if(null==m||t!==u){if(null!=m)if(d&&d.nodes){var v=o-j,w=v+(u===H?l:m.nodes).length;i(d.nodes.slice(v,w),d.slice(v,w))}else m.nodes&&i(m.nodes,m);m=new l.constructor,m.tag&&(m={}),m.nodes=[]}if(u===H){for(var x=0,y=l.length;y>x;x++)K.call(l[x])===H&&(l=l.concat.apply([],l),x--,y=l.length);for(var z=[],A=m.length===l.length,B=0,D=1,E=2,F=3,L={},M=[],O=!1,x=0;x<m.length;x++)m[x]&&m[x].attrs&&null!=m[x].attrs.key&&(O=!0,L[m[x].attrs.key]={action:D,index:x});l=l.filter(function(a){return null!=a});for(var P=0,x=0,y=l.length;y>x;x++)l[x]&&l[x].attrs&&null==l[x].attrs.key&&(l[x].attrs.key="__mithril__"+P++);if(O){var Q=!1;if(l.length!=m.length)Q=!0;else for(var R,S,x=0;R=m[x],S=l[x];x++)if(R.attrs&&S.attrs&&R.attrs.key!=S.attrs.key){Q=!0;break}if(Q){for(var x=0,y=l.length;y>x;x++)if(l[x]&&l[x].attrs)if(null!=l[x].attrs.key){var T=l[x].attrs.key;L[T]=L[T]?{action:F,index:x,from:L[T].index,element:m.nodes[L[T].index]||C.createElement("div")}:{action:E,index:x}}else M.push({index:x,element:a.childNodes[x]||C.createElement("div")});var U=[];for(var V in L)U.push(L[V]);var W=U.sort(g),X=new Array(m.length);X.nodes=m.nodes.slice();for(var Y,x=0;Y=W[x];x++){if(Y.action===D&&(i(m[Y.index].nodes,m[Y.index]),X.splice(Y.index,1)),Y.action===E){var Z=C.createElement("div");Z.key=l[Y.index].attrs.key,a.insertBefore(Z,a.childNodes[Y.index]||null),X.splice(Y.index,0,{attrs:{key:l[Y.index].attrs.key},nodes:[Z]}),X.nodes[Y.index]=Z}Y.action===F&&(a.childNodes[Y.index]!==Y.element&&null!==Y.element&&a.insertBefore(Y.element,a.childNodes[Y.index]||null),X[Y.index]=m[Y.from],X.nodes[Y.index]=Y.element)}for(var x=0,y=M.length;y>x;x++){var Y=M[x];a.insertBefore(Y.element,a.childNodes[Y.index]||null),X[Y.index]=m[Y.index],X.nodes[Y.index]=Y.element}m=X}}for(var x=0,$=0,y=l.length;y>x;x++){var _=f(a,b,m,o,l[x],m[$],n,o+B||B,p,q,r);_!==c&&(_.nodes.intact||(A=!1),B+=_.$trusted?(_.match(/<[^\/]|\>\s*[^<]/g)||[0]).length:K.call(_)===H?_.length:1,m[$++]=_)}if(!A){for(var x=0,y=l.length;y>x;x++)null!=m[x]&&z.push.apply(z,m[x].nodes);for(var ab,x=0;ab=m.nodes[x];x++)null!=ab.parentNode&&z.indexOf(ab)<0&&i([ab],[m[x]]);l.length<m.length&&(m.length=l.length),m.nodes=z}}else if(null!=l&&u===G){l.attrs||(l.attrs={}),m.attrs||(m.attrs={});var bb=Object.keys(l.attrs),cb=bb.length>("key"in l.attrs?1:0);if((l.tag!=m.tag||bb.join()!=Object.keys(m.attrs).join()||l.attrs.id!=m.attrs.id||"all"==e.redraw.strategy()&&m.configContext&&m.configContext.retain!==!0||"diff"==e.redraw.strategy()&&m.configContext&&m.configContext.retain===!1)&&(m.nodes.length&&i(m.nodes),m.configContext&&typeof m.configContext.onunload===J&&m.configContext.onunload()),K.call(l.tag)!=I)return;var ab,db=0===m.nodes.length;if(l.attrs.xmlns?q=l.attrs.xmlns:"svg"===l.tag?q="http://www.w3.org/2000/svg":"math"===l.tag&&(q="http://www.w3.org/1998/Math/MathML"),db?(ab=l.attrs.is?q===c?C.createElement(l.tag,l.attrs.is):C.createElementNS(q,l.tag,l.attrs.is):q===c?C.createElement(l.tag):C.createElementNS(q,l.tag),m={tag:l.tag,attrs:cb?h(ab,l.tag,l.attrs,{},q):l.attrs,children:null!=l.children&&l.children.length>0?f(ab,l.tag,c,c,l.children,m.children,!0,0,l.attrs.contenteditable?ab:p,q,r):l.children,nodes:[ab]},m.children&&!m.children.nodes&&(m.children.nodes=[]),"select"===l.tag&&l.attrs.value&&h(ab,l.tag,{value:l.attrs.value},{},q),a.insertBefore(ab,a.childNodes[o]||null)):(ab=m.nodes[0],cb&&h(ab,l.tag,l.attrs,m.attrs,q),m.children=f(ab,l.tag,c,c,l.children,m.children,!1,0,l.attrs.contenteditable?ab:p,q,r),m.nodes.intact=!0,n===!0&&null!=ab&&a.insertBefore(ab,a.childNodes[o]||null)),typeof l.attrs.config===J){var eb=m.configContext=m.configContext||{retain:"diff"==e.redraw.strategy()||c},fb=function(a,b){return function(){return a.attrs.config.apply(a,b)}};r.push(fb(l,[ab,!db,eb,m]))}}else if(typeof l!=J){var z;0===m.nodes.length?(l.$trusted?z=k(a,o,l):(z=[C.createTextNode(l)],a.nodeName.match(N)||a.insertBefore(z[0],a.childNodes[o]||null)),m="string number boolean".indexOf(typeof l)>-1?new l.constructor(l):l,m.nodes=z):m.valueOf()!==l.valueOf()||n===!0?(z=m.nodes,p&&p===C.activeElement||(l.$trusted?(i(z,m),z=k(a,o,l)):"textarea"===b?a.value=l:p?p.innerHTML=l:((1===z[0].nodeType||z.length>1)&&(i(m.nodes,m),z=[C.createTextNode(l)]),a.insertBefore(z[0],a.childNodes[o]||null),z[0].nodeValue=l)),m=new l.constructor(l),m.nodes=z):m.nodes.intact=!0}return m}function g(a,b){return a.action-b.action||a.index-b.index}function h(a,b,c,d,e){for(var f in c){var g=c[f],h=d[f];if(f in d&&h===g)"value"===f&&"input"===b&&a.value!=g&&(a.value=g);else{d[f]=g;try{if("config"===f||"key"==f)continue;if(typeof g===J&&0===f.indexOf("on"))a[f]=l(g,a);else if("style"===f&&null!=g&&K.call(g)===G){for(var i in g)(null==h||h[i]!==g[i])&&(a.style[i]=g[i]);for(var i in h)i in g||(a.style[i]="")}else null!=e?"href"===f?a.setAttributeNS("http://www.w3.org/1999/xlink","href",g):"className"===f?a.setAttribute("class",g):a.setAttribute(f,g):f in a&&"list"!==f&&"style"!==f&&"form"!==f&&"type"!==f&&"width"!==f&&"height"!==f?("input"!==b||a[f]!==g)&&(a[f]=g):a.setAttribute(f,g)}catch(j){if(j.message.indexOf("Invalid argument")<0)throw j}}}return d}function i(a,b){for(var c=a.length-1;c>-1;c--)if(a[c]&&a[c].parentNode){try{a[c].parentNode.removeChild(a[c])}catch(d){}b=[].concat(b),b[c]&&j(b[c])}0!=a.length&&(a.length=0)}function j(a){if(a.configContext&&typeof a.configContext.onunload===J&&(a.configContext.onunload(),a.configContext.onunload=null),a.children)if(K.call(a.children)===H)for(var b,c=0;b=a.children[c];c++)j(b);else a.children.tag&&j(a.children)}function k(a,b,c){var d=a.childNodes[b];if(d){var e=1!=d.nodeType,f=C.createElement("span");e?(a.insertBefore(f,d||null),f.insertAdjacentHTML("beforebegin",c),a.removeChild(f)):d.insertAdjacentHTML("beforebegin",c)}else a.insertAdjacentHTML("beforeend",c);for(var g=[];a.childNodes[b]!==d;)g.push(a.childNodes[b]),b++;return g}function l(a,b){return function(c){c=c||event,e.redraw.strategy("diff"),e.startComputation();try{return a.call(b,c)}finally{ab()}}}function m(a){var b=Q.indexOf(a);return 0>b?Q.push(a)-1:b}function n(a){var b=function(){return arguments.length&&(a=arguments[0]),a};return b.toJSON=function(){return a},b}function o(){for(var a,b=0;a=T[b];b++)V[b]&&e.render(a,U[b].view?U[b].view(V[b]):$());Y&&(Y(),Y=null),W=null,X=new Date,e.redraw.strategy("diff")}function p(a){return a.slice(db[e.route.mode].length)}function q(a,b,c){bb={};var d=c.indexOf("?");-1!==d&&(bb=u(c.substr(d+1,c.length)),c=c.substr(0,d));var f=Object.keys(b),g=f.indexOf(c);if(-1!==g)return e.module(a,b[f[g]]),!0;for(var h in b){if(h===c)return e.module(a,b[h]),!0;var i=new RegExp("^"+h.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(i.test(c))return c.replace(i,function(){for(var c=h.match(/:[^\/]+/g)||[],d=[].slice.call(arguments,1,-2),f=0,g=c.length;g>f;f++)bb[c[f].replace(/:|\./g,"")]=decodeURIComponent(d[f]);e.module(a,b[h])}),!0}}function r(a){if(a=a||event,!a.ctrlKey&&!a.metaKey&&2!==a.which){a.preventDefault?a.preventDefault():a.returnValue=!1;for(var b=a.currentTarget||a.srcElement,c="pathname"===e.route.mode&&b.search?u(b.search.slice(1)):{};b&&"A"!=b.nodeName.toUpperCase();)b=b.parentNode;e.route(b[e.route.mode].slice(db[e.route.mode].length),c)}}function s(){"hash"!=e.route.mode&&D.hash?D.hash=D.hash:b.scrollTo(0,0)}function t(a,b){var d={},e=[];for(var f in a){var g=b?b+"["+f+"]":f,h=a[f],i=K.call(h),j=null===h?encodeURIComponent(g):i===G?t(h,g):i===H?h.reduce(function(a,b){return d[g]||(d[g]={}),d[g][b]?a:(d[g][b]=!0,a.concat(encodeURIComponent(g)+"="+encodeURIComponent(b)))},[]).join("&"):encodeURIComponent(g)+"="+encodeURIComponent(h);h!==c&&e.push(j)}return e.join("&")}function u(a){for(var b=a.split("&"),c={},d=0,e=b.length;e>d;d++){var f=b[d].split("="),g=decodeURIComponent(f[0]),h=2==f.length?decodeURIComponent(f[1]):null;null!=c[g]?(K.call(c[g])!==H&&(c[g]=[c[g]]),c[g].push(h)):c[g]=h}return c}function v(a){var b=m(a);i(a.childNodes,R[b]),R[b]=c}function w(a,b){var c=e.prop(b);return a.then(c),c.then=function(c,d){return w(a.then(c,d),b)},c}function x(a,b){function c(a){l=a||j,n.map(function(a){l===i&&a.resolve(m)||a.reject(m)})}function d(a,b,c,d){if((null!=m&&K.call(m)===G||typeof m===J)&&typeof a===J)try{var f=0;a.call(m,function(a){f++||(m=a,b())},function(a){f++||(m=a,c())})}catch(g){e.deferred.onerror(g),m=g,c()}else d()}function f(){var j;try{j=m&&m.then}catch(n){return e.deferred.onerror(n),m=n,l=h,f()}d(j,function(){l=g,f()},function(){l=h,f()},function(){try{l===g&&typeof a===J?m=a(m):l===h&&"function"==typeof b&&(m=b(m),l=g)}catch(f){return e.deferred.onerror(f),m=f,c()}m===k?(m=TypeError(),c()):d(j,function(){c(i)},c,function(){c(l===g&&i)})})}var g=1,h=2,i=3,j=4,k=this,l=0,m=0,n=[];k.promise={},k.resolve=function(a){return l||(m=a,l=g,f()),this},k.reject=function(a){return l||(m=a,l=h,f()),this},k.promise.then=function(a,b){var c=new x(a,b);return l===i?c.resolve(m):l===j?c.reject(m):n.push(c),c.promise}}function y(a){return a}function z(a){if(!a.dataType||"jsonp"!==a.dataType.toLowerCase()){var d=new b.XMLHttpRequest;if(d.open(a.method,a.url,!0,a.user,a.password),d.onreadystatechange=function(){4===d.readyState&&(d.status>=200&&d.status<300?a.onload({type:"load",target:d}):a.onerror({type:"error",target:d}))},a.serialize===JSON.stringify&&a.data&&"GET"!==a.method&&d.setRequestHeader("Content-Type","application/json; charset=utf-8"),a.deserialize===JSON.parse&&d.setRequestHeader("Accept","application/json, text/*"),typeof a.config===J){var e=a.config(d,a);null!=e&&(d=e)}var f="GET"!==a.method&&a.data?a.data:"";if(f&&K.call(f)!=I&&f.constructor!=b.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return d.send(f),d}var g="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),h=C.createElement("script");b[g]=function(d){h.parentNode.removeChild(h),a.onload({type:"load",target:{responseText:d}}),b[g]=c},h.onerror=function(){return h.parentNode.removeChild(h),a.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),b[g]=c,!1},h.onload=function(){return!1},h.src=a.url+(a.url.indexOf("?")>0?"&":"?")+(a.callbackKey?a.callbackKey:"callback")+"="+g+"&"+t(a.data||{}),C.body.appendChild(h)}function A(a,b,c){if("GET"===a.method&&"jsonp"!=a.dataType){var d=a.url.indexOf("?")<0?"?":"&",e=t(b);a.url=a.url+(e?d+e:"")}else a.data=c(b);return a}function B(a,b){var c=a.match(/:[a-z]\w+/gi);if(c&&b)for(var d=0;d<c.length;d++){var e=c[d].slice(1);a=a.replace(c[d],b[e]),delete b[e]}return a}var C,D,E,F,G="[object Object]",H="[object Array]",I="[object String]",J="function",K={}.toString,L=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,M=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/,N=/^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/;d(b);var O,P={appendChild:function(a){O===c&&(O=C.createElement("html")),C.documentElement&&C.documentElement!==a?C.replaceChild(a,C.documentElement):C.appendChild(a),this.childNodes=C.childNodes},insertBefore:function(a){this.appendChild(a)},childNodes:[]},Q=[],R={};e.render=function(a,b,d){var e=[];if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var g=m(a),h=a===C,j=h||a===C.documentElement?P:a;h&&"html"!=b.tag&&(b={tag:"html",attrs:{},children:b}),R[g]===c&&i(j.childNodes),d===!0&&v(a),R[g]=f(j,null,c,c,b,R[g],!1,0,null,c,e);for(var k=0,l=e.length;l>k;k++)e[k]()},e.trust=function(a){return a=new String(a),a.$trusted=!0,a},e.prop=function(a){return(null!=a&&K.call(a)===G||typeof a===J)&&typeof a.then===J?w(a):n(a)};var S,T=[],U=[],V=[],W=null,X=0,Y=null,Z=16;e.module=function(a,b){if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var c=T.indexOf(a);0>c&&(c=T.length);var d=!1;if(V[c]&&typeof V[c].onunload===J){var f={preventDefault:function(){d=!0}};V[c].onunload(f)}if(!d){e.redraw.strategy("all"),e.startComputation(),T[c]=a;var g=S=b=b||{},h=new(b.controller||function(){});return g===S&&(V[c]=h,U[c]=b),ab(),V[c]}},e.redraw=function(a){W&&a!==!0?(new Date-X>Z||E===b.requestAnimationFrame)&&(W>0&&F(W),W=E(o,Z)):(o(),W=E(function(){W=null},Z))},e.redraw.strategy=e.prop();var $=function(){return""},_=0;e.startComputation=function(){_++},e.endComputation=function(){_=Math.max(_-1,0),0===_&&e.redraw()};var ab=function(){"none"==e.redraw.strategy()?(_--,e.redraw.strategy("diff")):e.endComputation()};e.withAttr=function(a,b){return function(c){c=c||event;var d=c.currentTarget||this;b(a in d?d[a]:d.getAttribute(a))}};var bb,cb,db={pathname:"",hash:"#",search:"?"},eb=function(){};return e.route=function(){if(0===arguments.length)return cb;if(3===arguments.length&&K.call(arguments[1])===I){var a=arguments[0],c=arguments[1],d=arguments[2];eb=function(b){var f=cb=p(b);q(a,d,f)||e.route(c,!0)};var f="hash"===e.route.mode?"onhashchange":"onpopstate";b[f]=function(){var a=D[e.route.mode];"pathname"===e.route.mode&&(a+=D.search),cb!=p(a)&&eb(a)},Y=s,b[f]()}else if(arguments[0].addEventListener||arguments[0].attachEvent){{var g=arguments[0];arguments[1],arguments[2]}g.href=("pathname"!==e.route.mode?D.pathname:"")+db[e.route.mode]+this.attrs.href,g.addEventListener?(g.removeEventListener("click",r),g.addEventListener("click",r)):(g.detachEvent("onclick",r),g.attachEvent("onclick",r))}else if(K.call(arguments[0])===I){var h=cb;cb=arguments[0];var i=arguments[1]||{},j=cb.indexOf("?"),k=j>-1?u(cb.slice(j+1)):{};for(var l in i)k[l]=i[l];var m=t(k),n=j>-1?cb.slice(0,j):cb;m&&(cb=n+(-1===n.indexOf("?")?"?":"&")+m);var o=(3===arguments.length?arguments[2]:arguments[1])===!0||h===arguments[0];b.history.pushState?(Y=function(){b.history[o?"replaceState":"pushState"](null,C.title,db[e.route.mode]+cb),s()},eb(db[e.route.mode]+cb)):(D[e.route.mode]=cb,eb(db[e.route.mode]+cb))}},e.route.param=function(a){if(!bb)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return bb[a]},e.route.mode="search",e.route.buildQueryString=t,e.route.parseQueryString=u,e.deferred=function(){var a=new x;return a.promise=w(a.promise),a},e.deferred.onerror=function(a){if("[object Error]"===K.call(a)&&!a.constructor.toString().match(/ Error/))throw a},e.sync=function(a){function b(a,b){return function(e){return g[a]=e,b||(c="reject"),0===--f&&(d.promise(g),d[c](g)),e}}var c="resolve",d=e.deferred(),f=a.length,g=new Array(f);if(a.length>0)for(var h=0;h<a.length;h++)a[h].then(b(h,!0),b(h,!1));else d.resolve([]);return d.promise},e.request=function(a){a.background!==!0&&e.startComputation();var b=new x,c=a.dataType&&"jsonp"===a.dataType.toLowerCase(),d=a.serialize=c?y:a.serialize||JSON.stringify,f=a.deserialize=c?y:a.deserialize||JSON.parse,g=a.extract||function(a){return 0===a.responseText.length&&f===JSON.parse?null:a.responseText};return a.url=B(a.url,a.data),a=A(a,a.data,d),a.onload=a.onerror=function(c){try{c=c||event;var d=("load"===c.type?a.unwrapSuccess:a.unwrapError)||y,h=d(f(g(c.target,a)),c.target);if("load"===c.type)if(K.call(h)===H&&a.type)for(var i=0;i<h.length;i++)h[i]=new a.type(h[i]);else a.type&&(h=new a.type(h));b["load"===c.type?"resolve":"reject"](h)}catch(c){e.deferred.onerror(c),b.reject(c)}a.background!==!0&&e.endComputation()},z(a),b.promise=w(b.promise,a.initialValue),b.promise},e.deps=function(a){return d(b=a||b),b},e.deps.factory=a,e}("undefined"!=typeof window?window:{});"undefined"!=typeof module&&null!==module&&module.exports?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m});
//# sourceMappingURL=mithril.min.js.map

@@ -5,3 +5,3 @@ {

"keywords": ["mvc", "framework"],
"version": "0.1.32",
"version": "0.1.33",
"author": "Leo Horie <leohorie@hotmail.com>",

@@ -11,3 +11,3 @@ "repository": {"type": "git", "url": "https://github.com/lhorie/mithril"},

"licenses": [{"type": "MIT", "url": "http://opensource.org/licenses/MIT"}],
"files": ["mithril.min.js", "mithril.min.map", "mithril.js", "README.*"]
"files": ["mithril.min.js", "mithril.min.js.map", "mithril.js", "README.*"]
}
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