Crate mogwai

source ·
Expand description

Mogwai

Mogwai is library for user interface development using sinks and streams.

Its goals are simple:

  • provide a declarative way to create and manage interface nodes, without a bias towards a specific UI domain (ie web, games, desktop applications, mobile)
  • encapsulate component state and compose components easily
  • explicate mutations and updates
  • feel snappy
  • allow the library user to access the underlying raw views when necessary, ie - you have an “escape hatch”

UI Domains

Mogwai has domain-specific libraries for certain user interface domains that re-export this core library and specialize it for the domain.

Javascript/Browser DOM

mogwai-dom is a library for building browser applications using the Javascript API. It is a mogwai wrapper around web_sys.

Terminal UI

TODO: implement mogwai-tui

Write your own

Would you like to be able to build mogwai apps in a domain that doesn’t exist yet? You can build it! For the most part the bulk of the work is writing an implementation of TryFrom<ViewBuilder> (or a similar conversion) for your domain-specific view type. See the mogwai-dom source code for an example of prior art.

TODO: change the link for mogwai-dom to main after merging

Acronyms

If you’re wondering what the acronym “mogwai” stands for, here is a table of options that work well, depending on the domain. It’s fun to mix and match.

MOGWAI
minimalobviousgraphicalwebapplicationinterface
modularoperablegraphablewidget
mostlyguiwork

Modules

  • Async mpmc and broadcast channels, plus extensions.
  • Sum type for either a “left” or “right” value.
  • Re-exports of the futures_lite crate, along with extensions and helper types.
  • Values with streams of updates.
  • Updates to lists and hashmaps encoded as enums.
  • Re-exports for convenience
  • Bundling view updates and events.
  • Types and extention traits for Sinks.
  • Types and extention traits for Streams.
  • Wait or sleep or delay future.
  • Domain agnostic view doclaration.

Macros

  • Uses an html description to construct a ViewBuilder.
  • Uses an html description to construct a ViewBuilder.
  • Uses a function-style description to construct a ViewBuilder.