Shmew / Feliz.MaterialUI

Feliz-style Fable bindings for Material-UI
https://shmew.github.io/Feliz.MaterialUI/
MIT License
69 stars 20 forks source link

Rewrite generator / make generator library #22

Open cmeeren opened 5 years ago

cmeeren commented 5 years ago

I'm rewriting the generator to something more solid.

In order to simplify creation of other Feliz bindings, I plan on publishing a NuGet with the generator domain model (containing information about components and props) and writer (essentially converts the API model to strings for a component file and props file).

Binding authors can then just instantiate the domain model (either manually or by parsing docs or TS types however they want) and use the model data to generate standard Feliz bindings, which will automatically fix stuff such as erasing types with only inline members etc.

This also makes it easier to change Feliz implementations, e.g. for the new inheritance syntax suggested in #20.

cmeeren commented 5 years ago

This is now implemented, though currently undocumented (except for doc comments in code) and unpublished. Interested parties can, for now, check out the code in the fairly simple Feliz.Generator and particularly how it's used and extended in the more complicated Feliz.Generator.MaterialUI (an example of a 3rd party client making use of Feliz.Generator):

https://github.com/cmeeren/Feliz.MaterialUI/blob/e54e57cce525039b2a2dc818bf43465dcaee8663/src/Feliz.Generator.MaterialUI/Domain.fs#L1-L23

https://github.com/cmeeren/Feliz.MaterialUI/blob/e54e57cce525039b2a2dc818bf43465dcaee8663/src/Feliz.Generator.MaterialUI/ApiParser.fs#L670-L706

https://github.com/cmeeren/Feliz.MaterialUI/blob/e54e57cce525039b2a2dc818bf43465dcaee8663/src/Feliz.Generator.MaterialUI/Program.fs#L16-L21

Shmew commented 5 years ago

Thanks for this cmeeren, I've made plotly.js bindings for Feliz by butchering the code you wrote for the generator. https://github.com/Shmew/Feliz.Plotly I'd love some advice on how I can improve things, I'm pretty sure it creates a rather large bundle at the moment.

cmeeren commented 4 years ago

The generator is in a good state as of now, but it's not yet published to NuGet or documented. If anybody needs it, please let me know and I'll try to prioritize publishing and adding docs. I have a lot on my place and probably won't prioritize it until anyone actually needs it.

(Regardless of this, anyone is of course free to simply clone this repo and experiment using a simple project reference to see if the generator fits their needs.)