New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering interface for Component libraries and shared logic in Dart web rendering frameworks #21
Comments
Considering the current state of dart web frameworks I think it'd cool to have the ability to switch underlying framework(deact, jaspr, dawn, rad etc.). Not only it'll help share component libraries and logic(as you said), it'll also help users keep their apps up and running in case the framework they're using is no longer maintained. I see the problem with the
If you/others have something else in mind, I'm open to discuss that as well. Thanks |
Sorry for the late response. Thanks for the comment! This is a great idea, I will try to find time to implement your idea and perhaps modify rad to use the interfaces. I think I will use bootstrap and perhaps some hooks or routing as a case study for the new package. Also if anyone else would like to try to define a set of interfaces or discuss more design ideas, that would be great! Thanks |
Two things,
|
Yeah, I agree that it is still early for some, but I think (or hope) that people will see the usefulness of sharing code. If a framework author can support bootstrap, material design components, hooks, routing and other stuff out-of-the-box by implementing a couple of interfaces, they will at least think about it. And it will also be an exploration for the future, when everything is more mature. bootstrap_dart's interface already uses hooks for state nodes and I think some other hooks could be implemented, maybe bring some ideas from the react community or maybe with these ones that are already implemented. I agree that Routing would be harder, but maybe a simple implementation could show the usefulness, I was implementing an SPA deact router and there is also jaspr_router, maybe those could be a starting point. |
I think we(you?) should create a separate repository( |
I'm going to close this for now. I'll happily contribute & implement web_interface but as I mentioned above, this conversation has to be moved in a dedicated repository so that we can invite others and see if they're interested. Thanks |
Hi, thanks for you work!
I have been building the web bootstrap components bindings in this repo. At the moment it supports three different frameworks: deact, jaspr and rad. I have implemented bindings for each of the frameworks separately in different packages. You can view all the implemented bootstrap components in the deployed page, that page renders the components with
package:deact
. Another deact example is this one and a jaspr example is this one. At the moment, I have not implemented any rad examples.Maybe it would be nice to collaborate on a shared interface between the Dart web frameworks, perhaps something similar to what bootstrap_dart is doing, but where the libraries implement them natively. You can view the Dart interface in the readme of the repo.
Perhaps a "web_rendering_interface" package that exposes interfaces like Ref, State, BuildContext, Component, some base hooks, and the ability to render HTML elements, text nodes and fragments (List of Components) could be used. The rendering packages (deact, jaspr or rad) implement these interfaces and the component packages (or logic packages such as for hooks or routing) use those interfaces.
At the moment, bootstrap_dart uses a global
BoostrapRenderer
instance that has to be overridden to use the renderer for each package like this example that executes this function. The returned components are of typedynamic
, which works, but maybe isn't great.BoostrapRenderer
has a generic type parameter for the component type which could be used to improve type safety. For type safety, theBoostrapRenderer
in the repo could use extensions to implement the components and theBoostrapRenderer
instance could be used directly (boostrapRenderer.card(...)
to return a Card bootstrap component). The extensions would need to be imported since they contain the implementation for each component. Or perhaps we could expose a Component interface in "web_rendering_interface" so that the component libraries return an instance of that interface. Or reimplement each component in all the packages that interface the rendering framework with the component libraries, perhaps with code generation to maintain documentation and the API synched.This would allow for the component libraries to use the same code and interface with multiple different rendering libraries. As well as perhaps share hooks between different frameworks. This could also be extended to other functionalities like server side rendering, routing or dependency injection. Where the routing logic could be used for every rendering package.
Thanks for reading!
The text was updated successfully, but these errors were encountered: