raquo / laminar-shoelace-components

Laminar bindings for Shoelace.js library of web components. Contains a code generator that can be used to generate similar bindings for other libraries.
MIT License
34 stars 6 forks source link

Custom event type facades #2

Open buntec opened 9 months ago

buntec commented 9 months ago

First of all, I wanted to say thank you for this library (and domtypes, of course, which made writing my own UI lib possible in the first place)!

I've been trying to adapt it to a UI lib I've been working on. Everything works great so far except for one little thing: I think the facades for custom event types don't quite work b/c custom fields should be nested inside a detail field. See here. There is a nice solution for this here. I've managed to work around it by changing the source generator ever so slightly. (I also really like the EventWithPreciseTarget idea from that project, which I've also adopted).

In the long run, it would be really great to see the codegen factored out into a lib. I'd be happy to help!

raquo commented 9 months ago

Yeah that would be nice to have. I didn't realize the detail field was an actual standard, I thought it was just a UI5 thing. But looks like even Shoelace uses it for some events...

If you can point me to the changes you made to support this use case, maybe I'll be able to incorporate them eventually, but just to set the expectations – no promises, especially in terms of timeline. My focus is just elsewhere right now, I don't know when I'll be able to get back to Shoelace.

buntec commented 9 months ago

All relevant changes are in this commit. The naming of the custom event types should probably be changed to something like CopyEventDetail, ErrorEventDetail, etc. to reflect the new usage.