DioxusLabs / blitz

A radically modular HTML/CSS rendering engine
Apache License 2.0
2.13k stars 42 forks source link

Text input element #93

Closed matthunz closed 4 months ago

matthunz commented 4 months 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 months 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.