kenchris / lit-element

A base class for creating web components using lit-html
BSD 3-Clause "New" or "Revised" License
81 stars 10 forks source link

lit-element framework #20

Open ansarizafar opened 6 years ago

ansarizafar commented 6 years ago

Is there any plan to make lit-element a complete framework with a router, global state management and event emitter or could you please guide me how these features can be used with lit-element and bundled with parceljs

Note: I have found this router for web components with code splitting support https://github.com/skatejs/sk-router

kenchris commented 6 years ago

The point is to stay close to the platform as possible, which means aligning with what is going on with standards etc.

Web components already supports events via EventTarget and it seems that soon we might even have observables: https://github.com/whatwg/dom/issues/544 If that moves forward, making a polyfill that follows the spec would make sense and it could be used well with lit-element

kenchris commented 6 years ago

@filipbech just did a router implementation. I haven't thought a lot about that myself, as I normally just do a custom one for my projects. I also think a lot will happen in this area with code splitting etc

Now we finally have ES6 modules and Chrome even has dynamic imports - that opens up a whole new world on how to do this. Mixed with HTTP 2.0 Server Push, it should be possible to do PRPL pattern in a nice way where the server knows what resources goes with others and can create bundles on the fly (HTTP 2.0 Server push can send multiple files as one response, so that serves like a bundle - and it can do it on demand).

Google has https://github.com/Polymer/prpl-server-node for this, but I haven't actually tried it with ES6 modules yet.

filipbech commented 6 years ago

yeah, I built a simple element-router that is meant for webcomponents - I was thinking about lit-element when I made it, but didn't make a depend on it... https://github.com/filipbech/element-router

But I agree to Kenneths point that lit-element should stay as close to the platform as possible... be the sugar that makes writing webcomponents as easy as writing react components.

Router and stateManagement in the react philosophy are independent this... but you could go a long way with litElement, element-router and redux or something similar