DioxusLabs / blitz

High performance HTML and CSS renderer powered by WGPU
MIT License
584 stars 26 forks source link

Text input element #93

Open matthunz opened 4 days ago

matthunz commented 4 days ago

For text input we can wrap around Masonry's TextBox.

My current idea is rather than use a separate widget tree for Masonry elements, we can have Option<Box<dyn Widget>> or similar in Blitz's Node struct.

We may want to implement the focus stack first https://github.com/DioxusLabs/blitz/issues/92

nicoburns commented 4 days ago

Option<Box<dyn Widget>> is probably the easiest way to start. But we might want to think about adding a custom enum for "special" data associated with nodes (which would includes masonry widgets, but mights also image data for <img> (perhaps separate for raster vs. SVG), text input data for <input>, table layout context for <table>, inline layout context for inline roots, etc. We'd probably still want to Box the content of each variant.

Motivation being to avoid bloating node size with a bunch of Option<Box<_>> (even if they're only 64bits each). I can't think of any nodes that require multiple of these yet.