feat(web): native SPA helpers, memory store, and demo

Add bridge scope=memory, lib/browser store_set/spa_goto, web-spa-app
list/detail/edit client routes demo, and helper smoke.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-17 20:58:21 +08:00
1 parent 5cf84fe9b7
commit b710745e88
9 files changed
+373

No files matched your search

+44
View File
@@ -154,6 +154,50 @@ focus.
*> table.put in=None at="navigate" value=spec*
## store_set
+ `key`
+ `value`
+ `scope`="memory"
In-memory (or local/session) key write for SPA client state. Prefer `scope=memory` for tab-local app state.
`spec` =
| op | key | value | scope |
|----|-----|-------|-------|
| set | `key` | `value` | `scope` |
*> table.put in=None at="storage" value=spec*
## store_get
+ `key`
+ `then`
+ `scope`="memory"
Read a key then call `then` with `{ok, value, found, key, scope}`.
`spec` =
| op | key | then | scope |
|----|-----|------|-------|
| get | `key` | `then` | `scope` |
*> table.put in=None at="storage" value=spec*
## spa_goto
+ `url`
+ `replace`=False
SPA navigation: `history.pushState` / `replaceState` via bridge `navigate` effect.
`spec` =
| url | replace |
|-----|---------|
| `url` | `replace` |
*> table.put in=None at="navigate" value=spec*
## storage
+ `spec`
+44
View File
@@ -153,6 +153,50 @@ import table:lib/table.mq.md
*> table.put in=None at="navigate" value=spec*
## 存设
+ `键`
+ `值`
+ `作用域`="memory"
SPA 客户端状态写入。优先 `作用域=memory`(页内内存)。
`spec` =
| op | key | value | scope |
|----|-----|-------|-------|
| set | `键` | `值` | `作用域` |
*> table.put in=None at="storage" value=spec*
## 存取
+ `键`
+ `然后`
+ `作用域`="memory"
读取键并回调 `然后`,参数含 `{ok, value, found, key, scope}`。
`spec` =
| op | key | then | scope |
|----|-----|------|-------|
| get | `键` | `然后` | `作用域` |
*> table.put in=None at="storage" value=spec*
## 页跳
+ `url`
+ `替换`=False
SPA 导航(bridge `navigate`)。
`spec` =
| url | replace |
|-----|---------|
| `url` | `替换` |
*> table.put in=None at="navigate" value=spec*
## 存储
+ `规格`