Deservicify core (#2458)

* De-servicify router (mostly)

Still uses the redraw service, but it no longer has an intermediate
service of its own.

Also, did a *lot* of test deduplication in this. About 30-40% of the
router service tests were already tested on the main router API instance
itself.

Bundle size decreased from 9560 to 9548 bytes min+gzip.

* Merge `m.mount` + `m.redraw`, update router

Simplifies the router and redraw mechanism, and makes it much easier to
keep predictable.

Bundle size down to 9433 bytes min+gzip, docs updated accordingly.

* Make `mithril/render` just return the `m.render` function directly.

* Deservicify `m.render`, revise `m.route`

- You now have to use `mithril/render/render` directly if you want an
  implicit redraw function. (This will likely be going away in v3.)
- Revise `m.route` to only `key` components

* Add `redraw` to `m.render`, deservicify requests

* Test error logging

* Update docs + changelog [skip ci]
This commit is contained in:
Isiah Meadows 2019-07-07 18:28:43 -04:00 committed by GitHub
parent db277217f8
commit 1f4b2cf49a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 1212 additions and 1393 deletions

View file

@ -9,7 +9,7 @@ o.spec("attributes", function() {
o.beforeEach(function() {
$window = domMock()
root = $window.document.body
render = vdom($window).render
render = vdom($window)
})
o.spec("basics", function() {
o("works (create/update/remove)", function() {
@ -255,7 +255,7 @@ o.spec("attributes", function() {
o("isn't set when equivalent to the previous value and focused", function() {
var $window = domMock({spy: o.spy})
var root = $window.document.body
var render = vdom($window).render
var render = vdom($window)
var a = {tag: "input"}
var b = {tag: "input", attrs: {value: "1"}}
@ -294,7 +294,7 @@ o.spec("attributes", function() {
o("the input.type setter is never used", function() {
var $window = domMock({spy: o.spy})
var root = $window.document.body
var render = vdom($window).render
var render = vdom($window)
var a = {tag: "input", attrs: {type: "radio"}}
var b = {tag: "input", attrs: {type: "text"}}
@ -334,7 +334,7 @@ o.spec("attributes", function() {
o("isn't set when equivalent to the previous value and focused", function() {
var $window = domMock({spy: o.spy})
var root = $window.document.body
var render = vdom($window).render
var render = vdom($window)
var a = {tag: "textarea"}
var b = {tag: "textarea", attrs: {value: "1"}}
@ -480,7 +480,7 @@ o.spec("attributes", function() {
o("isn't set when equivalent to the previous value", function() {
var $window = domMock({spy: o.spy})
var root = $window.document.body
var render = vdom($window).render
var render = vdom($window)
var a = {tag: "option"}
var b = {tag: "option", attrs: {value: "1"}}
@ -618,7 +618,7 @@ o.spec("attributes", function() {
o("updates with the same value do not re-set the attribute if the select has focus", function() {
var $window = domMock({spy: o.spy})
var root = $window.document.body
var render = vdom($window).render
var render = vdom($window)
var a = makeSelect()
var b = makeSelect("1")