MoonBit-powered browser start page: clock with lunar calendar, bookmark grid, multi-engine search, wallpapers — all core logic in MoonBit (wasm-gc), DOM as a thin shell.

| 功能 | 说明 |
|---|---|
| 时钟小组件 | 公历日期时间 + 农历 + 干支/星期(1900–2100,纯 MoonBit 换算) |
| 书签网格 | 增删改、favicon 图标 + 首字回退、新标签打开 |
| 多引擎搜索 | 百度 / Bing / Google 一键切换,回车当前页跳转 |
| 壁纸 | 4 张内置 SVG + 本地上传(长边 1920px 压缩、JPEG 80%);双层层叠 crossfade 淡入(先解码后淡入,避免大图硬弹) |
| 个性化 | 小组件显隐开关;全部配置 localStorage 持久化;离线可用 |
| 配置迁移 | 一键导出/导入 JSON,自定义壁纸以图像数据内嵌,文件自足可迁移 |
| 无障碍与呈现 | prefers-reduced-motion 全局动效关停、键盘 focus-visible 轮廓、跨平台中文字体回退链、SVG favicon |
┌─────────────────────────── 浏览器 ────────────────────────────┐
│ index.html · style.css app.js(渲染壳,~450 行) │
│ ▲ 按分区重绘 │ 事件 JSON / 响应 JSON │
│ │ ▼ │
│ DOM 事件 ────────▶ wasm.mtab_dispatch ────▶ MoonBit store │
│ (wasm-gc) (唯一的决策点) │
│ │ effects │
│ localStorage ◀── save ──────────────────────┘ open_url / │
│ notify_error 由渲染壳执行 │
└────────────────────────────────────────────────────────────────┘git clone https://github.com/2d5rrr333/mtab
cd mtab
./build.ps1 -Release # moon build --target wasm-gc 并暂存产物到 web/wasm/
npx serve web # 或 python -m http.server 8000 -d web| 层 | 命令 | 覆盖 |
|---|---|---|
| 单元测试 | moon test | store 事件归约、模型 JSON 往返、URL 归一化、农历换算(含闰月、春节边界)—— 37 项 |
| e2e | node e2e.mjs | 真实 wasm 实例过 FFI 桥逐事件断言 —— 18 项 |
| headless | node headless.cjs | Edge headless:13 项渲染检查 + 63 项交互/样式断言,并以 --force-prefers-reduced-motion 复跑 65 项验证动效关停(需 Windows + Edge) |
├── moon.mod # 2d5rrr333/mtab 模块定义
├── build.ps1 # wasm 编译 + 产物暂存(跨平台)
├── src/
│ ├── main/ # wasm 导出:mtab_init / mtab_dispatch
│ ├── store/ # 状态树、事件归约、副作用队列
│ ├── model/ # 配置/书签/引擎/壁纸模型 + JSON 编解码
│ └── lunar/ # 公历↔农历换算(1900–2100)
├── web/ # 渲染壳:index.html · style.css · app.js · 壁纸 · favicon
├── e2e.mjs # FFI 桥 e2e(Node)
├── headless.cjs # Edge headless 渲染/交互验证
└── openspec/ # 行为规格(4 个 capability)与变更档案Install
Download zipMoonBit-powered browser start page: clock with lunar calendar, bookmark grid, multi-engine search, wallpapers — all core logic in MoonBit (wasm-gc), DOM as a thin shell.