Lepus is a desktop application toolkit for MoonBit.
It provides:
- a native MoonBit application host
- a WebView-based rendering runtime
- a plugin system for exposing platform features to frontend code
- a MoonBit CLI for scaffolding and local workflows
Lepus is still in an early stage.
What is already in this repository:
- the core app API in
lepus.mbt - the WebView runtime in
webview/ - the CLI in
cli/lepus/ - official plugin packages in
plugins/ - runnable examples in
examples/
What is not finished yet:
- many plugins are still example-backed or placeholders
devandbuildare still being expanded- packaging and distribution are not production-ready yet
You need:
moon- a native toolchain that can build MoonBit native targets
- a local environment where the bundled
webviewlibrary can be loaded
Check your environment:
moon run --target native cli/lepus -- doctorRun the basic example:
moon run --target native examples/helloRun a plugin example:
moon run --target native examples/dialogmoon run --target native cli/lepus -- init my-appThe current top-level API is centered around:
WindowConfig::new(...)App::new(main_window, plugins?)App::with_windows(windows, plugins?)App::add_window(config)
Minimal app:
///|
fn main {
let main_window = @lepus.WindowConfig::new(
title="Hello Lepus",
html=(
#|<!doctype html>
#|<html><body><h1>Hello Lepus</h1></body></html>,
),
)
@lepus.App::new(main_window).run()
}Plugin-enabled app:
///|
fn main {
let main_window = @lepus.WindowConfig::new(
title="Dialog Example",
html=@lepus_plugin_support.example_html("dialog", "Dialog Plugin Example"),
)
@lepus.App::new(main_window, plugins=[@lepus_plugin_dialog.plugin()]).run()
}Window customization example:
///|
fn main {
let window = @lepus.WindowConfig::new(
title="Custom Window",
frameless=true,
transparent=true,
title_bar_style=1, // hidden
title_bar_overlay=true, // overlay controls
html="<div class='lepus-titlebar'>Drag me</div>",
)
@lepus.App::new(window).run()
}Plugins live in plugins/.
Each plugin package exports:
plugin()
Each example installs plugins through:
plugins=[@lepus_plugin_x.plugin()]
The current plugin status matrix is in PLUGINS.md.
.
├── cli/lepus/ # CLI implementation
├── examples/ # runnable native examples
├── plugins/ # official plugin packages
├── webview/ # WebView runtime and bridge
├── lepus.mbt # top-level Lepus API
├── moon.pkg # root package definition
└── moon.mod.json
Useful commands:
moon check
moon test --target native -p lepus-apps/webview
moon info && moon fmtCLI help:
moon run --target native cli/lepus -- --help