About

moxie (/ˈmäksē/) is a lightweight platform-agnostic UI runtime written in Rust, powering a strongly-typed declarative programming style with minimal interaction latency.

moxie is principally inspired by React and more specifically the recent Hooks API. It aims to smoothly bridge the gap between stateless tools like dear imgui and "traditional" UI paradigms with manually managed graphs of stateful, mutable objects. There are many interesting parallels in our design to those of recently announced UI frameworks Jetpack Compose and SwiftUI, although a more in-depth comparison hasn't yet been made. Also, in the course of looking for prior art (ahem googling "memoized imgui"), I found a very interesting thread on LtU discussing various commenters' efforts and curiosities -- it's a fun read.

Hands On

Want to try things out? Check out the development requirements, and run these commands in two terminals:

$ cargo dom-flow

This will build all of the web examples and watch for local changes.

$ cargo server

This will start an HTTP server for the static files in the repo, and opens the repo directory in a browser.

Take a look at .cargo/config for other subcommand aliases used in the project.


random:

Declarative style

TODO "imperative but idempotent"

"describe the UI right now"

partition the render space using function calls

while managing persistent stateful elements

with minimal incremental updates

in order to achieve minimal latency and consistent responsiveness

  • project values
    • empathy
    • respect
    • sharing
    • dialogue

TODO

  • moxie-dom
    • getting started, examples
    • creating elements
    • mounting elements
    • element attributes
    • element event handling
    • use of call slots

Adding new targets

Expressing an interactive system "in terms of moxie's tools" requires making some decisions.

A core choice in moxie: Builders

Existing UI systems tend to come with complex objects that require nuanced initialization, often with many parameters, some of which are optional and some which are not. Rust has one main tool for describing those initializations: the builder pattern. It is possible to describe complex "mixed-optionality" initialization without the builder pattern in Rust, but it's so prevalent in Rust that it's officially recommended.

The mox! macro ("Mockery Of XML") is essentially an XML syntax for Rust builders. See its documentation in the moxie crate for information about exactly how it expands.

Finding Event Loops

TODO

Memoization

TODO

Persistence

TODO

Parent/child relationships

TODO

TODO

TODO