Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(diagram): elevate architecture diagram visuals and palette

tianma-if8116844f9ffb
diff --git a/apps/api/src/demo-seed-data.test.mjs b/apps/api/src/demo-seed-data.test.mjs
index 84b8df5d..571d4ad4 100644
--- a/apps/api/src/demo-seed-data.test.mjs
+++ b/apps/api/src/demo-seed-data.test.mjs
@@ -16,6 +16,8 @@ describe("demo seed catalog", () => {
expect(memoIds.size).toBe(DEMO_SEED_MEMOS.length);
expect(memoIds.has("memo_demo_overview")).toBe(true);
expect(memoIds.has("memo_demo_overview_en")).toBe(true);
+ expect(memoIds.has("memo_demo_architecture")).toBe(true);
+ expect(memoIds.has("memo_demo_architecture_en")).toBe(true);
for (const memo of DEMO_SEED_MEMOS) {
expect(notebookIds.has(memo.notebookId)).toBe(true);
}
diff --git a/apps/api/src/demo-seed-data.ts b/apps/api/src/demo-seed-data.ts
index 523ce226..2afff927 100644
--- a/apps/api/src/demo-seed-data.ts
+++ b/apps/api/src/demo-seed-data.ts
@@ -1,3 +1,4 @@
+import { serializeDiagramDocument, type DiagramDocument } from "@edgeever/shared";
import {
decodeDemoAttachment,
DEMO_ATTACHMENT_MARKDOWN_EN,
@@ -17,6 +18,90 @@ export const DEMO_SEED_NOTEBOOKS = [
{ id: "nb_demo_features_en", parentId: "nb_projects", name: "Feature Demos", slug: "feature-demos", icon: "notebook", color: "#0e7490", sortOrder: 22 },
];
+export const DEMO_ARCHITECTURE_DIAGRAM_ZH: DiagramDocument = {
+ schemaVersion: 2,
+ kind: "architecture",
+ nodes: [
+ { id: "boundary-clients", label: "全端客户端矩阵", x: 40, y: 48, width: 220, height: 490, shape: "boundary" },
+ { id: "boundary-cloud", label: "Serverless 核心服务层", x: 320, y: 48, width: 500, height: 490, shape: "boundary" },
+ { id: "boundary-ai", label: "AI 智能体与外部生态", x: 880, y: 48, width: 220, height: 490, shape: "boundary" },
+
+ { id: "client-web", label: "Web / PWA\n离线草稿 & 增量同步", x: 68, y: 104, width: 164, height: 68, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },
+ { id: "client-desktop", label: "macOS / Windows\n桌面客户端", x: 68, y: 200, width: 164, height: 68, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },
+ { id: "client-mobile", label: "iOS / Android\n原生客户端", x: 68, y: 296, width: 164, height: 68, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
+ { id: "client-clipper", label: "浏览器剪藏扩展\nChrome / Edge", x: 68, y: 392, width: 164, height: 68, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },
+
+ { id: "srv-api", label: "Hono API 引擎\nCloudflare Workers", x: 352, y: 140, width: 164, height: 68, shape: "service", resourceIcon: "serverless", parentId: "boundary-cloud" },
+ { id: "srv-mcp", label: "原生 MCP 端点\n/mcp 智能体服务", x: 352, y: 320, width: 164, height: 68, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-cloud" },
+ { id: "db-d1", label: "D1 SQLite 数据库\n双向同步与版本链", x: 616, y: 140, width: 164, height: 72, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-cloud" },
+ { id: "db-r2", label: "R2 对象存储\n图片与多媒体附件", x: 616, y: 260, width: 164, height: 68, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-cloud" },
+ { id: "db-vector", label: "向量检索与缓存\n语义索引层", x: 616, y: 380, width: 164, height: 72, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-cloud" },
+
+ { id: "ai-coding", label: "Claude / Cursor\n编码智能体", x: 908, y: 140, width: 164, height: 68, shape: "service", resourceIcon: "largeLanguageModel", parentId: "boundary-ai" },
+ { id: "ai-antigravity", label: "Antigravity Agent\n系统级协同", x: 908, y: 240, width: 164, height: 68, shape: "service", resourceIcon: "aiAgent", parentId: "boundary-ai" },
+ { id: "ai-inline", label: "行内智能助手\nBYOK 密钥直连", x: 908, y: 340, width: 164, height: 68, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-ai" },
+ ],
+ edges: [
+ { id: "edge-web-api", source: "client-web", target: "srv-api", label: "HTTPS / 同步游标", kind: "request" },
+ { id: "edge-desktop-api", source: "client-desktop", target: "srv-api", kind: "request" },
+ { id: "edge-mobile-api", source: "client-mobile", target: "srv-api", kind: "request" },
+ { id: "edge-clipper-api", source: "client-clipper", target: "srv-api", kind: "request" },
+
+ { id: "edge-api-d1", source: "srv-api", target: "db-d1", label: "事务与版本读写", kind: "data" },
+ { id: "edge-api-r2", source: "srv-api", target: "db-r2", label: "S3 资源存取", kind: "data" },
+ { id: "edge-api-vec", source: "srv-api", target: "db-vector", kind: "data" },
+
+ { id: "edge-mcp-d1", source: "srv-mcp", target: "db-d1", kind: "data" },
+ { id: "edge-mcp-vec", source: "srv-mcp", target: "db-vector", kind: "data" },
+
+ { id: "edge-coding-mcp", source: "ai-coding", target: "srv-mcp", label: "MCP Tools / SSE", kind: "request", bidirectional: true },
+ { id: "edge-antigravity-mcp", source: "ai-antigravity", target: "srv-mcp", kind: "request", bidirectional: true },
+ { id: "edge-inline-client", source: "ai-inline", target: "client-web", label: "端侧隐私直连", kind: "async" },
+ ],
+};
+
+export const DEMO_ARCHITECTURE_DIAGRAM_EN: DiagramDocument = {
+ schemaVersion: 2,
+ kind: "architecture",
+ nodes: [
+ { id: "boundary-clients", label: "Client Matrix", x: 40, y: 48, width: 220, height: 490, shape: "boundary" },
+ { id: "boundary-cloud", label: "Serverless Core Engine", x: 320, y: 48, width: 500, height: 490, shape: "boundary" },
+ { id: "boundary-ai", label: "AI Agents & Ecosystem", x: 880, y: 48, width: 220, height: 490, shape: "boundary" },
+
+ { id: "client-web", label: "Web / PWA\nOffline Drafts & Sync", x: 68, y: 104, width: 164, height: 68, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },
+ { id: "client-desktop", label: "macOS / Windows\nDesktop App", x: 68, y: 200, width: 164, height: 68, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },
+ { id: "client-mobile", label: "iOS / Android\nNative App", x: 68, y: 296, width: 164, height: 68, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },
+ { id: "client-clipper", label: "Web Clipper\nChrome / Edge", x: 68, y: 392, width: 164, height: 68, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },
+
+ { id: "srv-api", label: "Hono API Engine\nCloudflare Workers", x: 352, y: 140, width: 164, height: 68, shape: "service", resourceIcon: "serverless", parentId: "boundary-cloud" },
+ { id: "srv-mcp", label: "Native MCP Endpoint\n/mcp Agent Service", x: 352, y: 320, width: 164, height: 68, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-cloud" },
+ { id: "db-d1", label: "D1 SQLite Database\nSync & Revisions", x: 616, y: 140, width: 164, height: 72, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-cloud" },
+ { id: "db-r2", label: "R2 Object Storage\nImages & Attachments", x: 616, y: 260, width: 164, height: 68, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-cloud" },
+ { id: "db-vector", label: "Vector Search & Cache\nSemantic Index Layer", x: 616, y: 380, width: 164, height: 72, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-cloud" },
+
+ { id: "ai-coding", label: "Claude / Cursor\nCoding Agents", x: 908, y: 140, width: 164, height: 68, shape: "service", resourceIcon: "largeLanguageModel", parentId: "boundary-ai" },
+ { id: "ai-antigravity", label: "Antigravity Agent\nSystem Co-pilot", x: 908, y: 240, width: 164, height: 68, shape: "service", resourceIcon: "aiAgent", parentId: "boundary-ai" },
+ { id: "ai-inline", label: "Inline AI Assistant\nBYOK Privacy Direct", x: 908, y: 340, width: 164, height: 68, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-ai" },
+ ],
+ edges: [
+ { id: "edge-web-api", source: "client-web", target: "srv-api", label: "HTTPS / Sync Cursor", kind: "request" },
+ { id: "edge-desktop-api", source: "client-desktop", target: "srv-api", kind: "request" },
+ { id: "edge-mobile-api", source: "client-mobile", target: "srv-api", kind: "request" },
+ { id: "edge-clipper-api", source: "client-clipper", target: "srv-api", kind: "request" },
+
+ { id: "edge-api-d1", source: "srv-api", target: "db-d1", label: "Transactions & Log", kind: "data" },
+ { id: "edge-api-r2", source: "srv-api", target: "db-r2", label: "S3 Asset Access", kind: "data" },
+ { id: "edge-api-vec", source: "srv-api", target: "db-vector", kind: "data" },
+
+ { id: "edge-mcp-d1", source: "srv-mcp", target: "db-d1", kind: "data" },
+ { id: "edge-mcp-vec", source: "srv-mcp", target: "db-vector", kind: "data" },
+
+ { id: "edge-coding-mcp", source: "ai-coding", target: "srv-mcp", label: "MCP Tools / SSE", kind: "request", bidirectional: true },
+ { id: "edge-antigravity-mcp", source: "ai-antigravity", target: "srv-mcp", kind: "request", bidirectional: true },
+ { id: "edge-inline-client", source: "ai-inline", target: "client-web", label: "Client-side BYOK", kind: "async" },
+ ],
+};
+
export const DEMO_SEED_MEMOS_ZH = [
{
id: "memo_demo_overview",
@@ -219,6 +304,14 @@ sequenceDiagram
> 6. 随时在侧边栏或设置中点击 **“恢复 Demo 数据”**,一键重置演示工作区。
`,
},
+ {
+ id: "memo_demo_architecture",
+ notebookId: "nb_demo_features",
+ title: "🏗️ 架构全景:EdgeEver 全端协同与云原生 Serverless 架构图",
+ tags: ["architecture", "diagram", "serverless", "cloud-native", "mcp"],
+ isPinned: false,
+ markdown: serializeDiagramDocument(DEMO_ARCHITECTURE_DIAGRAM_ZH),
+ },
];
export const DEMO_SEED_REVISIONS = [
@@ -238,6 +331,20 @@ export const DEMO_SEED_REVISIONS = [
markdown:
"## 🌿 Welcome to EdgeEver (Initial Draft)\n\n- Classic Evernote 3-pane layout & Serverless self-hosted\n- Visual table editing & Markdown source toggle\n- Native MCP & AI agent synergy",
},
+ {
+ id: "rev_demo_architecture_1",
+ memoId: "memo_demo_architecture",
+ revision: 1,
+ title: "🏗️ 架构全景:EdgeEver 全端协同与云原生 Serverless 架构图",
+ markdown: serializeDiagramDocument(DEMO_ARCHITECTURE_DIAGRAM_ZH),
+ },
+ {
+ id: "rev_demo_architecture_1_en",
+ memoId: "memo_demo_architecture_en",
+ revision: 1,
+ title: "🏗️ System Topology: EdgeEver Multi-Client & Serverless Architecture",
+ markdown: serializeDiagramDocument(DEMO_ARCHITECTURE_DIAGRAM_EN),
+ },
];
export const DEMO_MEMO_ENGLISH = {
@@ -438,6 +545,10 @@ Export your entire library at any time from **Profile → Import and export**. T
> 6. Click **"Reset Demo Data"** in settings or the sidebar anytime to restore the demo workspace.
`,
},
+ memo_demo_architecture: {
+ title: "🏗️ System Topology: EdgeEver Multi-Client & Serverless Architecture",
+ markdown: serializeDiagramDocument(DEMO_ARCHITECTURE_DIAGRAM_EN),
+ },
} as const;
export const DEMO_SEED_MEMOS_EN = DEMO_SEED_MEMOS_ZH.map((memo) => {
@@ -451,13 +562,13 @@ export const DEMO_SEED_MEMOS_EN = DEMO_SEED_MEMOS_ZH.map((memo) => {
id: `${memo.id}_en`,
notebookId: "nb_demo_features_en",
title: english.title,
- markdown: `${english.markdown}${DEMO_ATTACHMENT_MARKDOWN_EN}`,
+ markdown: memo.id === "memo_demo_overview" ? `${english.markdown}${DEMO_ATTACHMENT_MARKDOWN_EN}` : english.markdown,
};
}).filter((memo): memo is NonNullable<typeof memo> => memo !== null);
export const DEMO_SEED_MEMOS_ZH_WITH_ATTACHMENTS = DEMO_SEED_MEMOS_ZH.map((memo) => ({
...memo,
- markdown: `${memo.markdown}${DEMO_ATTACHMENT_MARKDOWN_ZH}`,
+ markdown: memo.id === "memo_demo_overview" ? `${memo.markdown}${DEMO_ATTACHMENT_MARKDOWN_ZH}` : memo.markdown,
}));
export const DEMO_SEED_MEMOS = [...DEMO_SEED_MEMOS_ZH_WITH_ATTACHMENTS, ...DEMO_SEED_MEMOS_EN];
diff --git a/apps/web/src/components/DiagramEditorPane.test.mjs b/apps/web/src/components/DiagramEditorPane.test.mjs
index 0dfed31e..29c3e074 100644
--- a/apps/web/src/components/DiagramEditorPane.test.mjs
+++ b/apps/web/src/components/DiagramEditorPane.test.mjs
@@ -161,11 +161,10 @@ describe("diagram editor canvas surface", () => {
expect(source).not.toContain('t("diagram.saved")');
});
- test("uses a clean grid-free canvas for both diagram types", () => {
- expect(source).toContain("grid: false");
+ test("uses an engineering dot grid for architecture diagrams and a clean grid-free canvas for others", () => {
+ expect(source).toContain('document.kind === "architecture"');
expect(source).toContain("graph.clearGrid();");
- expect(source).not.toContain("diagramGrid");
- expect(source).not.toContain("graph.drawGrid");
+ expect(source).toContain("graph.drawGrid");
});
test("uses restrained rounded edges and fits the complete diagram without clipping", () => {
diff --git a/apps/web/src/components/DiagramEditorPane.tsx b/apps/web/src/components/DiagramEditorPane.tsx
index 7346a4c0..4fa9b710 100644
--- a/apps/web/src/components/DiagramEditorPane.tsx
+++ b/apps/web/src/components/DiagramEditorPane.tsx
@@ -106,6 +106,7 @@ import {
resolveFlowchartTheme,
serializeDiagramDocument,
ARCHITECTURE_COMPONENT_SHAPES,
+ ARCHITECTURE_LABEL_FONT,
ARCHITECTURE_SHAPE_RESOURCE,
architectureEdgeVisual,
architectureIconOffset,
@@ -755,7 +756,18 @@ const applyDiagramSurface = (
kind?: DiagramDocument["kind"],
) => {
graph.drawBackground({ color: diagramCanvasColor(kind ?? "mind-map", theme, appearance) });
- graph.clearGrid();
+ if (kind === "architecture") {
+ graph.drawGrid({
+ type: "dot",
+ args: {
+ color: appearance === "dark" ? "rgba(255, 255, 255, 0.12)" : "rgba(15, 23, 42, 0.08)",
+ thickness: 1.2,
+ },
+ });
+ graph.showGrid();
+ } else {
+ graph.clearGrid();
+ }
};
const prepareExportSvg = (background: string) => (svg: SVGSVGElement) => {
@@ -1209,16 +1221,48 @@ const diagramEdgeLabel = (
kind: DiagramDocument["kind"],
appearance: DiagramAppearance = "light",
theme?: DiagramTheme,
+ edgeKind?: DiagramEdgeKind,
) => {
+ if (kind === "architecture") {
+ const edgePaint = edgeKind ? resolveArchitectureSurface(appearance).edges[edgeKind] : undefined;
+ return {
+ position: { distance: 0.5, offset: { x: 0, y: -14 } },
+ attrs: {
+ label: {
+ text,
+ fill: appearance === "dark" ? "#E2E8F0" : "#334155",
+ fontSize: 11,
+ fontWeight: 500,
+ fontFamily: ARCHITECTURE_LABEL_FONT,
+ lineHeight: 16,
+ textWrap: { width: 140, height: 512 },
+ },
+ body: {
+ ref: "label",
+ refWidth: 1,
+ refHeight: 1,
+ refWidth2: 14,
+ refHeight2: 6,
+ refX: -7,
+ refY: -3,
+ fill: appearance === "dark" ? "rgba(15, 23, 42, 0.92)" : "rgba(255, 255, 255, 0.96)",
+ stroke: edgePaint?.stroke ?? (appearance === "dark" ? "rgba(148, 163, 184, 0.3)" : "rgba(203, 213, 225, 0.8)"),
+ strokeWidth: 1,
+ rx: 6,
+ ry: 6,
+ style: { filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.05))" },
+ },
+ },
+ };
+ }
const flowchart = kind === "flowchart" ? resolveFlowchartSurface(appearance, theme) : null;
- const architecture = kind === "architecture" ? resolveArchitectureSurface(appearance) : null;
return {
- position: { distance: 0.5, offset: kind === "architecture" ? { x: 0, y: -16 } : 0 },
+ position: { distance: 0.5, offset: 0 },
attrs: {
- label: { text, fill: flowchart?.process.text ?? architecture?.nodes.service.text ?? palette.nodeText, fontSize: 12, lineHeight: 16, textWrap: { width: 140, height: 512 } },
+ label: { text, fill: flowchart?.process.text ?? palette.nodeText, fontSize: 12, lineHeight: 16, textWrap: { width: 140, height: 512 } },
body: { ref: "label", refWidth: 1, refHeight: 1, refWidth2: 12, refHeight2: 8, refX: -6, refY: -4,
- fill: flowchart?.canvas ?? architecture?.canvas ?? palette.canvas,
- stroke: flowchart?.process.stroke ?? architecture?.nodes.service.stroke ?? palette.nodeStroke, strokeWidth: 1, rx: 4, ry: 4 },
+ fill: flowchart?.canvas ?? palette.canvas,
+ stroke: flowchart?.process.stroke ?? palette.nodeStroke, strokeWidth: 1, rx: 4, ry: 4 },
},
};
};
@@ -1260,7 +1304,7 @@ const edgeMetadata = (
...(mindLine ?? { fill: "none" }),
},
},
- labels: edge.label ? [diagramEdgeLabel(edge.label, palette, kind, appearance, theme)] : undefined,
+ labels: edge.label ? [diagramEdgeLabel(edge.label, palette, kind, appearance, theme, edgeKind)] : undefined,
};
};
@@ -1513,7 +1557,7 @@ const applyGraphPalette = (
}
if (kind !== "mind-map") edge.attr("line/fill", "none");
if (edge.getLabels().length > 0) {
- edge.setLabels(edge.getLabels().map((label) => diagramEdgeLabel(String(label.attrs?.label?.text ?? ""), palette, kind, appearance, theme)));
+ edge.setLabels(edge.getLabels().map((label) => diagramEdgeLabel(String(label.attrs?.label?.text ?? ""), palette, kind, appearance, theme, edgeKind)));
}
}
if (kind === "mind-map") applyMindMapHierarchy(graph, theme, appearance, structure);
@@ -1796,8 +1840,15 @@ export const DiagramEditorPane = ({
container: containerRef.current,
autoResize: true,
async: true,
- background: { color: diagramCanvasColor(document.kind, documentTheme, appearance) },
- grid: false,
+ grid: document.kind === "architecture" ? {
+ size: 20,
+ visible: true,
+ type: "dot",
+ args: {
+ color: appearance === "dark" ? "rgba(255, 255, 255, 0.12)" : "rgba(15, 23, 42, 0.08)",
+ thickness: 1.2,
+ },
+ } : false,
panning: false,
mousewheel: { enabled: true, modifiers: ["ctrl", "meta"], minScale: DIAGRAM_ZOOM_SCALE_MIN, maxScale: DIAGRAM_ZOOM_SCALE_MAX },
interacting: () => !readOnly && !spacePanActiveRef.current,
@@ -2566,7 +2617,8 @@ export const DiagramEditorPane = ({
return;
}
const palette = resolveDiagramPalette(themeRef.current, appearanceRef.current);
- edge.setLabels([diagramEdgeLabel(label, palette, document?.kind ?? "flowchart", appearanceRef.current, themeRef.current)]);
+ const edgeKind = edge.getData<EdgeData>()?.kind;
+ edge.setLabels([diagramEdgeLabel(label, palette, document?.kind ?? "flowchart", appearanceRef.current, themeRef.current, edgeKind)]);
};
const createConnectedFlowNode = (shape: DiagramNodeShape) => {
diff --git a/apps/web/src/components/ReadOnlyX6Diagram.tsx b/apps/web/src/components/ReadOnlyX6Diagram.tsx
index 782585e3..35b4be7c 100644
--- a/apps/web/src/components/ReadOnlyX6Diagram.tsx
+++ b/apps/web/src/components/ReadOnlyX6Diagram.tsx
@@ -47,8 +47,15 @@ export const ReadOnlyX6Diagram = ({
container,
width: measureWidth(),
height: Math.max(1, container.clientHeight),
- background: { color: cells.canvas },
- grid: false,
+ grid: diagram.kind === "architecture" ? {
+ size: 20,
+ visible: true,
+ type: "dot",
+ args: {
+ color: theme === "dark" ? "rgba(255, 255, 255, 0.12)" : "rgba(15, 23, 42, 0.08)",
+ thickness: 1.2,
+ },
+ } : false,
interacting: false,
panning: { enabled: true },
mousewheel: { enabled: true, minScale: 0.1, maxScale: 2.5 },
diff --git a/packages/shared/src/diagram-architecture-style.ts b/packages/shared/src/diagram-architecture-style.ts
index cd0f28e0..4c169eef 100644
--- a/packages/shared/src/diagram-architecture-style.ts
+++ b/packages/shared/src/diagram-architecture-style.ts
@@ -28,8 +28,8 @@ export const isArchitectureNodeShape = (shape: DiagramNodeShape) =>
shape === "boundary" || ARCHITECTURE_COMPONENT_SHAPES.includes(shape as ArchitectureComponentShape);
export const ARCHITECTURE_ACCENTS: Record<ArchitectureComponentShape, string> = {
- client: "#0891B2",
- frontend: "#2563EB",
+ client: "#2B5A84",
+ frontend: "#4338CA",
service: "#16A06E",
database: "#7C3AED",
storage: "#D97706",
@@ -69,6 +69,9 @@ export type ArchitectureSurface = {
canvas: string;
boundaryStroke: string;
boundaryText: string;
+ boundaryFill: string;
+ boundaryBadgeFill: string;
+ boundaryBadgeStroke: string;
nodes: Record<ArchitectureComponentShape, ArchitectureShapePaint>;
edges: Record<Exclude<DiagramEdgeKind, never>, ArchitectureEdgePaint>;
};
@@ -78,9 +81,12 @@ export const ARCHITECTURE_SURFACES: Record<ArchitectureAppearance, ArchitectureS
canvas: "#F5F8F6",
boundaryStroke: "#7B8F86",
boundaryText: "#1C3D31",
+ boundaryFill: "rgba(123, 143, 134, 0.05)",
+ boundaryBadgeFill: "rgba(255, 255, 255, 0.95)",
+ boundaryBadgeStroke: "rgba(123, 143, 134, 0.4)",
nodes: {
- client: { fill: "#E1F2F6", stroke: "#0A87A6", text: "#134F5D", accent: "#0891B2", iconFrame: "#CEE9F0" },
- frontend: { fill: "#E5ECFD", stroke: "#245DDA", text: "#203A76", accent: "#2563EB", iconFrame: "#D3E0FB" },
+ client: { fill: "#E9EFF5", stroke: "#3B6285", text: "#1A3B5C", accent: "#2B5A84", iconFrame: "#D4E2EE" },
+ frontend: { fill: "#EEF2FF", stroke: "#4338CA", text: "#312E81", accent: "#4F46E5", iconFrame: "#E0E7FF" },
service: { fill: "#E3F4EE", stroke: "#169567", text: "#19563E", accent: "#16A06E", iconFrame: "#D0ECE2" },
database: { fill: "#EFE7FD", stroke: "#7437DC", text: "#472877", accent: "#7C3AED", iconFrame: "#E5D8FB" },
storage: { fill: "#FAEFE1", stroke: "#CA6F07", text: "#71430F", accent: "#D97706", iconFrame: "#F7E4CD" },
@@ -99,9 +105,12 @@ export const ARCHITECTURE_SURFACES: Record<ArchitectureAppearance, ArchitectureS
canvas: "#101311",
boundaryStroke: "#5B6F66",
boundaryText: "#D7F4E8",
+ boundaryFill: "rgba(91, 111, 102, 0.12)",
+ boundaryBadgeFill: "rgba(16, 19, 17, 0.95)",
+ boundaryBadgeStroke: "rgba(91, 111, 102, 0.5)",
nodes: {
- client: { fill: "#0E363E", stroke: "#3EA9C3", text: "#D3EBF1", accent: "#3EA9C3", iconFrame: "#0C4F5E" },
- frontend: { fill: "#16294E", stroke: "#5585EF", text: "#D8E3FB", accent: "#5585EF", iconFrame: "#1A397A" },
+ client: { fill: "#132537", stroke: "#5A8EB9", text: "#DCE8F2", accent: "#5A8EB9", iconFrame: "#1C3752" },
+ frontend: { fill: "#18214D", stroke: "#6366F1", text: "#E0E7FF", accent: "#6366F1", iconFrame: "#232F6B" },
service: { fill: "#123A2B", stroke: "#49B58E", text: "#D5EEE5", accent: "#49B58E", iconFrame: "#13573E" },
database: { fill: "#2E1E4F", stroke: "#9965F1", text: "#E7DCFC", accent: "#9965F1", iconFrame: "#44267B" },
storage: { fill: "#482F0E", stroke: "#E1953D", text: "#F8E7D2", accent: "#E1953D", iconFrame: "#70430C" },
@@ -125,7 +134,7 @@ export const architectureShapePaint = (shape: DiagramNodeShape, appearance: Arch
const surface = resolveArchitectureSurface(appearance);
if (shape === "boundary") {
return {
- fill: "transparent",
+ fill: surface.boundaryFill,
stroke: surface.boundaryStroke,
text: surface.boundaryText,
accent: surface.boundaryStroke,
@@ -175,6 +184,7 @@ export const architectureNodeMarkup = (
if (shape === "boundary") {
return [
{ tagName: "rect", selector: "body" },
+ { tagName: "rect", selector: "headerBadge" },
{ tagName: "text", selector: "label" },
];
}
@@ -193,6 +203,7 @@ export const architectureNodeVisual = (
size: { width: number; height: number },
resourceIcon?: ArchitectureResourceIcon,
) => {
+ const surface = resolveArchitectureSurface(appearance);
const paint = architectureShapePaint(shape, appearance);
const boundary = shape === "boundary";
const radius = architectureBodyRadius(shape, size.height);
@@ -225,10 +236,26 @@ export const architectureNodeVisual = (
fontFamily: ARCHITECTURE_LABEL_FONT,
lineHeight: 18,
...(boundary
- ? { refX: 18, refY: 22, textAnchor: "start" as const, textVerticalAnchor: "middle" as const }
+ ? { refX: 20, refY: 20, textAnchor: "start" as const, textVerticalAnchor: "middle" as const }
: { refX: 54, refY: "50%", textAnchor: "start" as const, textVerticalAnchor: "middle" as const }),
},
- attrs: boundary ? {} : {
+ attrs: (boundary ? {
+ headerBadge: {
+ ref: "label",
+ refWidth: 1,
+ refHeight: 1,
+ refWidth2: 16,
+ refHeight2: 6,
+ refX: -8,
+ refY: -3,
+ fill: surface.boundaryBadgeFill,
+ stroke: surface.boundaryBadgeStroke,
+ strokeWidth: 1,
+ rx: 4,
+ ry: 4,
+ pointerEvents: "none",
+ },
+ } : {
iconFrame: {
x: ARCHITECTURE_ICON_INSET,
y: iconY,
@@ -241,7 +268,7 @@ export const architectureNodeVisual = (
pointerEvents: "none",
},
...iconAttrs,
- },
+ }) as Record<string, Record<string, string | number | undefined>>,
};
};
diff --git a/packages/shared/src/diagram-view.ts b/packages/shared/src/diagram-view.ts
index d718c6e2..80aca509 100644
--- a/packages/shared/src/diagram-view.ts
+++ b/packages/shared/src/diagram-view.ts
@@ -1,5 +1,6 @@
import { flowchartNodePresentation } from "./diagram-node-presentation";
import {
+ ARCHITECTURE_LABEL_FONT,
architectureEdgeVisual,
architectureNodeVisual,
resolveArchitectureSurface,
@@ -208,17 +209,31 @@ export const diagramDocumentToX6Cells = (
labels: edge.label ? [{ attrs: {
label: {
text: edge.label,
- fill: flowchartSurface?.process.text ?? architectureSurface?.nodes.service.text ?? palette.nodeText,
- fontSize: 12,
+ fill: document.kind === "architecture"
+ ? (appearance === "dark" ? "#E2E8F0" : "#334155")
+ : (flowchartSurface?.process.text ?? architectureSurface?.nodes.service.text ?? palette.nodeText),
+ fontSize: document.kind === "architecture" ? 11 : 12,
+ fontWeight: document.kind === "architecture" ? 500 : 400,
lineHeight: 16,
- fontFamily: FLOWCHART_LABEL_FONT,
+ fontFamily: document.kind === "architecture" ? ARCHITECTURE_LABEL_FONT : FLOWCHART_LABEL_FONT,
textWrap: { width: 140, height: 512 },
},
body: {
- ref: "label", refWidth: 1, refHeight: 1, refWidth2: 12, refHeight2: 8, refX: -6, refY: -4,
- fill: flowchartSurface?.canvas ?? architectureSurface?.canvas ?? palette.canvas,
- stroke: flowchartSurface?.process.stroke ?? architectureSurface?.nodes.service.stroke ?? palette.nodeStroke,
- strokeWidth: 1, rx: 5, ry: 5,
+ ref: "label", refWidth: 1, refHeight: 1,
+ refWidth2: document.kind === "architecture" ? 14 : 12,
+ refHeight2: document.kind === "architecture" ? 6 : 8,
+ refX: document.kind === "architecture" ? -7 : -6,
+ refY: document.kind === "architecture" ? -3 : -4,
+ fill: document.kind === "architecture"
+ ? (appearance === "dark" ? "rgba(15, 23, 42, 0.92)" : "rgba(255, 255, 255, 0.96)")
+ : (flowchartSurface?.canvas ?? architectureSurface?.canvas ?? palette.canvas),
+ stroke: document.kind === "architecture"
+ ? (architectureEdge?.stroke ?? (appearance === "dark" ? "rgba(148, 163, 184, 0.3)" : "rgba(203, 213, 225, 0.8)"))
+ : (flowchartSurface?.process.stroke ?? architectureSurface?.nodes.service.stroke ?? palette.nodeStroke),
+ strokeWidth: 1,
+ rx: document.kind === "architecture" ? 6 : 5,
+ ry: document.kind === "architecture" ? 6 : 5,
+ ...(document.kind === "architecture" ? { style: { filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.05))" } } : {}),
},
} }] : undefined,
};