# MoUI
**Repository Path**: wzzc-dev/MoUI
## Basic Information
- **Project Name**: MoUI
- **Description**: MoUI 是一个多平台 MoonBit GUI 框架,用于构建具有共享平台无关应用逻辑的声明式 UI 应用。支持 Windows/macOS/Linux/Android/iOS。原生宿主核心拥有窗口、事件、服务和生命周期,然后通过平台渲染器提供程序包接收具体的渲染器。
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: https://wzzc-dev.github.io/MoUI/
- **GVP Project**: No
## Statistics
- **Stars**: 4
- **Forks**: 0
- **Created**: 2026-08-22
- **Last Updated**: 2026-11-25
## Categories & Tags
**Categories**: desktop-ui
**Tags**: GUI, MoonBit, 多平台
## README
---
MoUI is a multi-platform MoonBit GUI framework for building declarative UI apps with shared platform-neutral app logic. Native host cores own windows, events, services, and lifecycle, then receive concrete renderers through platform renderer provider packages.
Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).
The current mainline is native Skia raster plus the Web `wasm-gc + window/web + browser WebGPU host imports` path. Native WGPU remains available as an experimental diagnostic route while the MoonBit WGPU ecosystem matures.
### Supported platforms (product class)
| Platform | Class | Meaning |
| --- | --- | --- |
| macOS | **committed** | Product mainline (L0–L3 evidence) |
| Web | **committed** | Product mainline (wasm-gc + WebGPU) |
| Windows | **committed** | Product mainline (L0–L3 evidence) |
| Linux | **committed** | Product mainline (L0–L3 evidence) |
| Android | **committed** | Matching-emulator verified: ANativeWindow CPU-blit Skia present, pointer, keyboard/IME text + named keys, resize, app viewport, clipboard write + read (embedder JNI bridge), AccessibilityNodeProvider semantics, detach/recreate, async image (ADR 0066) |
| iOS | **committed** | Matching-simulator verified: CALayer CPU-blit Skia present, pointer, keyboard/IME text + delete + named keys (Enter submit), clipboard write + read (UIPasteboard bridge), UIAccessibilityElement semantics, detach/recreate, async image (ADR 0067) |
| HarmonyOS | **committed** | Matching-device verified: `egl-direct` Skia present, pointer, keyboard/IME, resize, app viewport, clipboard read + write, ArkUI accessibility, detach/recreate, async image (ADR 0046) |
Android, iOS, and WeChat Mini Program are **not** "unwired glue only." Android is **committed** on its recorded matching-emulator R6 evidence (ADR 0066); iOS is **committed** on its recorded matching-simulator R6 evidence (ADR 0067). WeChat remains **experimental**: code compiles and host-sim tests pass, but no development/demonstration usability or product commitment is made without matching-device evidence. HarmonyOS is **committed** on its recorded matching-device R6 evidence (ADR 0046). See [platform readiness declaration](docs/platform-readiness-declaration.md).
The runtime pipeline is explicit:
```text
View[Msg] -> ElementTree -> LayoutTree -> RenderTree -> DrawCommand -> renderer
```
## Project Shape
- `moui/core/` owns platform-neutral contracts, opaque `View`, typed events, `Program`, `Effect`, `Subscription`, geometry, draw, semantics, and the public message-independent `ViewNode` extension protocol wrapped by typed `View[Msg]`.
- `moui/views/` owns public view constructors and concrete control behavior implemented as `@core.ViewNode` values and constructed with `@core.View::from_node`, without adding new `core` enum variants.
- `moui/runtime/` exposes app/host `AppRuntime` construction entrypoints and owns runtime state, tree/layout/paint, event dispatch, program message drain, effect task, subscription lifecycle, and diagnostics.
- `moui/views/` returns app-facing `@moui.View[Msg]` values for app code.
- `moui/backend/` defines shared host contracts; platform backends normalize window and input events into `Event`.
- `moui/backend//` owns only the neutral host; applications select `moui_skia_renderer` or another renderer provider in the composition root.
- `moui/render/` provides the renderer facade, with native Skia raster, WebGPU adapter, and experimental native WGPU implementations under `moui_skia_renderer/`, `moui_web_renderer/`, and `moui_wgpu_renderer/`.
- `moui_theme/` is an optional addon workspace member for source-mapped Material, Carbon, Primer, and Fluent theme previews plus the first-party Smartisan-inspired Sickle hybrid skeuomorphic/flat theme.
- `examples/*/app/` contains shared app logic, while platform subpackages are thin entrypoints.
- `website/` is the MoUI homepage and Web demo surface.
## Screenshots
The first row is rendered from `examples/gallery` with stock controls only. Regenerate it with
`node scripts/generate-gallery-screenshots.mjs` (add `--website` to refresh the WebP copies used
by the homepage); `--check` fails when the committed PNGs drift from the Desktop preset.
## Quick Start
Choose the path that matches what you are trying to do.
### Playground
Open the [browser Playground](https://wzzc-dev.github.io/MoUI/playground/) to edit and run the guided examples without installing a native toolchain. This is the shortest route for learning the view/update model and checking Web behavior.
### Independent Project
Install the standalone CLI, then generate a project outside this repository:
```sh
moon install wzzc-dev/moui_cli/cmd/moui
moui new my_app
# Optional smaller skeleton: moui new my_app --template hello
cd my_app
moon update
moon check
moon run macos_skia --target native # or windows_skia / linux_skia on that host
```
`moui new` creates shared app logic plus Web and the current desktop entrypoint. Add Android, iOS, or HarmonyOS explicitly with `--platform`; mobile projects use `wzzc-dev/window` templates and keep lifecycle, surface, and input in the platform event loop. See [Getting started](docs/getting-started.md).
### This Repository
Use this path when changing MoUI itself or running the full featured examples:
```sh
git clone --recurse-submodules https://github.com/wzzc-dev/MoUI.git
cd MoUI
sh scripts/ci-moon-update.sh
sh scripts/check.sh --profile pr
moon test examples/showcase/app --target native
```
Showcase is the primary scanning and interaction example. Their platform entrypoints are listed under [Running Examples](#running-examples).
Framework setup details, including optional submodules and the `window/` local-source workflow, live in [Development](docs/development.md).
The default daily baseline covers the core framework, maintenance baseline ratchets, Web wasm-gc, native Skia mainline contracts, and Showcase. Design Systems is addon diagnostic coverage; run `sh scripts/check.sh --profile theme` when changing `moui_theme` or `examples/design_systems`.
For current-host backend/provider checks, run:
```sh
sh scripts/check.sh --profile platform
```
For release-oriented screenshot and benchmark handoffs, use:
```sh
node scripts/conformance-capture-scaffold.mjs --mode golden
node scripts/conformance-capture-scaffold.mjs --mode benchmark
```
These commands generate local scaffold manifests and logs under `artifacts/`; release notes should cite the relevant CI run, uploaded artifact, or smoke log instead of committing generated artifacts. `artifacts/` is ignored; keep those files as local or CI evidence.
## Running Examples
The featured examples — `showcase`, `mo_workbench`, and `excel` — share app logic in `examples//app` and expose thin platform entrypoints.
**MoUI Studio** ([wzzc-dev/moui_studio](https://github.com/wzzc-dev/moui_studio)) is MoUI's own IDE: a bilingual visual programming environment where design, blocks, and code views all edit one statement-level IR, with `form.mbt` + `handlers.mbt` as the on-disk source of truth for imported projects, three real preview modes (headless frame, web live preview, native run), and readable structured AI proposals. It is an **external repository**, not a submodule or workspace member; see `docs/moui-studio.md`, ADR 0037, and the [vendor workflow](docs/vendor-workflow.md) when a Studio change needs a MoUI change. Showcase uses `web_wasm`, desktop renderer-specific entrypoints, and `android_window_hosted`, `ios_window_hosted`, and `harmonyos_window_hosted` mobile entrypoints.
To try Showcase on a mobile platform, follow the platform-specific setup, build, and run instructions for [Android](docs/android-support.md), [iOS](docs/ios-support.md), or [HarmonyOS](docs/harmonyos-support.md). Standard examples use the matching `wzzc-dev/window` platform template through `moui build`.
> **Windows prerequisite:** before building or running any Windows native entrypoint (`windows_skia`, or the `windows_wgpu` diagnostic route), initialize the MSVC toolchain in a PowerShell session:
>
> ```powershell
> .\scripts\windows\msvc_env.ps1
> ```
>
> This sets up the MSVC environment required by the native Skia link step with shared C11 atomics support (`/experimental:c11atomics`). Run it once per shell before `moon run ... --target native` on Windows. `MOON_CC` stays unset: the Skia C++ stub compiles inside the `moui_skia` prebuild (`build.mbtx`) with its own `/std:c++20`, so the MoonBit CLI's injected `/std:c11` only reaches C stubs and the old D8016 clash is gone. The `windows_wgpu` diagnostic route additionally needs C11 mode (`/std:c11`) for `wgpu_mbt`'s `` stubs — the Windows build/package helpers enable it for WGPU packages automatically; for a direct `moon run`, dot-source the script and call `Enable-MsvcGlobalC11ModeForCOnlyStubs` first.
### Showcase
Unified Components, Patterns, Platform, and Diagnostics workspaces across desktop, mobile, and Web. Source lives under `examples/showcase/app`; platform entrypoints are thin.
```sh
# Web (wasm-gc)
moon build examples/showcase/web_wasm --target wasm-gc
# macOS Skia
moon run examples/showcase/macos_skia --target native
# Windows Skia (run msvc_env.ps1 first in PowerShell)
.\scripts\windows\msvc_env.ps1
moon run examples/showcase/windows_skia --target native
# Linux Skia
moon run examples/showcase/linux_skia --target native
```
### Markdown Editor
The Typora-style WYSIWYG Markdown editor (MoMark) lives in its own repository,
[wzzc-dev/MoMark](https://github.com/wzzc-dev/MoMark). It builds on published
`wzzc-dev/moui` and `wzzc-dev/moui_richtext` packages and is **not** a submodule
or workspace member here. See the MoMark README for setup and platform
entrypoints; use the [vendor workflow](docs/vendor-workflow.md) for framework
changes.
### Mo Workbench
Native-Skia-first desktop agent dogfood app. Only `macos_skia` is wired today; Linux/Windows/Web entrypoints are reserved. The `bobzhang/openseek` dependency resolves from mooncakes.io (pinned in `examples/mo_workbench/moon.mod`); no submodule or workspace member override is required.
```sh
moon run examples/mo_workbench/macos_skia --target native
```
### Excel Viewer
MoonBit Excel (`moonbitlang/mbtexcel`) file renderer using MoUI data table components. Shared app logic is in `examples/excel/app`; `macos_skia` is the retained entrypoint.
```sh
# macOS Skia
moon run examples/excel/macos_skia --target native
```
Focused app-package tests for the featured examples:
```sh
moon test examples/mo_workbench/app --target native
moon test examples/showcase/app --target native
moon test examples/excel/app --target native
```
See [Showcase](examples/showcase/README.mbt.md), [Examples](docs/examples.md), [Markdown Editor](docs/markdown-editor.md), [Mo Workbench](docs/mo-workbench.md), and [Showcases](docs/showcases.md) for package shapes and platform coverage.
## Documentation
The source docs live under `docs/`. The website preview copies those Markdown files into `website/web_wasm/docs/` with `node scripts/sync-website-docs.mjs`.
- [Architecture](docs/architecture.md)
- [Development](docs/development.md)
- [Testing](docs/testing.md)
- [API surface](docs/api-surface.md)
- [API surface audit](docs/api-surface-audit.md)
- [Maintenance mainline](docs/maintenance.md)
- [Platform notes](docs/platform-notes.md)
- [Renderer capability report](docs/renderer-capability-report.md)
- [View catalog](docs/view-catalog.md)
- [Views API guide](docs/views-api-guide.md)
- [Non-render component cookbook](docs/non-render-component-cookbook.md)
- [App templates](docs/app-templates.md)
- [Examples](docs/examples.md)
- [Markdown Editor](docs/markdown-editor.md)
- [Mo Workbench](docs/mo-workbench.md)
- [AI collaboration](docs/ai-collaboration.md)
- [2026 roadmap](docs/roadmap-2026.md)
- [Release readiness](docs/release-readiness.md)
## Contributing
MoUI is maintained by a single maintainer with AI assistance and is open to external contributions. Pull requests are the primary entry point for changes.
- [Contributing guide](CONTRIBUTING.md) — setup, package boundaries, PR requirements, DCO
- [Governance](GOVERNANCE.md) — decision mechanism, RFC process, maintainer roles, project handover
- [Security policy](SECURITY.md) — vulnerability reporting and support scope
- [Code of conduct](CODE_OF_CONDUCT.md)
## License
Apache-2.0. See [LICENSE](LICENSE).
Third-party dependency and attribution notes are collected in [THIRD_PARTY.md](THIRD_PARTY.md).