Live data from Hacker News

Clay – UI Layout Library

nicbarker.com

21–30 of 95 posts

Re: Clay – UI Layout Library

#21
Okey i was going to complain about what's the point of doing it in C, when it could be done more safely in Haskell/OCaml

But 2000 lines of C, and no dependencies is pretty cool!

Re: Clay – UI Layout Library

#22
Just a funny note—there’s a button at the end to switch between HTML and Canvas. I think it is neat how little difference it makes… normally.

But with iOS Safari + Dark Reader, at least on my side, the HTML page is turned into dark mode with Dark Reader, while the canvas page is not. So, it basically ruins the wow factor, haha.

But it still looks nice.

Re: Clay – UI Layout Library

#23

Just a funny note—there’s a button at the end to switch between HTML and Canvas. I think it is neat how little difference it makes… normally. But with iOS Safari + Dark Reader, at least on my side, the HTML page is turned into dark mode with Dark Reader, while the canvas page is not. So, it basically ruins the wow factor, haha. But it still looks nice.

[deleted]

Re: Clay – UI Layout Library

#24
post #19

Earlier quoted context omitted.

The developer is rediscovering the concept of a GUI library. The modern variant is the mouse-driven GUI developed by Xerox in the 1970s (and later commercialized by them as Xerox Star) which Jobs famously copied to create Apple’s Lisa, and Gates famously mimicked to create MS Windows. Since they determine the look and feel of a platform and their design determines the ease with which developers can create apps for th…

I'm a gray beard like you probably but I disagree with this statement. This library makes use of modern composable components, is declarative driven and not imperative; and doesn't do immediate rendering in all cases. It can target incredibly different backends, e.g. DOM/canvas/raylib. All of this in modern C as a `.h` library alone. These are great features and not just a 'youngster discovers' project.

Maybe a README that shows how it works and what it does would help. As it is it is quite opaque IMO, with just a few high level comments.

Re: Clay – UI Layout Library

#28
post #16

Serious question: am I the only one who finds writing a webpage like this to be a little too much (even if the concept is cool): void LandingPageDesktop() { CLAY(CLAY_ID("LandingPage1Desktop"), CLAY_LAYOUT({ .sizing = { .width = CLAY_SIZING_GROW(), .height = CLAY_SIZING_FIT({ .min = windowHeight - 70 }) }, .childAlignment = {.y = CLAY_ALIGN_Y_CENTER}, .padding = { .x = 50 } })) { CLAY(CLAY_ID("LandingPage1"), CLAY_LA…

If you don't use some kind of layouting language (like XML/HTML), this is inevitably what you will always end up with. See: AWT[1], SWT[2], Swing[3], Qt[4]†, Fyne[5], etc., etc., etc. [1] https://docs.oracle.com/javase/7/docs/api/java/awt/GridLayou... [2] https://github.com/eclipse-platform/eclipse.platform.swt/blo... [3] https://stackoverflow.com/a/12867862/243613 [4] https://stackoverflow.com/questions/37304684/qwi…

Qt has uic xml layout engine which was cumbersome to use, you weren’t discouraged from using c++ classes instead. The discouragement came later when Qt shifted towards qml (a bad shift as it’s just as unweildly, imo), now they discourage writing qml in c++ because the qml engine can get out of sync. Qt can prevent this but they want you to pay for a premium license for it. Slint is a sister to qt that does not have this restriction afaik.

I wish there would be an elegant c++ class/function based ui framework again.

Re: Clay – UI Layout Library

#29
Nice! It's pretty cool what you can make in a few thousand lines. Though Flex isn't my favorite as I prefer full CSS Grid. So I ended up making a CSS Grid layout library that I'm proud of in pure Nim (1). Though I'll have to checkout Clay and compare some of the layout algorithms.

It's neat to see boxes resizing themselves using an algorithm you implemented. Wonder if I could expose a C interface?

The reason I like CSS Grid is that I could imitate the formatting like this:

      test "compute others":
        var gt: GridTemplate

        parseGridTemplateColumns gt, ["first"] 40'ux \
          ["second", "line2"] 50'ux \
          ["line3"] auto \
          ["col4-start"] 50'ux \
          ["five"] 40'ux ["end"]
1: https://github.com/elcritch/cssgrid

Re: Clay – UI Layout Library

#30

Just a funny note—there’s a button at the end to switch between HTML and Canvas. I think it is neat how little difference it makes… normally. But with iOS Safari + Dark Reader, at least on my side, the HTML page is turned into dark mode with Dark Reader, while the canvas page is not. So, it basically ruins the wow factor, haha. But it still looks nice.

Text selection and zoomng is also problematic.
Post reply on HN