Languages

Aphrodite

The UI language: one component, drawn on the GPU in a window by Sapphire, in a browser as WebAssembly, and in a terminal by Shelly.

In use by every MLambda window

Aphrodite

Aphrodite (.ap) is the family’s language for user interfaces: the theme tokens, the styles, the motion, the widgets and the screens. Nothing in MLambda draws a widget by hand. One component written in Aphrodite runs in a window, in a browser and in a terminal.

                              MLambda.Aphrodite
   compilers (native, web) · the frame: layout + draw list (data) · widgets, theme, styles
                 /                                              \
   MLambda.Sapphire: windows                                   MLambda.Shelly: terminals
   GPU painter (IMGui), fonts, the window loop        cells, the terminal loop (Bubble Tea's model)

A component

style
  .av
    width: 26
    height: 26
    corner: 13
    align: center
    justify: center
    match level
      "sm": width(22), height(22), corner(11)
      "l": width(44), height(44), corner(22)
    match hue
      "h1": background(#8fd49a)
      "h2": background(#e0c97b)
      _: background(#8fb4e8)

component avatar(name: text, size: text = "md")

  // no name, no mark: an empty circle says nothing
  render()
    name != "" ? row(style: av, level: size, hue: hue-of(name, 0))
      text(initials-of(name), style: av-words, level: size)

State lives in stores

A component keeps only its own inner state (a fold, a hover, a draft being typed) and reports changes through its actions. A view never holds domain state: it is constructed with a store, renders from it, and the store is where state changes. An app declares its gateways, its stores and its routes:

app("MLambda CRM")
  gateways
    DealsApi = "${CRM_GATEWAY:-http://127.0.0.1:18280}"   signed: who.token
  stores
    who   = session()
    board = pipeline()
  routes
    "/" => window(who, board)

The parts

Package What it is
Aphrodite (native) The compiler: an .ap file to Aleph modules
Aphrodite.Web The web compiler: an .ap file to web components, the app built as WebAssembly
Aphrodite.Ui The frame: layout and a draw list any host carries out
Aphrodite.Widgets The widget library, its theme and styles
Aphrodite.Catalog Every widget at work, with an inspector
Aphrodite.Automation A window driven from outside, as a person drives it, for Dream’s stories
Aphrodite.Push Notices with the window closed, one instance per operating system
Sapphire The window renderer: IMGui on the GPU through Fusion, fonts, the window loop, and Pencil, the visual editor
Shelly The terminal renderer: the Elm architecture (model, update, view), and command lines read as picocli reads them

Every window of the family is Aphrodite: the apps, Turing, Science, Helios, Neuron and the Store. Each one is proved against its prototype with Playground.