Thanks, those are good points and on my mind. The logic started getting hard to 
follow in longer callback sections. Using the `:` command syntax the eye 
doesn't have any context between actions or UI descriptions.

I sorta like the `proc click() =` since it makes that distinction a bit 
clearer. Making a declarative DSL for UIs is tricky since you're inherently 
mixing multiple abstractions at once. :-)

I think figuring out things like how do you describe layout vs logic in a clean 
valid declarative Nim syntax is more important than the engine in some ways. 
Apple's SwiftUI is declarative too and has been interesting to follow as 
they've struggled to build it out.

That said the Fidget model is to build the graph and render it every time, but 
only when an event triggers a render. It's like immediate mode but more 
efficient since you only re-render on events unlike in ImGui.

The Fidgetty DSL is built on top that model to _try_ and create re-usable and 
customizable "widgets". I can create useful apps with it now! However I have a 
bit of writers block because there's a few parts that are nagging me..

The main remaining issues are:

  * handling mouse events with layered widgets like menus, dropdowns, ...
  * automated grid style layout
  * binding variables (mixing ref's of the widget state vs var args in the 
procs)



Handling mouse events sort of needs to be done in a tree model after computing 
the layout to best handle cases like overlapping nodes. That'd be a breaking 
change to the Fidget model though. I'm partly there however by using callbacks 
for Fidgetty `onClick` handlers instead of templates.

The other big one is the same thing Owlkettle had with the `Button 
{.add_left.}` where you want to do grid style layouts and say "this widget 
should be left" without cluttering up the widget's own api. I dislike the 
HTML/CSS model where you have to wrap your actual UI elements in `<box 
class="flow-left"><my-actual-item>...` or whatever. I sort of ended up with 
that in the `Theme(warningPalette()):` section. Particularly it's annoying to 
have to indent/un-indent a whole block just to change the color. I'd like the 
DSL to be more like:
    
    
    @withTheme = warningPalette()
          Checkbox(label = fmt"Click {self.myCheck}"):
            checked: self.myCheck
    
    
    Run

There is an auto-layout constraint engine in Fidget, however it's difficult to 
use without a UI tool to build it for you. However I don't use Figma. I'm 
mostly interested in automated layouts. 

Reply via email to