桌面 GUI 外链修复 + 主题顺序调整(含结构扁平化进行中的工作区基线)
- 集成 tauri-plugin-opener:Cargo/lib.rs/capabilities/npm 四处接线,新增 src/openExternal.ts(桌面走 opener,浏览器回退 window.open,相对路径绝对化) - 关于页 4 个链接、活动栏官网菜单、代理错误横幅 2 处健康检查链接全部改走 openExternal,桌面端可正常跳转 - 设置→外观 主题顺序调整为 深色/浅色/跟随系统 - release 二进制重编并验证(浏览器实测关于页链接可开文档页) - 附带工作区中未提交的扁平化重构现状(另一会话进行中) - homepage 落地页与文档终检通过(8787 / 与 /docs 双 200)
This commit is contained in:
1 parent
6452026fd6
commit
2bb4ef7a95
299 files changed
+6059
-3322
No files matched your search
@@ -0,0 +1,42 @@
|
||||
export type JsonLine = {
|
||||
path: string;
|
||||
depth: number;
|
||||
key?: string;
|
||||
kind: "open" | "close" | "value";
|
||||
text: string;
|
||||
tone?: "string" | "number" | "boolean" | "null";
|
||||
foldable?: boolean;
|
||||
expanded?: boolean;
|
||||
};
|
||||
|
||||
/** Pretty JSON lines retain separators and paths, including after collapsing branches. */
|
||||
export function jsonLines(value: unknown, collapsed: ReadonlySet<string> = new Set()): JsonLine[] {
|
||||
const lines: JsonLine[] = [];
|
||||
function visit(current: unknown, path: string, depth: number, key: string | undefined, last: boolean) {
|
||||
const comma = last ? "" : ",";
|
||||
if (current !== null && typeof current === "object") {
|
||||
const array = Array.isArray(current);
|
||||
const entries: [string, unknown][] = array
|
||||
? current.map((item, index) => [String(index), item])
|
||||
: Object.entries(current);
|
||||
const open = array ? "[" : "{";
|
||||
const close = array ? "]" : "}";
|
||||
if (entries.length === 0) {
|
||||
lines.push({ path, depth, key, kind: "value", text: `${open}${close}${comma}` });
|
||||
} else if (collapsed.has(path)) {
|
||||
lines.push({ path, depth, key, kind: "open", text: `${open}…${close}${comma}`, foldable: true, expanded: false });
|
||||
} else {
|
||||
lines.push({ path, depth, key, kind: "open", text: open, foldable: true, expanded: true });
|
||||
entries.forEach(([childKey, childValue], index) => {
|
||||
visit(childValue, `${path}/${childKey.replace(/~/g, "~0").replace(/\//g, "~1")}`, depth + 1, array ? undefined : childKey, index === entries.length - 1);
|
||||
});
|
||||
lines.push({ path, depth, kind: "close", text: `${close}${comma}` });
|
||||
}
|
||||
return;
|
||||
}
|
||||
const tone = current === null ? "null" : typeof current as "string" | "number" | "boolean";
|
||||
lines.push({ path, depth, key, kind: "value", tone, text: `${JSON.stringify(current)}${comma}` });
|
||||
}
|
||||
visit(value, "$", 0, undefined, true);
|
||||
return lines;
|
||||
}
|
||||
Reference in new issue
Block a user