From 54599d9675731c025d8c6ec8f401e58191cdf984 Mon Sep 17 00:00:00 2001 From: Gandalf-the-Bot Date: Fri, 2 Dec 2016 18:23:46 +0000 Subject: [PATCH 1/3] Bundled output for commit f54f15d4ce748659dcdb9dbd53654ae55b71d143 [skip ci] --- README.md | 2 +- mithril.js | 3 ++- mithril.min.js | 28 ++++++++++++++-------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 71c22280..e1be8c2b 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,6 @@ There are over 4000 assertions in the test suite, and tests cover even difficult ## Modularity -Despite the huge improvements in performance and modularity, the new codebase is smaller than v0.2.x, currently clocking at 7.41 KB min+gzip +Despite the huge improvements in performance and modularity, the new codebase is smaller than v0.2.x, currently clocking at 7.42 KB min+gzip In addition, Mithril is now completely modular: you can import only the modules that you need and easily integrate 3rd party modules if you wish to use a different library for routing, ajax, and even rendering diff --git a/mithril.js b/mithril.js index 5ba769ea..46f2ae23 100644 --- a/mithril.js +++ b/mithril.js @@ -1117,7 +1117,8 @@ m.withAttr = function(attrName, callback1, context) { return callback1.call(context || this, attrName in e.currentTarget ? e.currentTarget[attrName] : e.currentTarget.getAttribute(attrName)) } } -m.render = redrawService.render +var _27 = coreRenderer(window) +m.render = _27.render m.redraw = redrawService.redraw m.request = requestService.request m.jsonp = requestService.jsonp diff --git a/mithril.min.js b/mithril.min.js index 909ccbdd..7935777e 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1,20 +1,20 @@ -new function(){function n(a,h,l,b,f,k){return{tag:a,key:h,attrs:l,children:b,text:f,dom:k,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function A(a){if(null==a||"string"!==typeof a&&null==a.view)throw Error("The selector must be either a string or a component.");if("string"===typeof a&&void 0===I[a]){for(var h,l,b=[],f={};h=N.exec(a);){var k=h[1],v=h[2];""===k&&""!==v?l=v:"#"===k?f.id=v:"."===k?b.push(v):"["===h[3][0]&&((k=h[6])&&(k=k.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")), +new function(){function n(a,h,l,b,f,k){return{tag:a,key:h,attrs:l,children:b,text:f,dom:k,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function A(a){if(null==a||"string"!==typeof a&&null==a.view)throw Error("The selector must be either a string or a component.");if("string"===typeof a&&void 0===I[a]){for(var h,l,b=[],f={};h=O.exec(a);){var k=h[1],v=h[2];""===k&&""!==v?l=v:"#"===k?f.id=v:"."===k?b.push(v):"["===h[3][0]&&((k=h[6])&&(k=k.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")), "class"===h[4]?b.push(k):f[h[4]]=k||!0)}0a.indexOf("?")?"?":"&";a+=f+d}return a}function v(a){try{return""!== +l)})};"undefined"===typeof Promise&&("undefined"!==typeof window?window.Promise=t:"undefined"!==typeof global&&(global.Promise=t));var E=function(a){function h(a,b){if(b instanceof Array)for(var f=0;fa.indexOf("?")?"?":"&";a+=f+d}return a}function v(a){try{return""!== a?JSON.parse(a):null}catch(w){throw Error(a);}}function p(a){return a.responseText}function q(a,b){if("function"===typeof a)if(b instanceof Array)for(var d=0;dm.status||304===m.status)b(q(d.type,a));else{var f=Error(m.responseText),k;for(k in a)f[k]=a[k];h(f)}}catch(H){h(H)}}; +r&&m.setRequestHeader("Content-Type","application/json; charset=utf-8");d.deserialize===v&&m.setRequestHeader("Accept","application/json, text/*");d.withCredentials&&(m.withCredentials=d.withCredentials);"function"===typeof d.config&&(m=d.config(m,d)||m);m.onreadystatechange=function(){if(4===m.readyState)try{var a=d.extract!==p?d.extract(m,d):d.deserialize(d.extract(m,d));if(200<=m.status&&300>m.status||304===m.status)b(q(d.type,a));else{var f=Error(m.responseText),k;for(k in a)f[k]=a[k];h(f)}}catch(G){h(G)}}; r&&null!=d.data?m.send(d.data):m.send()}))},jsonp:function(d){return b(new h(function(b,h){var m=d.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+n++,r=a.document.createElement("script");a[m]=function(f){r.parentNode.removeChild(r);b(q(d.type,f));delete a[m]};r.onerror=function(){r.parentNode.removeChild(r);h(Error("JSONP request failed"));delete a[m]};null==d.data&&(d.data={});d.url=f(d.url,d.data);d.data[d.callbackKey||"callback"]=m;r.src=k(d.url,d.data);a.document.documentElement.appendChild(r)}))}, -setCompletionCallback:function(a){m=a}}}(window,"undefined"!==typeof Promise?Promise:t),O=function(a){function h(g,c,a,b,d,f,h){for(;a=m&&u>=y;){var x=c[m],n=a[y];if(x!==n||e)if(null==x)m++;else if(null==n)y++;else if(x.key===n.key)m++,y++,k(g,x,n,d,p(c,m,b),e,f),e&&x.tag===n.tag&&q(g,v(x),b);else if(x=c[z],x!==n||e)if(null==x)z--;else if(null==n)y++;else if(x.key===n.key)k(g,x,n,d,p(c,z+1,b),e,f),(e||y= m&&u>=y;){x=c[z];n=a[u];if(x!==n||e)if(null==x)z--;else{if(null!=n)if(x.key===n.key)k(g,x,n,d,p(c,z+1,b),e,f),e&&x.tag===n.tag&&q(g,v(x),b),null!=x.dom&&(b=x.dom),z--;else{if(!w){w=c;var x=z,D={},t;for(t=0;t Date: Fri, 2 Dec 2016 10:43:47 -0800 Subject: [PATCH 2/3] Break out m.sync removal, it's important --- docs/v1.x-migration.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/v1.x-migration.md b/docs/v1.x-migration.md index 931f7689..ede1dc92 100644 --- a/docs/v1.x-migration.md +++ b/docs/v1.x-migration.md @@ -17,6 +17,7 @@ - [Accessing route params](#accessing-route-params) - [Preventing unmounting](#preventing-unmounting) - [`m.request`](#mrequest) +- [`m.sync` removed](#msync-removed) - [`xlink` namespace required](#xlink-namespace-required) - [Nested arrays in views](#nested-arrays-in-views) - [`vnode` equality checks](#vnode-equality-checks) @@ -25,7 +26,7 @@ ## `m.prop` removed -In `v1.x`, `m.prop` is now a more powerful stream micro-library, but it's no longer part of core. +In `v1.x`, `m.prop()` is now a more powerful stream micro-library, but it's no longer part of core. ### `v0.2.x` @@ -475,7 +476,13 @@ setTimeout(function() { }, 1000) ``` -The equivalent of `m.sync` is now `Promise.all` +Additionally, if the `extract` option is passed to `m.request` the return value of the provided function will be used directly to resolve its promise, and the `deserialize` callback is ignored. + +--- + +## `m.sync` removed + +`m.sync` has been removed in favor of `Promise.all` ### `v0.2.x` @@ -501,8 +508,6 @@ Promise.all([ }) ``` -Additionally, if the `extract` option is passed to `m.request` the return value of the provided function will be used directly to resolve its promise, and the `deserialize` callback is ignored. - --- ## `xlink` namespace required From a07a662a821c4437c0b65aadeda9fb649ddba69e Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Fri, 2 Dec 2016 12:30:52 -0800 Subject: [PATCH 3/3] Document removal of sync redraw (#1447) --- docs/v1.x-migration.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/v1.x-migration.md b/docs/v1.x-migration.md index ede1dc92..38bb000a 100644 --- a/docs/v1.x-migration.md +++ b/docs/v1.x-migration.md @@ -21,6 +21,7 @@ - [`xlink` namespace required](#xlink-namespace-required) - [Nested arrays in views](#nested-arrays-in-views) - [`vnode` equality checks](#vnode-equality-checks) +- [Synchronous redraw removed](#synchronous-redraw-removed) --- @@ -543,3 +544,21 @@ Arrays now represent [fragments](fragment.md), which are structurally significan ## `vnode` equality checks If a vnode is strictly equal to the vnode occupying its place in the last draw, v1.x will skip that part of the tree without checking for mutations or triggering any lifecycle methods in the subtree. The component documentation contains [more detail on this issue](components.md#avoid-creating-component-instances-outside-views). + +--- + +## Synchronous redraw removed + +In v0.2.x it was possible to force mithril to redraw immediately by passing a truthy value to `m.redraw()`. This behavior complicated usage of `m.redraw()` and caused some hard-to-reason about issues and has been removed. + +### `v0.2.x` + +```javascript +m.redraw(true); // redraws immediately & synchronously +``` + +### `v1.x` + +```javascript +m.redraw(); // schedules a redraw on the next requestAnimationFrame tick +```