refactor(PR-02): protocol/reader architecture, /api/documents and reader IA
- migrate crate to RFC-0002 §5.3 Reader layout: src/protocol/{analysis_v2,
trace_v2,tool_v1}.rs, src/reader/{source,markdown,model,assemble,render,
assets}.rs, src/config.rs; lib.rs is the composition root; delete app/project/
semantic/trace/document/presentation/source_map/render/assets top-level files
- split presentation into model (types) and assemble (merge/stale/DocumentService)
- merge controlled project root/path boundary and UTF-8 byte spans into
reader/source.rs; move view.json config to config.rs
- replace GET /api/document with read-only GET /api/documents (documents list +
current outline/function/analysis summary) and add contract tests
- reading UI: drop variable/memory placeholder actions, keep one explicit
unsupported explanation, add simple dark theme toggle over the single token
layer; assert via rendering test
- reorganize tests into Cargo [[test]] suites tests/contract and
tests/integration; record docs/evidence/PR-02
- unit 41 + contract 41 + integration 33 all pass; clippy clean
This commit is contained in:
1 parent
5a61788bc9
commit
5c9a313424
43 files changed
+1222
-936
No files matched your search
+34
-8
@@ -213,6 +213,22 @@
|
||||
closeAllDialogs();
|
||||
}
|
||||
|
||||
function applyTheme(theme, announce) {
|
||||
var next = theme === "dark" ? "dark" : "light";
|
||||
reader.dataset.theme = next;
|
||||
try {
|
||||
window.localStorage.setItem("marqdo.view.theme", next);
|
||||
} catch (error) {
|
||||
/* storage is optional */
|
||||
}
|
||||
if (announce) toast(next === "dark" ? "已切换到深色主题" : "已切换到暖纸主题");
|
||||
}
|
||||
|
||||
function cycleTheme() {
|
||||
applyTheme(reader.dataset.theme === "dark" ? "light" : "dark", true);
|
||||
closeAllDialogs();
|
||||
}
|
||||
|
||||
function cycleTextSize() {
|
||||
var order = ["normal", "large", "small"];
|
||||
var current = reader.dataset.size || "normal";
|
||||
@@ -272,17 +288,15 @@
|
||||
case "annotations":
|
||||
toggleAnnotationVisibility();
|
||||
break;
|
||||
case "variables":
|
||||
case "unsupported":
|
||||
showUnsupported(
|
||||
"变量快照",
|
||||
"Trace v2 不提供逐语句赋值后的实际值;View 只能展示 Analysis 中的静态参数与赋值目标,绝不猜测运行时数据。"
|
||||
"变量快照 / 内存检查 / 调试器 / 证明状态",
|
||||
"Trace v2 不提供逐语句赋值后的实际值或内存快照,公开协议也没有断点/单步通道;" +
|
||||
"知识证明属于独立 Prove 工具。View 绝不猜测这些运行事实,相应能力在具备公开、受版本约束的协议前不会出现。"
|
||||
);
|
||||
break;
|
||||
case "memory":
|
||||
showUnsupported(
|
||||
"内存快照",
|
||||
"当前公开协议没有内存观测通道;该能力需等待未来独立、受权限审计的调试协议。"
|
||||
);
|
||||
case "theme":
|
||||
cycleTheme();
|
||||
break;
|
||||
case "about":
|
||||
openDialog("mq-dialog-about");
|
||||
@@ -451,6 +465,18 @@
|
||||
}
|
||||
}, true);
|
||||
|
||||
// Restore reading preferences (theme only; never secrets/permissions).
|
||||
try {
|
||||
var storedTheme = window.localStorage.getItem("marqdo.view.theme");
|
||||
if (storedTheme === "dark" || storedTheme === "light") {
|
||||
applyTheme(storedTheme, false);
|
||||
} else if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||
applyTheme("dark", false);
|
||||
}
|
||||
} catch (error) {
|
||||
/* storage is optional */
|
||||
}
|
||||
|
||||
// Restore a URL-selected mode, then honour the persisted diagnostics state.
|
||||
try {
|
||||
var params = new URLSearchParams(window.location.search);
|
||||
|
||||
Reference in new issue
Block a user