I maintain Taffy: AMA.<p>I am currently in the process of building a wider browser engine / GUI toolkit on top of it (<a href="https://github.com/dioxuslabs/blitz" rel="nofollow">https://github.com/dioxuslabs/blitz</a>). As part of that I am implementing a lot of the messier parts of CSS layout (floats, etc), and also grinding on fixing all the WPT tests which we track here: <a href="https://blitz.is/status/wpt/css/css-flexbox" rel="nofollow">https://blitz.is/status/wpt/css/css-flexbox</a>.<p>The vision is a complete standalone implementation of the web layout algorithms that can be easily embedded (with individual algorithms enabled/disabled on a pay what you use basis), and which can also be part of a modular ecosystem of browser engine components that make it easier for people to create new browser engines.<p>Beyond Blitz, some notable users are:<p>- Servo which uses it only for CSS Grid<p>- Zed which uses it via it's GPUI toolkit.
I used this for an internal project I can’t talk about, but it was a lifesaver. It allowed me to drop a really powerful layout system into a project that wasn’t doing traditional UI at all.<p>The results have been fantastic. Thank you for this awesome library. I love it.
Thanks for all this! I used Blitz a while ago for a product research spike around composing HTML to be rendered directly in a terminal with kitty or iterm's image protocol:<p><a href="https://www.npmjs.com/package/kittyhtml" rel="nofollow">https://www.npmjs.com/package/kittyhtml</a><p><a href="https://github.com/kkukshtel/kittyhtml" rel="nofollow">https://github.com/kkukshtel/kittyhtml</a>
I think Bevy uses it too, right?
Floats? A fan of pain, are we?
I used it in <a href="https://fschutt.github.io/printpdf" rel="nofollow">https://fschutt.github.io/printpdf</a> for the HTML-to-PDF layout, just as a note. It is very useful, thanks for your work. Good luck on Blitz.
Closely-related tangent: for an amazing resource showing how to leverage CSS from first principles, see <a href="https://every-layout.dev" rel="nofollow">https://every-layout.dev</a>
An unfortunate name for certain audiences in the UK!
> an offensive word for someone who comes from Wales, or whose family comes from Wales<p><a href="https://dictionary.cambridge.org/dictionary/english/taffy" rel="nofollow">https://dictionary.cambridge.org/dictionary/english/taffy</a>
Not that unfortunate:<p><a href="https://www.walesonline.co.uk/news/wales-news/theres-still-mileage-name-taffy-2323388" rel="nofollow">https://www.walesonline.co.uk/news/wales-news/theres-still-m...</a>
Why is that?
I would be interested in something like Apple's constraint layout system. Nested flexboxes and grids can do a lot, but I kinda fell in love after seeing constraint layout. Even how window resizing is represented as a constraint with a certain priority too!
<a href="https://github.com/dylanede/cassowary-rs" rel="nofollow">https://github.com/dylanede/cassowary-rs</a> but it's not that great on performance once you have like 1000+ constraints (used that library last in 2018 / 2019? maybe it has improved). I think <a href="https://github.com/christolliday/limn" rel="nofollow">https://github.com/christolliday/limn</a> used it way back then.
I believe there are several crates (and other languages too) inspired by the original cassowary paper, don't know how mature they are though.
Came here to say the same thing. I feel like I’ve done my homework on CSS grid and CSS flex but no matter how much I use it, it will likely never become intuitive. Autolayout was love at first sight, and continued being a joy to use as long as I had the privilege of using it.<p>I know the CSS people were painted into a box by legacy, but the design of both grid and flex honestly seem like the products of uniquely deranged minds. Unfathomable. Something like WPF’s grid is just as powerful as CSS grid but it doesn’t give you a mental disorder trying to understand it.
CSS grid and flexbox are very intuitive to me now, because I fell in love with them too before meeting constraint layout. But that may be because I was still young-ish when learning them. These days, it's starting to get harder for me to pick up new things...
My opinion is that no one should re-implement CSS layout orimitives and algorithms. Those are rather unique in how (by necessity and quirks if history) awkward, stange and bolted on they are.<p>Explore other layout ideas. E.g. <a href="https://stackoverflow.com/questions/53911631/gui-layout-algorithms-overview" rel="nofollow">https://stackoverflow.com/questions/53911631/gui-layout-algo...</a>
Well, hang on, there are several different layout algorithms in CSS, right? They keep the old ones for backwards compatibility, and they have to interoperate which makes things more complicated; but flexbox and grid are relatively new and quite nice.
I side with your opinion. CSS is bad for UI layout (maybe good enough for text-flows idk)<p>... opens the SO link<p>yeah there's no answer to it (even if someone does, it would likely be closed by 5 others)
<strike>This project IMO should admit it's taken a lot of it's inspiration from Clay, a C layout immediate mode UI library: https://github.com/nicbarker/clay/</strike><p>EDIT: Was wrong, see reply to this comment, need my coffee...still not a good excuse
This project predates Clay by several years. Clay's earliest commit was 2024. Taffy was forked from <a href="https://github.com/vislyhq/stretch" rel="nofollow">https://github.com/vislyhq/stretch</a> in 2022, and Stretch's first commit was 2019.<p>The real inspiration is <a href="https://github.com/react/yoga" rel="nofollow">https://github.com/react/yoga</a> (as used by React Native). Stretch was originally a Rust port/rewrite of Yoga.<p>An associated project: <a href="https://github.com/DioxusLabs/anyrender" rel="nofollow">https://github.com/DioxusLabs/anyrender</a> does take a lot of inspiration from Clay's "drawing commands"