AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
import { DIAGRAM_DEFAULT_THEME, type DiagramDocument } from "@edgeever/shared";
// Ordinary node dimensions are computed by the renderer, including font metrics.
// Only boundaries have authored dimensions. Display changes must not create edits.
// Mind maps and flowcharts materialize the plain default. Architecture keeps the
// previous materialized theme so opening one does not write a color scheme.
export const diagramEditorSnapshot = (title: string, document: DiagramDocument) => JSON.stringify({
title,
document: {
schemaVersion: document.schemaVersion,
kind: document.kind,
theme: document.theme ?? (document.kind === "architecture" ? "brand" : DIAGRAM_DEFAULT_THEME),
structure: document.kind === "mind-map" ? document.structure ?? "map" : undefined,
nodes: document.nodes.map((node) => ({
id: node.id, label: node.label, x: node.x, y: node.y, shape: node.shape,
parentId: node.parentId, resourceIcon: node.resourceIcon,
...(node.shape === "boundary" ? { width: node.width, height: node.height } : {}),
})),
edges: document.edges.map((edge) => ({
id: edge.id, source: edge.source, target: edge.target,
label: edge.label, kind: edge.kind, bidirectional: edge.bidirectional,
})),
},
});