prateekbh / preact-material-components

preact wrapper for "Material Components for the web"
https://material.preactjs.com
MIT License
553 stars 81 forks source link

Adapter architecture #1280

Open fjorgemota opened 5 years ago

fjorgemota commented 5 years ago

Hey.

First, thanks for the project, it seems to work very well!

Second, and more related to the issues, I have a suggestion for this project: What about move this project from the vanilla to the adapter architecture, as suggested by MDC-Web.

I know that preact is pretty focused on DOM/browsers, but this change would allow a few things I think are cool for the future and maintainability of the project: With the MDC-Web migrating to Typescript in the near future, this change would allow to detect breaking changes easily when upgrading MDC-Web components.

To finalize, there are a few other advantages too, as seen on this discussion on the RMWC project.

What do you think?

cromefire commented 5 years ago

I had in mind to try that in 2.0, but had very little time. I will try to migrate them to that architecture when we start migrating the components

I know that preact is pretty focused on DOM/browsers

It could help with prerendering

prateekbh commented 5 years ago

Let's check it out.

The only thing I ask skeptical about is that if we should undertake the task of rewrite plus reach together.

Preferably I'd want to do re-arch in 3.0 instead

cromefire commented 5 years ago

I mean, it not a breaking-change we can do it in 2.1

fjorgemota commented 5 years ago

Hey.

I throught about suggesting the re-arch to migrate to 3.0, but...to what version of the MDC-Web this project will migrate in 2.0? 0.44? depending on the quantity of the breaking changes we will need to fix, I think it would be useful to already migrate to the adapter interface, which I think should be quite easy to do with the Preact features.

Also, as @cromefire noted, it's not a breaking change: There shouldn't be any user-facing breaking changes, because the adapter is basically internal to the DOM changes of the component...

IMO, my suggestion is: Migrate a few components to experiment, and then decide what todo with the next components. I think the adapter architecture will really help on the long-term, and will avoid a ton of bugs in the future (by using Typescript), and will really help with cool things like pre-rendering and, who knows? better performance. :)

prateekbh commented 5 years ago

Well my only reason to suggest 3.0 was not to block the community from getting 2.0 pmc, may be we should do it in 2.1.0 or something or may be a gradual shift if components one by one

fjorgemota commented 5 years ago

Oh, I see. I wouldn't like to delay or even block the community from getting PMC 2.0, because of this I suggested a gradual shift of components. It shouldn't be that harder according to MDC-Web documentation anyway.

prateekbh commented 5 years ago

Yeah so let's just do them one by one after 2.0

cromefire commented 5 years ago

But I would still like to try it on one or two components

prateekbh commented 5 years ago

Sure, let's do it