Release 2.7.0: executable handbooks and native user-site workflows

This commit is contained in:
cflmy committed 2026-11-10 17:03:06 +08:00
1 parent aa0c4d0f55
commit d9aef957f7
562 files changed
+21064 -20387

No files matched your search

+28 -14
View File
@@ -1,25 +1,39 @@
---
markup: occlusion
title: web-spa-app
description: Native Marqdo SPA — list/detail/edit via WASM client routes + memory store
type: web
view: main
route: /
title: Marqdo SPA — Document layout and native client records
import:
home: components/index.mq.md
web: ext/web/web.mq.md
http: ext/net/http.mq.md
---
# main
The Document's main assembles View nodes; serve owns the process lifetime. Build current WASM assets into static before starting. From the checkout root, call serve with plugin,fs.read,network.write and --fs-root examples/web-spa-app. List, detail and edit behavior stays in static/client.mq.md, with native row records and the official bridge's list effect.
Full-page client app (zero author JS). Build assets first:
## main
```
marqdo wasm build -o examples/web-spa-app/static
```
| 返回 | 类型 | 说明 |
|---|---|---|
| result | list | Homepage View rows |
**`embed` = > web.client_embed bridge="/static/marqdo-bridge.js" wasm="/static/marqdo_wasm.wasm" source="/static/client.mq.md" boot=True**
The page delegates layout to the component root. Follow that root into navigation and the three independent panels until reaching plain text, Markdown or a native control leaf. The runtime is a structured Resource. This function neither starts a server nor mixes client state into a page HTML string; serve later mounts the actual assets.
**`intro` = "<nav class='spa-nav'><button type='button' id='nav-list'>Items</button> <button type='button' id='nav-new'>New</button></nav><p id='title' class='spa-title'>Items</p><section id='view-list'><ul id='items'></ul><p class='hint'>Click an item for detail.</p></section><section id='view-detail' hidden><p id='detail-body'></p><p><button type='button' id='btn-edit'>Edit</button> <button type='button' id='btn-back'>Back</button></p></section><section id='view-edit' hidden><label>Title <input id='edit-title' /></label><p><button type='button' id='btn-save'>Save</button> <button type='button' id='btn-cancel'>Cancel</button></p></section><pre id='log'></pre>" + embed**
Return *[Assemble the inspectable homepage](home.nodes())*.
**page = > web.page title="Marqdo SPA" intro=intro layout="bare"**
**app = > web.app page=page host="127.0.0.1" port=18093**
**app = > app.static dir="static" mount="/static"**
**app = > app.redirect from="/item" to="/" permanent=False**
> `app`.listen
## serve
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| root | text | "examples/web-spa-app" | Explicit site directory from the checkout root |
| port | number | 18093 | Loopback listen port |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Blocking site listener result |
Use `root`="examples/web-spa-app" and `port`=18093. The site prepares declared Documents and Endpoints, mounts static, then binds the existing /item redirect through the network resource. The explicit localhost address matches this demonstration's scope. Browser transitions use history inside the page; the server redirect preserves the old direct /item entry behavior. This function blocks until its supervisor stops it, and missing assets remain a real build prerequisite.
We **app = [Prepare the declared page and static mount](web.prepare(root=`root`, host="127.0.0.1", port=`port`, static_dir="static"))** and **app = [Preserve the declared direct-entry redirect](http.redirect(app=`app`, from="/item", to="/", permanent=False))**.
Return *[Listen after all resources are bound](web.listen(app=`app`))*.