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

@@ -0,0 +1,3 @@
# About
This example combines database records, server-side form validation, login sessions, WebSocket echo and the standard network library's cookie/multipart parsing. Each responsibility has its own source file; layouts end in plain Markdown leaves.
@@ -0,0 +1 @@
[Marqdo web-net example](https://github.com) · [Docs](/tools)
@@ -0,0 +1,3 @@
# Net Site
Articles from SQLite, a live WebSocket widget, login-gated administration, and network parsing tools share this readable project. New articles appear on the next request.
@@ -0,0 +1,10 @@
--net-boundary
Content-Disposition: form-data; name="title"
Hello
--net-boundary
Content-Disposition: form-data; name="cover"; filename="pic.png"
Content-Type: image/png
<bytes>
--net-boundary--
@@ -0,0 +1 @@
[Home](/) · [About](/about) · [Publish](/new) · [Tools](/tools) · [Admin](/admin)
@@ -0,0 +1,3 @@
# Publish
This form inserts into the shared articles table. Title is required and limited to 120 characters; body is optional and limited to 8000. A rejected field keeps the actual session token so it can be corrected and submitted again.
@@ -0,0 +1,7 @@
## Try the capabilities
- [Articles](/)
- [WebSocket](/#live)
- [Authentication](/admin)
- [Forms](/new)
- [Network parsing](/tools)
+12 -6
View File
@@ -1,14 +1,20 @@
---
markup: occlusion
title: foot Markdown component
import:
component: ext/web/component/index.mq.md
fs: lib/fs.mq.md
---
This leaf module owns foot content and its semantic region. Parent layout only places the returned nodes. Edit the adjacent Markdown leaf to change wording or links; the component does not query records, authenticate users or generate a raw HTML string.
## foot
`foot` =
| 返回 | 类型 | 说明 |
|---|---|---|
| result | list | One footer region containing terminal Markdown content |
| 属性 | 值 | 样式 |
|------|-----|------|
| Marqdo web-net example | https://github.com | |
| Docs | /tools | |
Read the Markdown leaf relative to the granted site root with fs.read. Its links keep the original example's destinations; actual routing and access policy remain in the serving entry. This region is already simple enough to express as Markdown, so further wrappers or a custom table dialect would add no responsibility. The semantic container and class preserve its role for the native layout and theme.
*`foot`*
We **text = [Read this region's terminal Markdown](fs.read_text(path="components/content/foot.md"))** and **leaf = [Retain content as native Markdown](component.markdown(text=`text`, slot="foot-content"))**.
Return *[Place that leaf in its semantic region](component.wrap(children=`leaf`, kind="footer", slot="foot", style="foot"))*.
@@ -0,0 +1,25 @@
---
markup: occlusion
title: Network-site home content
import:
component: ext/web/component/index.mq.md
query: ext/data/view.mq.md
socket: live.mq.md
fs: lib/fs.mq.md
table: lib/table.mq.md
---
The home body has three responsibilities: a Markdown introduction, the original WebSocket widget, and a current article list. Each remains a separate component or resource. The database query is described at startup and executed per request, so publishing an article appears without restarting the site.
## nodes
| 返回 | 类型 | 说明 |
|---|---|---|
| result | list | Introduction, native live widget and request-time article query nodes |
Read the terminal introduction with fs.read. The live component owns only native controls and the official bridge reference; network binding belongs to serve. The query uses the application's retained articles resource and stable id ordering. It neither caches startup records nor opens a second database using a guessed relative filename.
We **text = [Read the home introduction](fs.read_text(path="components/content/home.md"))** and **intro = [Describe it as Markdown](component.markdown(text=`text`, slot="intro"))** and **live = [Assemble the native WebSocket widget](socket.nodes())**.
We **current = [Describe the current article query](query.query(source="articles", order="id", link_prefix=""))** and **articles = [Place the dynamic data resource](component.resource(value=`current`, slot="articles"))**.
We **body = [Keep introduction before interaction](table.concat(a=`intro`, b=`live`))**.
Return *[Keep the actual database list after the live widget](table.concat(a=`body`, b=`articles`))*.
@@ -0,0 +1,29 @@
---
markup: occlusion
title: Network-site recursive layout entry
import:
component: ext/web/component/index.mq.md
nav: nav.mq.md
side: side.mq.md
foot: foot.mq.md
table: lib/table.mq.md
---
Read this entry before changing page geometry. Navigation, side rail and footer end in Markdown leaves; the caller supplies main content nodes. Database queries and form references remain resources inside that main region, preserving fresh request behavior without rebuilding layout or concatenating HTML.
## frame
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
| body | list | required | Main content nodes supplied by the page's own component |
| 返回 | 类型 | 说明 |
|---|---|---|
| result | list | Ordered navigation, side/main row, footer and stylesheet resource |
Use `body` to assemble one page in the same site frame. Each child module owns its content; this parent only declares order and one side-by-side relationship. The native row layout collapses on narrow screens. No child is rendered into a string before composition. The theme URL points to a file explicitly compiled by serve before discovery starts.
We **top = [Read the navigation component](nav.nav())** and **rail = [Read the side-rail component](side.side())** and **main = [Name the supplied main region](component.wrap(children=`body`, kind="column", slot="main"))**.
We **columns = [Keep side rail and main as sibling components](table.concat(a=`rail`, b=`main`))** and **center = [Declare the shared row geometry](component.wrap(children=`columns`, kind="row", slot="page-body"))** and **bottom = [Read the closing links](foot.foot())**.
We **page = [Keep navigation before content](table.concat(a=`top`, b=`center`))** and **page = [Keep the footer after content](table.concat(a=`page`, b=`bottom`))** and **style = [Reference the compiled declarative theme](component.asset(url="/static/generated/theme.css", kind="stylesheet"))**.
Return *[Retain the style resource with the readable page structure](table.concat(a=`page`, b=`style`))*.
@@ -0,0 +1,53 @@
---
markup: occlusion
title: Native WebSocket widget
import:
component: ext/web/component/index.mq.md
client: ext/web/client/index.mq.md
table: lib/table.mq.md
---
This component ends at simple Markdown and native controls. It owns no network listener or hand-written HTML. The client program supplies events through the official bridge; serve separately binds the native /live echo resource. Keep control ids stable when editing wording so the client contract stays readable.
## nodes
| 返回 | 类型 | 说明 |
|---|---|---|
| result | list | WebSocket heading, status, input/send controls, message log and bridge resource |
The heading explains the interaction. Status and output use independent plain-text targets, input supplies the send value, and the button starts disabled until a real connection opens. Values and attributes remain typed data. Each echoed message is appended by the Marqdo client state and shown as text, so message content cannot become HTML. This construction does not open a socket.
The bridge addresses are explicit resources under the site's static mount. Prepare the current WASM and bridge in public/generated before serving; copying an older bridge can change event behavior even when the page still renders. The source at public/client.mq.md is served as UTF-8 client code and runs in the official browser runtime. To inspect construction alone, call this file's nodes function with no effects: it returns typed structure and performs no network request.
We **heading = [Describe the widget in ordinary Markdown](component.markdown(text="## Live WebSocket", slot="live-heading"))**.
`status_attrs` =
| id | aria-live |
|---|---|
| live-status | polite |
`input_attrs` =
| id | placeholder | type |
|---|---|---|
| live-msg | type a message… | text |
`button_attrs` =
| id | type | disabled |
|---|---|---|
| live-send | button | True |
`output_attrs` =
| id | aria-live |
|---|---|
| live-out | polite |
We **status = [Keep connection state separate from messages](component.element(kind="text", value="connecting…", attrs=`status_attrs`, slot="live-status"))** and **input = [Describe the native message input](component.element(kind="input", attrs=`input_attrs`, slot="live-input"))** and **button = [Describe the initially disabled send action](component.element(kind="button", value="Send", attrs=`button_attrs`, slot="live-send"))**.
We **controls = [Keep the input beside its send button](table.concat(a=`input`, b=`button`))** and **controls = [Declare responsive control geometry](component.wrap(children=`controls`, kind="row", slot="live-controls"))** and **output = [Describe the plain message log](component.element(kind="pre", attrs=`output_attrs`, slot="live-output"))**.
We **body = [Start with the explanatory heading](table.concat(a=`heading`, b=`status`))** and **body = [Place interaction after status](table.concat(a=`body`, b=`controls`))** and **body = [Keep the echoed messages after controls](table.concat(a=`body`, b=`output`))**.
We **id = [Name the widget's existing fragment destination](table.put(in=None, at="id", value="live"))** and **widget = [Keep the terminal pieces in one semantic region](component.wrap(children=`body`, kind="section", attrs=`id`, slot="live"))**.
We **runtime = [Declare the official runtime and Marqdo client source](client.nodes(source="/static/client.mq.md", wasm="/static/generated/marqdo_wasm.wasm", bridge="/static/generated/marqdo-bridge.js"))**.
Return *[Retain widget and runtime as structured nodes](table.concat(a=`widget`, b=`runtime`))*.
+12 -11
View File
@@ -1,19 +1,20 @@
---
markup: occlusion
title: nav Markdown component
import:
component: ext/web/component/index.mq.md
fs: lib/fs.mq.md
---
This leaf module owns nav content and its semantic region. Parent layout only places the returned nodes. Edit the adjacent Markdown leaf to change wording or links; the component does not query records, authenticate users or generate a raw HTML string.
## nav
Site top navigation. The Admin tab points at the login-gated admin page.
| 返回 | 类型 | 说明 |
|---|---|---|
| result | list | One nav region containing terminal Markdown content |
`nav` =
Read the Markdown leaf relative to the granted site root with fs.read. Its links keep the original example's destinations; actual routing and access policy remain in the serving entry. This region is already simple enough to express as Markdown, so further wrappers or a custom table dialect would add no responsibility. The semantic container and class preserve its role for the native layout and theme.
| 属性 | 值 | 样式 |
|------|-----|------|
| Home | / | |
| About | /about | |
| Publish | /new | |
| Tools | /tools | |
| Admin | /admin | |
*`nav`*
We **text = [Read this region's terminal Markdown](fs.read_text(path="components/content/nav.md"))** and **leaf = [Retain content as native Markdown](component.markdown(text=`text`, slot="nav-content"))**.
Return *[Place that leaf in its semantic region](component.wrap(children=`leaf`, kind="nav", slot="nav", style="topnav"))*.
+12 -11
View File
@@ -1,19 +1,20 @@
---
markup: occlusion
title: side Markdown component
import:
component: ext/web/component/index.mq.md
fs: lib/fs.mq.md
---
This leaf module owns side content and its semantic region. Parent layout only places the returned nodes. Edit the adjacent Markdown leaf to change wording or links; the component does not query records, authenticate users or generate a raw HTML string.
## side
Sidebar index of what this example demonstrates.
| 返回 | 类型 | 说明 |
|---|---|---|
| result | list | One aside region containing terminal Markdown content |
`side` =
Read the Markdown leaf relative to the granted site root with fs.read. Its links keep the original example's destinations; actual routing and access policy remain in the serving entry. This region is already simple enough to express as Markdown, so further wrappers or a custom table dialect would add no responsibility. The semantic container and class preserve its role for the native layout and theme.
| 属性 | 值 | 样式 |
|------|-----|------|
| Articles | / | |
| WebSocket | /#live | |
| Auth | /admin | |
| Forms | /new | |
| net lib | /tools | |
*`side`*
We **text = [Read this region's terminal Markdown](fs.read_text(path="components/content/side.md"))** and **leaf = [Retain content as native Markdown](component.markdown(text=`text`, slot="side-content"))**.
Return *[Place that leaf in its semantic region](component.wrap(children=`leaf`, kind="aside", slot="side", style="side"))*.