debois / elm-mdl

Elm-port of the Material Design Lite CSS/JS library
Apache License 2.0
965 stars 133 forks source link

MDLv2 #212

Closed OvermindDL1 closed 8 years ago

OvermindDL1 commented 8 years ago

MDLv2 is currently being developed, and I noticed something at https://github.com/google/material-design-lite/issues/4578 about:

No more automatic DOM traversal and rendering

The biggest difference between MDLv1 and MDLv2 is how we handle component lifecycles and initialization. Unlike MDLv1, there is no DOM-wide traversals, no implicit upgrading/downgrading, and no automatic rendering of DOM elements. All rendering of DOM is left up to the client. In this way, it is very similar to bootstrap. The DOM structure of a component is considered part of its "public API"; any updates to the DOM structure will be considered a breaking change.

In fact, for a lot of components - such as cards - no Javascript is needed at all. Javascript is only needed for components which provide advanced interaction patterns (e.g. things with ripples), and dynamic functionality (form controls, etc.).

I.E. there are hooks in the javascript to hook into things like virtualdom, however those hooks need to be implemented. Something like how elm-mdl works now does not look like it will work like it is in the future as those hooks will need to be made. Currently virtualdom in elm has no such hooks (or way to call javascript for those hooks without ports, thus no package manager support). Any ideas for resolution? Other than entirely re-implementing the javascript elm-side (which could be done I guess? but sounds painful).

OvermindDL1 commented 8 years ago

Off hand I am not seeing how MDLv2 could hook in to elm while still being a distributable package on the elm package system without just out-right re-implementing the javascript...

OvermindDL1 commented 8 years ago

For note, the main dev area appears to be at: https://github.com/google/material-design-lite/tree/master/packages

debois commented 8 years ago

We'll have to look at it at some point. In the end, MDL v2 must produce DOM elements and will likely use CSS a lot. However they structure their JS, we can presumably emulate what they do in Elm. So I don't necessarily think we'll get in trouble.

debois commented 8 years ago

I'm closing this for now; once MDLv2 comes closer (alpha maybe?), we can re-open and see what we do.

In the mean time, a PR for the beginnings of a port of MDLv2 would be of course be very interesting :)