Declare is a UI language for you and your AI
40 points by ilamont 5 hours ago | 27 comments

saidinesh5 54 minutes ago
I think Qt/QML really reached hit sweet spot for me when it comes to describing UIs (ignore if any syntax errors, doing this from memory):

For eg. compare this:

``` Window { textColor: "slategray" property int v: 40

    ColumnLayout {
        id: layout
        anchors.fill: parent
        spacing: 20

        Text {
            id: number
            Layout.alignment: Qt.AlignHCenter
            font.pixelSize: 70
            text: v
        }

        ProgressBar {
            id: progressBar
            Layout.alignment: Qt.AlignHCenter
  
            value: v/100
            color: v < 50 ? "dodgerblue" : "turquoise"
        }
    }

    MouseArea {
        anchors.fill: parent
        onClick: v = (v+20)%100
    }
} ```

with Declare:

``` App [ textColor = slategray,

    group: View [ x = center, y = center, width = 80%,
        layout: SimpleLayout [ axis = y, spacing = 20 ],

        number: Text [ width = 100%, textAlign = center,
            fontSize = 70, fontWeight = bold, text = { "" + v } ],

        bar: Gauge [ width = 100%, value = { v },
            tint = { v < 50 ? cool : warm }, accessibilityLabel = "v" ],

        hint: Text [ width = 100%, textAlign = center,
            text = "click anywhere to change v" ]
        ],

    v: number = 40,
    cool: Color = dodgerblue,
    warm: Color = turquoise,

    onClick() { v = (v + 20) % 100 }
    ]
```
reply
abrookewood 60 minutes ago
The LLM language is pretty off putting: "Say what you mean. Exactly" and then in the code comments "// One value, v, and three things that follow it". It's such an awful way of writing.
reply
triyambakam 27 minutes ago
Yes, it's definitely Claude and so dumb. More GPT models seem to do this less. But unfortunately Claude is just otherwise so much better lately.
reply
samrus 52 minutes ago
The claudish here got unreadable after a while. The project's thesis really should be written by a human. Shame becuase it seems like an interesting idea
reply
mtford 2 hours ago
First contact marketing pages and core documentation should be written by a human. This sounded interesting but my eyes glazed over as soon as I detected the AI smell...
reply
skybrian 3 hours ago
This looks quite nicely done. I'm reluctant to try it solely because the website has so much marketing-style writing (probably AI-generated) and I'm not sure I want to read more of it.

It should probably say up front that this is an npm package along with the tooling for it, and the output runs in a browser.

reply
onemoresoop 2 hours ago
There's a disclaimer of sorts right on this webpage:

"This page is written in it. By an LLM."

reply
fleur-de-lotus 31 minutes ago
Can this be used as a front-end to an app written in another language or can it call code written in another language?
reply
moralcoral 11 minutes ago
Hyperscript ... anyone?
reply
DeathArrow 2 hours ago
>Just as SQL is a domain-specific language for database queries, Declare is a DSL for user interfaces

Isn't HTML a DSL for UI? What's wrong with it?

reply
mejutoco 29 minutes ago
It is not typed
reply
zaphirplane 34 minutes ago
there must be a reason there are so many css libraries and UI frameworks
reply
jauntywundrkind 17 minutes ago
Heximal looking very interesting on this front. A DOM-ish like system but wasm-driven, wasm-homed. Already virtualized out of the real dom.
reply
etchalon 20 minutes ago
I just have a hard time with anyone who thinks you can make good UIs this way. "Declarative" UI has been tried, multiple times. It does not produce interesting UIs. It produces derivative, limited UIs that require deeply weird hacks to handle novel problems.

XAML was a notoriously bad idea.

This doesn't look much better than that.

reply
joddystreet 3 hours ago
I was working on a similar concept - Morpheus

Snippet -

```

document ::= ( comment | blank )* screen-line body

body ::= ( element-line | comment | blank )*

element-line ::= indent kind [ name ] meaning* [ modifiers ]

```

reply
joddystreet 2 hours ago
This was take 2

```

document = { template } ;

template = "@template", identifier, newline, { node }, "@end", line-end ;

node = group | row ;

group = "<", identifier, ">", newline, { node }, "</", identifier, ">", line-end ;

row = atom, { "|", atom }, line-end ;

atom = reference | component | spacer ;

reference = "[[", identifier, "]]" ;

component = "[", label, [ "|", identifier, { "|", property } ], "]" ;

property = identifier, "=", value ;

value = json-scalar | binding ;

label = label-part, { label-part } ;

label-part = literal-text | escape | binding ;

binding = "{", identifier, { ".", identifier }, "}" ;

spacer = "..." ;

line-end = newline | end-of-file ;

```

Still evolving.

Core idea is to be able to define interfaces in a minimal language, without going into too much details about attributes, say height, width, etc

reply
verdverm 3 hours ago
Myself too, they are all essentially DSLs with a transpiler to underlying tools and packages in a given language. Mine is different by allowing module developers to control the output technologies and DSL if they want, boiled down to CUE + text/template. Downstream users get a similar experience to this post.
reply
joddystreet 2 hours ago
reply
joddystreet 2 hours ago
My focus was essentially to be able to define this and let agents use these to build the interfaces. This `...with a transpiler to underlying tools and packages in a given language.` is an interesting idea, but I just want to focus on the language specs and compiler.
reply
designerarvid 2 hours ago
When are those switches in the tutorial on or off? And what do they do?

“Show boxes”?

UI used to strive for making it easy for users to understand the software’s mental model, current state, and possible actions. Now it’s about looking cool (the same as the other cool kids).

reply
mllev15 40 minutes ago
It’s REBOL for the web. This is what you get when you don’t realize what your LLM is ripping off.
reply
efskap 19 minutes ago
The cursed green claude dot is now following my cursor for pete's sake
reply
koteelok 3 hours ago
Next time you try to build a UI tech, make sure your site isn't ugly.
reply
agnishom 3 hours ago
What has this got to do with AI? I like declarative frameworks, but why is this one special for AI?
reply
boxed 2 hours ago
It's not a UI language though, it's a typescript specific tooling system?
reply
zobzu 3 hours ago
neat
reply
lofaszvanitt 2 hours ago
The totally braindead syntax haunts again. Only rust syntax is uglier than this.
reply
ttalkkakman 3 hours ago
[flagged]
reply