@elixpo/lixsketch 5.6.4 → 5.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp/index.js +5 -1
- package/dist/mcp/index.js.map +2 -2
- package/dist/mcp/stdio.js +5 -1
- package/dist/mcp/stdio.js.map +2 -2
- package/dist/react/{AIRenderer-SRF7LU5K.js → AIRenderer-R5M2CIDO.js} +13 -6
- package/dist/react/AIRenderer-R5M2CIDO.js.map +7 -0
- package/dist/react/Circle-HMM5PKJ2.js +10 -0
- package/dist/react/{CopyPaste-YUDZ6DHY.js → CopyPaste-P6G35CXO.js} +11 -10
- package/dist/react/{CopyPaste-YUDZ6DHY.js.map → CopyPaste-P6G35CXO.js.map} +1 -1
- package/dist/react/{EventDispatcher-7LAK7GQ7.js → EventDispatcher-M5B4EWHJ.js} +216 -63
- package/dist/react/EventDispatcher-M5B4EWHJ.js.map +7 -0
- package/dist/react/Frame-QEUEYITT.js +11 -0
- package/dist/react/{FreehandStroke-U6GYZOM4.js → FreehandStroke-WXIJKD5I.js} +2 -2
- package/dist/react/{GraphEngine-MM6ALA2N.js → GraphEngine-XH3RPYO4.js} +9 -2
- package/dist/react/GraphEngine-XH3RPYO4.js.map +7 -0
- package/dist/react/IconShape-NHJE4YBY.js +10 -0
- package/dist/react/ImageShape-33VCMSDP.js +10 -0
- package/dist/react/Line-A6FE232Q.js +10 -0
- package/dist/react/{LixScriptParser-JYWJX375.js → LixScriptParser-YS3ZOTGS.js} +6 -2
- package/dist/react/LixScriptParser-YS3ZOTGS.js.map +7 -0
- package/dist/react/{MermaidFlowchartRenderer-PQEC4TMI.js → MermaidFlowchartRenderer-EL3Q2MNW.js} +6 -2
- package/dist/react/MermaidFlowchartRenderer-EL3Q2MNW.js.map +7 -0
- package/dist/react/MermaidSequenceParser-DBYXW23P.js +8 -0
- package/dist/react/{MermaidSequenceRenderer-KCUHO7UI.js → MermaidSequenceRenderer-K4KHHEVC.js} +10 -3
- package/dist/react/MermaidSequenceRenderer-K4KHHEVC.js.map +7 -0
- package/dist/react/{MermaidStructuredRenderer-W7UKN7BM.js → MermaidStructuredRenderer-6LN3WISP.js} +7 -2
- package/dist/react/MermaidStructuredRenderer-6LN3WISP.js.map +7 -0
- package/dist/react/Rectangle-4U4CD2ER.js +10 -0
- package/dist/react/{SceneSerializer-SG6SJN5X.js → SceneSerializer-JEYTYXZQ.js} +120 -46
- package/dist/react/SceneSerializer-JEYTYXZQ.js.map +7 -0
- package/dist/react/{Selection-2TSH3J6P.js → Selection-23MOLHEI.js} +4 -4
- package/dist/react/{SketchEngine-UD2XV2KT.js → SketchEngine-OPJON7TD.js} +26 -26
- package/dist/react/{UndoRedo-IN4SXDG6.js → UndoRedo-QVNRI5OB.js} +8 -2
- package/dist/react/{arrowTool-OYDWJGQK.js → arrowTool-VH3PJPDM.js} +3 -3
- package/dist/react/{chunk-LSHZYN77.js → chunk-2DZHO67H.js} +2 -2
- package/dist/react/{chunk-XOWNCYE4.js → chunk-5NHJJJBZ.js} +3 -3
- package/dist/react/chunk-6AIFXYV6.js +31 -0
- package/dist/react/chunk-6AIFXYV6.js.map +7 -0
- package/dist/react/{chunk-K5RY4EV7.js → chunk-6GPWSPJF.js} +9 -5
- package/dist/react/{chunk-K5RY4EV7.js.map → chunk-6GPWSPJF.js.map} +2 -2
- package/dist/react/{chunk-ASBC5G35.js → chunk-B6CYUZC4.js} +2 -2
- package/dist/react/{chunk-OP56XPWF.js → chunk-DNFPTVIP.js} +2 -2
- package/dist/react/{chunk-XYUFEIZR.js → chunk-DWEFPKDO.js} +2 -2
- package/dist/react/{chunk-GQUZPON4.js → chunk-F56XUE5S.js} +4 -4
- package/dist/react/{chunk-7CM5XQDN.js → chunk-G3DJQY65.js} +20 -36
- package/dist/react/chunk-G3DJQY65.js.map +7 -0
- package/dist/react/{chunk-LJR7EVW2.js → chunk-JEGLUNBC.js} +3 -3
- package/dist/react/{chunk-6GPEWDRB.js → chunk-M7GAB24F.js} +52 -6
- package/dist/react/chunk-M7GAB24F.js.map +7 -0
- package/dist/react/{chunk-VQVEPJSA.js → chunk-MHV5P6TS.js} +2 -1
- package/dist/react/chunk-MHV5P6TS.js.map +7 -0
- package/dist/react/{chunk-PXFPPO3R.js → chunk-NH3NVSWT.js} +18 -2
- package/dist/react/chunk-NH3NVSWT.js.map +7 -0
- package/dist/react/{chunk-XFL4R5ZF.js → chunk-OK4ROGMM.js} +16 -35
- package/dist/react/chunk-OK4ROGMM.js.map +7 -0
- package/dist/react/{chunk-APTOPAOY.js → chunk-SSFEN5CY.js} +3 -3
- package/dist/react/{chunk-RGMDWLRJ.js → chunk-UEL2G6D2.js} +3 -3
- package/dist/react/{chunk-M6TMN76K.js → chunk-ULPIHUVC.js} +3 -3
- package/dist/react/{chunk-FETTJLCV.js → chunk-VZPH7OAM.js} +14 -22
- package/dist/react/chunk-VZPH7OAM.js.map +7 -0
- package/dist/react/{chunk-TKXKJNTX.js → chunk-W7XUY4GR.js} +16 -19
- package/dist/react/chunk-W7XUY4GR.js.map +7 -0
- package/dist/react/{chunk-EOURRJ55.js → chunk-XSE4HQ2D.js} +2 -2
- package/dist/react/{chunk-K5BG5MHY.js → chunk-ZNZAICWY.js} +36 -60
- package/dist/react/chunk-ZNZAICWY.js.map +7 -0
- package/dist/react/{circleTool-LDKGZALF.js → circleTool-2UODOBCV.js} +4 -4
- package/dist/react/{codeTool-4YZO5W7J.js → codeTool-F4RV7SAI.js} +4 -4
- package/dist/react/{frameTool-MXNJEXQQ.js → frameTool-NTGA5BI6.js} +4 -4
- package/dist/react/{freehandTool-26D3FOOX.js → freehandTool-L55EUB5C.js} +4 -4
- package/dist/react/{iconTool-46O5VEUX.js → iconTool-KQQBLGR3.js} +4 -4
- package/dist/react/{imageTool-P2RWZRHO.js → imageTool-LDJ45AD7.js} +4 -4
- package/dist/react/index.js +148 -37
- package/dist/react/index.js.map +4 -4
- package/dist/react/{lineTool-ZMR27U5L.js → lineTool-CSAFD7PW.js} +4 -4
- package/dist/react/{rectangleTool-EJKK6UTX.js → rectangleTool-YPD2SIIZ.js} +4 -4
- package/dist/react/{textTool-S4XXZHZH.js → textTool-VQHMWEFJ.js} +5 -5
- package/package.json +5 -2
- package/src/core/AIRenderer.js +8 -2
- package/src/core/CanvasSpace.js +28 -0
- package/src/core/GraphRenderer.js +8 -3
- package/src/core/LixScriptParser.js +7 -1
- package/src/core/MermaidFlowchartRenderer.js +5 -1
- package/src/core/MermaidSequenceParser.js +1 -0
- package/src/core/MermaidSequenceRenderer.js +8 -3
- package/src/core/MermaidStructuredRenderer.js +6 -1
- package/src/core/SceneSerializer.js +121 -38
- package/src/core/Selection.js +12 -2
- package/src/core/UndoRedo.js +59 -5
- package/src/react/components/AppMenu.jsx +20 -19
- package/src/react/components/canvas/CanvasRulers.jsx +8 -13
- package/src/react/components/canvas/SVGCanvas.jsx +2 -1
- package/src/react/components/canvas/rulerUnits.js +28 -0
- package/src/react/components/sidebars/PaintBucketSidebar.jsx +1 -1
- package/src/react/store/useSketchStore.js +24 -3
- package/src/react/store/useUIStore.js +24 -1
- package/src/react/utils/canvasBackgrounds.js +29 -0
- package/src/shapes/Circle.js +12 -19
- package/src/shapes/Frame.js +38 -69
- package/src/shapes/FreehandStroke.js +24 -1
- package/src/shapes/Rectangle.js +10 -22
- package/src/tools/circleTool.js +3 -27
- package/src/tools/paintBucketTool.js +72 -15
- package/src/tools/rectangleTool.js +7 -23
- package/src/tools/shapeRecognition.js +270 -0
- package/src/tools/shapeRecognitionTool.js +36 -183
- package/dist/react/AIRenderer-SRF7LU5K.js.map +0 -7
- package/dist/react/Circle-6POZCUZD.js +0 -9
- package/dist/react/EventDispatcher-7LAK7GQ7.js.map +0 -7
- package/dist/react/Frame-7D2MXCFF.js +0 -11
- package/dist/react/GraphEngine-MM6ALA2N.js.map +0 -7
- package/dist/react/IconShape-ZADX7Y33.js +0 -10
- package/dist/react/ImageShape-UJQN2HI7.js +0 -10
- package/dist/react/Line-APEULMHE.js +0 -10
- package/dist/react/LixScriptParser-JYWJX375.js.map +0 -7
- package/dist/react/MermaidFlowchartRenderer-PQEC4TMI.js.map +0 -7
- package/dist/react/MermaidSequenceParser-UKG2NSZY.js +0 -8
- package/dist/react/MermaidSequenceRenderer-KCUHO7UI.js.map +0 -7
- package/dist/react/MermaidStructuredRenderer-W7UKN7BM.js.map +0 -7
- package/dist/react/Rectangle-S7XUKWYD.js +0 -9
- package/dist/react/SceneSerializer-SG6SJN5X.js.map +0 -7
- package/dist/react/chunk-6GPEWDRB.js.map +0 -7
- package/dist/react/chunk-7CM5XQDN.js.map +0 -7
- package/dist/react/chunk-FETTJLCV.js.map +0 -7
- package/dist/react/chunk-K5BG5MHY.js.map +0 -7
- package/dist/react/chunk-PXFPPO3R.js.map +0 -7
- package/dist/react/chunk-TKXKJNTX.js.map +0 -7
- package/dist/react/chunk-VQVEPJSA.js.map +0 -7
- package/dist/react/chunk-XFL4R5ZF.js.map +0 -7
- /package/dist/react/{Circle-6POZCUZD.js.map → Circle-HMM5PKJ2.js.map} +0 -0
- /package/dist/react/{Frame-7D2MXCFF.js.map → Frame-QEUEYITT.js.map} +0 -0
- /package/dist/react/{FreehandStroke-U6GYZOM4.js.map → FreehandStroke-WXIJKD5I.js.map} +0 -0
- /package/dist/react/{IconShape-ZADX7Y33.js.map → IconShape-NHJE4YBY.js.map} +0 -0
- /package/dist/react/{ImageShape-UJQN2HI7.js.map → ImageShape-33VCMSDP.js.map} +0 -0
- /package/dist/react/{Line-APEULMHE.js.map → Line-A6FE232Q.js.map} +0 -0
- /package/dist/react/{MermaidSequenceParser-UKG2NSZY.js.map → MermaidSequenceParser-DBYXW23P.js.map} +0 -0
- /package/dist/react/{Rectangle-S7XUKWYD.js.map → Rectangle-4U4CD2ER.js.map} +0 -0
- /package/dist/react/{Selection-2TSH3J6P.js.map → Selection-23MOLHEI.js.map} +0 -0
- /package/dist/react/{SketchEngine-UD2XV2KT.js.map → SketchEngine-OPJON7TD.js.map} +0 -0
- /package/dist/react/{UndoRedo-IN4SXDG6.js.map → UndoRedo-QVNRI5OB.js.map} +0 -0
- /package/dist/react/{arrowTool-OYDWJGQK.js.map → arrowTool-VH3PJPDM.js.map} +0 -0
- /package/dist/react/{chunk-LSHZYN77.js.map → chunk-2DZHO67H.js.map} +0 -0
- /package/dist/react/{chunk-XOWNCYE4.js.map → chunk-5NHJJJBZ.js.map} +0 -0
- /package/dist/react/{chunk-ASBC5G35.js.map → chunk-B6CYUZC4.js.map} +0 -0
- /package/dist/react/{chunk-OP56XPWF.js.map → chunk-DNFPTVIP.js.map} +0 -0
- /package/dist/react/{chunk-XYUFEIZR.js.map → chunk-DWEFPKDO.js.map} +0 -0
- /package/dist/react/{chunk-GQUZPON4.js.map → chunk-F56XUE5S.js.map} +0 -0
- /package/dist/react/{chunk-LJR7EVW2.js.map → chunk-JEGLUNBC.js.map} +0 -0
- /package/dist/react/{chunk-APTOPAOY.js.map → chunk-SSFEN5CY.js.map} +0 -0
- /package/dist/react/{chunk-RGMDWLRJ.js.map → chunk-UEL2G6D2.js.map} +0 -0
- /package/dist/react/{chunk-M6TMN76K.js.map → chunk-ULPIHUVC.js.map} +0 -0
- /package/dist/react/{chunk-EOURRJ55.js.map → chunk-XSE4HQ2D.js.map} +0 -0
- /package/dist/react/{circleTool-LDKGZALF.js.map → circleTool-2UODOBCV.js.map} +0 -0
- /package/dist/react/{codeTool-4YZO5W7J.js.map → codeTool-F4RV7SAI.js.map} +0 -0
- /package/dist/react/{frameTool-MXNJEXQQ.js.map → frameTool-NTGA5BI6.js.map} +0 -0
- /package/dist/react/{freehandTool-26D3FOOX.js.map → freehandTool-L55EUB5C.js.map} +0 -0
- /package/dist/react/{iconTool-46O5VEUX.js.map → iconTool-KQQBLGR3.js.map} +0 -0
- /package/dist/react/{imageTool-P2RWZRHO.js.map → imageTool-LDJ45AD7.js.map} +0 -0
- /package/dist/react/{lineTool-ZMR27U5L.js.map → lineTool-CSAFD7PW.js.map} +0 -0
- /package/dist/react/{rectangleTool-EJKK6UTX.js.map → rectangleTool-YPD2SIIZ.js.map} +0 -0
- /package/dist/react/{textTool-S4XXZHZH.js.map → textTool-VQHMWEFJ.js.map} +0 -0
package/dist/react/{MermaidFlowchartRenderer-PQEC4TMI.js → MermaidFlowchartRenderer-EL3Q2MNW.js}
RENAMED
|
@@ -8,7 +8,11 @@ var TOP_MARGIN = 40;
|
|
|
8
8
|
var FONT_FAMILY = "lixFont, sans-serif";
|
|
9
9
|
function isThemeDark() {
|
|
10
10
|
if (typeof document === "undefined") return true;
|
|
11
|
-
|
|
11
|
+
if (document.body) {
|
|
12
|
+
if (document.body.classList.contains("theme-dark")) return true;
|
|
13
|
+
if (document.body.classList.contains("theme-light")) return false;
|
|
14
|
+
}
|
|
15
|
+
return !document.documentElement || document.documentElement.classList.contains("dark");
|
|
12
16
|
}
|
|
13
17
|
function nodeStrokeColor() {
|
|
14
18
|
return isThemeDark() ? "#fff" : "#1a1a2e";
|
|
@@ -430,4 +434,4 @@ export {
|
|
|
430
434
|
renderFlowchartPreviewSVG,
|
|
431
435
|
renderFlowchartSVG
|
|
432
436
|
};
|
|
433
|
-
//# sourceMappingURL=MermaidFlowchartRenderer-
|
|
437
|
+
//# sourceMappingURL=MermaidFlowchartRenderer-EL3Q2MNW.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/MermaidFlowchartRenderer.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n/**\n * MermaidFlowchartRenderer - Renders parsed flowchart diagrams as high-quality SVG.\n *\n * One renderer for both preview and canvas \u2014 ensures they always match.\n * Supports: rectangle [], rounded rectangle (), circle (()), diamond/rhombus {},\n * directed/undirected edges with labels, subgraphs, all directions (TD/TB/LR/RL/BT).\n *\n * Dark theme matching the app aesthetic.\n */\n\n// Layout constants\nconst NODE_W = 150;\nconst NODE_H = 50;\nconst H_SPACING = 200;\nconst V_SPACING = 120;\nconst SIDE_MARGIN = 50;\nconst TOP_MARGIN = 40;\nconst FONT_FAMILY = 'lixFont, sans-serif';\n\n// Issue #38 follow-up: theme-aware stroke / fill. Resolved at draw time\n// so a single render call uses whichever palette is active.\nfunction isThemeDark() {\n if (typeof document === 'undefined') return true;\n if (document.body) {\n if (document.body.classList.contains('theme-dark')) return true;\n if (document.body.classList.contains('theme-light')) return false;\n }\n return !document.documentElement || document.documentElement.classList.contains('dark');\n}\nfunction nodeStrokeColor() { return isThemeDark() ? '#fff' : '#1a1a2e'; }\nfunction edgeStrokeColor() { return isThemeDark() ? '#888' : '#444'; }\n\nconst DARK_THEME = {\n bg: '#1e1e28',\n nodeBg: 'transparent',\n nodeStroke: '#9090c0',\n nodeText: '#e0e0e0',\n edgeStroke: '#888',\n edgeText: '#a0a0b0',\n subgraphBg: 'rgba(80,80,120,0.08)',\n subgraphBorder: '#555',\n subgraphLabel: '#888',\n};\n\nconst LIGHT_THEME = {\n bg: '#fbfaf6',\n nodeBg: '#f5f2ea',\n nodeStroke: '#6e746c',\n nodeText: '#343832',\n edgeStroke: '#6e746c',\n edgeText: '#4f554e',\n subgraphBg: 'rgba(117, 135, 119, 0.06)',\n subgraphBorder: '#aaa99f',\n subgraphLabel: '#666b64',\n};\n\nfunction previewTheme() { return isThemeDark() ? DARK_THEME : LIGHT_THEME; }\n\nfunction escapeXml(str) {\n return String(str)\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\nfunction measureText(text, fontSize) {\n return text.length * fontSize * 0.55;\n}\n\n/**\n * Render a parsed flowchart diagram to SVG markup.\n *\n * @param {Object} diagram - Parsed from parseMermaid()\n * @param {Object} opts - { width?, height?, fitToContent? }\n * @returns {string} SVG markup string\n */\nexport function renderFlowchartSVG(diagram, opts = {}) {\n if (!diagram || !diagram.nodes || diagram.nodes.length === 0) return '';\n\n const THEME = previewTheme();\n\n const nodes = diagram.nodes;\n const edges = diagram.edges || [];\n const subgraphs = diagram.subgraphs || [];\n const direction = diagram.direction || 'TD';\n\n // Compute bounds of laid-out nodes\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n nodes.forEach(n => {\n const nw = n.width || NODE_W;\n const nh = n.height || NODE_H;\n minX = Math.min(minX, n.x);\n minY = Math.min(minY, n.y);\n maxX = Math.max(maxX, n.x + nw);\n maxY = Math.max(maxY, n.y + nh);\n });\n\n const dw = maxX - minX || 1;\n const dh = maxY - minY || 1;\n\n // If fitToContent or explicit size, scale to fit\n const targetW = opts.width || dw + SIDE_MARGIN * 2;\n const targetH = opts.height || dh + TOP_MARGIN * 2;\n\n let scale, offX, offY;\n if (opts.width || opts.height) {\n const pad = 40;\n scale = Math.min(\n (targetW - pad * 2) / dw,\n (targetH - pad * 2) / dh,\n 1.8\n );\n offX = (targetW - dw * scale) / 2 - minX * scale;\n offY = (targetH - dh * scale) / 2 - minY * scale;\n } else {\n scale = 1;\n offX = SIDE_MARGIN - minX;\n offY = TOP_MARGIN - minY;\n }\n\n const totalWidth = opts.width || Math.round(dw * scale + SIDE_MARGIN * 2);\n const totalHeight = opts.height || Math.round(dh * scale + TOP_MARGIN * 2);\n\n // Build node lookup for edge rendering\n const nodeById = new Map();\n nodes.forEach(n => {\n const nw = (n.width || NODE_W) * scale;\n const nh = (n.height || NODE_H) * scale;\n const nx = n.x * scale + offX;\n const ny = n.y * scale + offY;\n nodeById.set(n.id, {\n x: nx, y: ny, w: nw, h: nh,\n cx: nx + nw / 2, cy: ny + nh / 2,\n type: n.type, label: n.label,\n fill: n.fill, stroke: n.stroke, strokeWidth: n.strokeWidth,\n });\n });\n\n let svg = '';\n const defs = [];\n\n // Arrow markers (normal, dotted, thick)\n defs.push(`<marker id=\"fc-arrow\" markerWidth=\"10\" markerHeight=\"7\" refX=\"9\" refY=\"3.5\" orient=\"auto\">\n <path d=\"M1,1 L9,3.5 L1,6\" fill=\"none\" stroke=\"${THEME.edgeStroke}\" stroke-width=\"1.5\" stroke-linejoin=\"round\" />\n </marker>`);\n defs.push(`<marker id=\"fc-arrow-thick\" markerWidth=\"12\" markerHeight=\"9\" refX=\"11\" refY=\"4.5\" orient=\"auto\">\n <path d=\"M1,1 L11,4.5 L1,8\" fill=\"none\" stroke=\"${THEME.edgeStroke}\" stroke-width=\"2\" stroke-linejoin=\"round\" />\n </marker>`);\n\n // Background\n svg += `<rect x=\"0\" y=\"0\" width=\"${totalWidth}\" height=\"${totalHeight}\" fill=\"${THEME.bg}\" rx=\"8\" />`;\n\n // --- Subgraphs (rendered first, behind everything) ---\n for (const sg of subgraphs) {\n if (!sg.nodes || sg.nodes.length === 0) continue;\n\n let sgMinX = Infinity, sgMinY = Infinity, sgMaxX = -Infinity, sgMaxY = -Infinity;\n let hasNodes = false;\n for (const nid of sg.nodes) {\n const nd = nodeById.get(nid);\n if (!nd) continue;\n hasNodes = true;\n sgMinX = Math.min(sgMinX, nd.x);\n sgMinY = Math.min(sgMinY, nd.y);\n sgMaxX = Math.max(sgMaxX, nd.x + nd.w);\n sgMaxY = Math.max(sgMaxY, nd.y + nd.h);\n }\n if (!hasNodes) continue;\n\n const sgPad = 20 * scale;\n const sgX = sgMinX - sgPad;\n const sgY = sgMinY - sgPad - 16 * scale;\n const sgW = (sgMaxX - sgMinX) + sgPad * 2;\n const sgH = (sgMaxY - sgMinY) + sgPad * 2 + 16 * scale;\n\n svg += `<g data-fc-type=\"subgraph\" data-fc-id=\"${escapeXml(sg.id)}\">`;\n svg += `<rect x=\"${sgX}\" y=\"${sgY}\" width=\"${sgW}\" height=\"${sgH}\" rx=\"6\" fill=\"${THEME.subgraphBg}\" stroke=\"${THEME.subgraphBorder}\" stroke-width=\"1\" stroke-dasharray=\"4 2\" />`;\n if (sg.label) {\n svg += `<text x=\"${sgX + 8}\" y=\"${sgY + 14}\" fill=\"${THEME.subgraphLabel}\" font-size=\"${Math.max(9, 11 * scale)}\" font-family=\"${FONT_FAMILY}\">${escapeXml(sg.label)}</text>`;\n }\n svg += `</g>`;\n }\n\n // --- Edges ---\n edges.forEach(e => {\n const f = nodeById.get(e.from);\n const t = nodeById.get(e.to);\n if (!f || !t) return;\n\n const directed = e.directed !== false;\n const edgeStyle = e.style || 'normal';\n let strokeW, dashArr, markerRef;\n if (edgeStyle === 'thick') {\n strokeW = 3;\n dashArr = '';\n markerRef = directed ? ' marker-end=\"url(#fc-arrow-thick)\"' : '';\n } else if (edgeStyle === 'dotted') {\n strokeW = 1.5;\n dashArr = ' stroke-dasharray=\"5 3\"';\n markerRef = directed ? ' marker-end=\"url(#fc-arrow)\"' : '';\n } else {\n strokeW = 1.5;\n dashArr = '';\n markerRef = directed ? ' marker-end=\"url(#fc-arrow)\"' : '';\n }\n const eStroke = e.stroke || THEME.edgeStroke;\n\n // Compute connection points\n const sp = getEdgePoint(f, t);\n const ep = getEdgePoint(t, f);\n\n // Determine if we should curve\n const dx = t.cx - f.cx;\n const dy = t.cy - f.cy;\n const dist = Math.sqrt(dx * dx + dy * dy);\n let mx = (sp.x + ep.x) / 2;\n let my = (sp.y + ep.y) / 2;\n\n svg += `<g data-fc-type=\"edge\" data-fc-from=\"${escapeXml(e.from)}\" data-fc-to=\"${escapeXml(e.to)}\">`;\n\n if (dist > 0 && Math.abs(dy) > 15 && Math.abs(dx) > 15) {\n // Curved edge\n const perpX = -dy / dist;\n const perpY = dx / dist;\n const curveAmt = dist * 0.12;\n const cpx = mx + perpX * curveAmt;\n const cpy = my + perpY * curveAmt;\n mx = 0.25 * sp.x + 0.5 * cpx + 0.25 * ep.x;\n my = 0.25 * sp.y + 0.5 * cpy + 0.25 * ep.y;\n svg += `<path d=\"M ${sp.x} ${sp.y} Q ${cpx} ${cpy} ${ep.x} ${ep.y}\" fill=\"none\" stroke=\"${eStroke}\" stroke-width=\"${strokeW}\"${dashArr}${markerRef} />`;\n } else {\n svg += `<line x1=\"${sp.x}\" y1=\"${sp.y}\" x2=\"${ep.x}\" y2=\"${ep.y}\" stroke=\"${eStroke}\" stroke-width=\"${strokeW}\"${dashArr}${markerRef} />`;\n }\n\n // Edge label (supports multi-line via \\n)\n if (e.label) {\n const labelFontSize = Math.max(8, 10 * scale);\n const labelLines = e.label.split('\\n');\n const maxLineW = Math.max(...labelLines.map(l => measureText(l, labelFontSize)));\n const labelW = maxLineW + 12;\n const labelH = labelLines.length * (labelFontSize + 3) + 6;\n svg += `<rect x=\"${mx - labelW / 2}\" y=\"${my - labelH / 2}\" width=\"${labelW}\" height=\"${labelH}\" rx=\"3\" fill=\"${THEME.bg}\" opacity=\"0.85\" />`;\n if (labelLines.length === 1) {\n svg += `<text x=\"${mx}\" y=\"${my + 1}\" text-anchor=\"middle\" dominant-baseline=\"central\" fill=\"${THEME.edgeText}\" font-size=\"${labelFontSize}\" font-family=\"${FONT_FAMILY}\">${escapeXml(e.label)}</text>`;\n } else {\n const startY = my - ((labelLines.length - 1) * (labelFontSize + 3)) / 2;\n svg += `<text x=\"${mx}\" text-anchor=\"middle\" fill=\"${THEME.edgeText}\" font-size=\"${labelFontSize}\" font-family=\"${FONT_FAMILY}\">`;\n labelLines.forEach((ln, idx) => {\n svg += `<tspan x=\"${mx}\" dy=\"${idx === 0 ? 0 : labelFontSize + 3}\" y=\"${idx === 0 ? startY : ''}\">${escapeXml(ln)}</tspan>`;\n });\n svg += `</text>`;\n }\n }\n\n svg += `</g>`;\n });\n\n // --- Nodes ---\n nodes.forEach(n => {\n const d = nodeById.get(n.id);\n if (!d) return;\n\n const nStroke = n.stroke || THEME.nodeStroke;\n const nFill = n.fill || THEME.nodeBg;\n const nStrokeWidth = n.strokeWidth || 1.8;\n const fontSize = Math.max(9, Math.min(13, 12 * scale));\n\n svg += `<g data-fc-type=\"node\" data-fc-id=\"${escapeXml(n.id)}\">`;\n\n if (n.type === 'circle') {\n const r = Math.min(d.w, d.h) / 2;\n svg += `<circle cx=\"${d.cx}\" cy=\"${d.cy}\" r=\"${r}\" fill=\"${nFill}\" stroke=\"${nStroke}\" stroke-width=\"${nStrokeWidth}\" />`;\n } else if (n.type === 'diamond') {\n const hw = d.w / 2 * 0.85;\n const hh = d.h / 2 * 0.85;\n svg += `<polygon points=\"${d.cx},${d.cy - hh} ${d.cx + hw},${d.cy} ${d.cx},${d.cy + hh} ${d.cx - hw},${d.cy}\" fill=\"${nFill}\" stroke=\"${nStroke}\" stroke-width=\"${nStrokeWidth}\" />`;\n } else if (n.type === 'asymmetric') {\n // Flag/asymmetric shape: pointed left, flat right\n const notchX = d.x + 15 * scale;\n svg += `<polygon points=\"${d.x},${d.y} ${d.x + d.w},${d.y} ${d.x + d.w},${d.y + d.h} ${d.x},${d.y + d.h} ${notchX},${d.cy}\" fill=\"${nFill}\" stroke=\"${nStroke}\" stroke-width=\"${nStrokeWidth}\" />`;\n } else if (n.type === 'roundrect') {\n svg += `<rect x=\"${d.x}\" y=\"${d.y}\" width=\"${d.w}\" height=\"${d.h}\" rx=\"${12 * scale}\" fill=\"${nFill}\" stroke=\"${nStroke}\" stroke-width=\"${nStrokeWidth}\" />`;\n } else {\n svg += `<rect x=\"${d.x}\" y=\"${d.y}\" width=\"${d.w}\" height=\"${d.h}\" rx=\"${3 * scale}\" fill=\"${nFill}\" stroke=\"${nStroke}\" stroke-width=\"${nStrokeWidth}\" />`;\n }\n\n // Node label (supports multi-line via \\n)\n if (n.label) {\n const hasSolidFill = nFill && nFill !== 'transparent' && nFill !== 'none';\n const labelFill = n.labelColor || (hasSolidFill ? getContrastColor(nFill) : THEME.nodeText);\n\n const labelLines = n.label.split('\\n');\n if (labelLines.length === 1) {\n svg += `<text x=\"${d.cx}\" y=\"${d.cy}\" text-anchor=\"middle\" dominant-baseline=\"central\" fill=\"${labelFill}\" font-size=\"${fontSize}\" font-family=\"${FONT_FAMILY}\" font-weight=\"500\">${escapeXml(n.label)}</text>`;\n } else {\n const lineH = fontSize + 3;\n const startY = d.cy - ((labelLines.length - 1) * lineH) / 2;\n svg += `<text text-anchor=\"middle\" fill=\"${labelFill}\" font-size=\"${fontSize}\" font-family=\"${FONT_FAMILY}\" font-weight=\"500\">`;\n labelLines.forEach((ln, idx) => {\n svg += `<tspan x=\"${d.cx}\" y=\"${startY + idx * lineH}\">${escapeXml(ln)}</tspan>`;\n });\n svg += `</text>`;\n }\n }\n\n svg += `</g>`;\n });\n\n // Build final SVG\n const defsStr = defs.length > 0 ? `<defs>${defs.join('')}</defs>` : '';\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${totalWidth}\" height=\"${totalHeight}\" viewBox=\"0 0 ${totalWidth} ${totalHeight}\">${defsStr}${svg}</svg>`;\n}\n\n/**\n * Get the connection point on a node's boundary toward another node.\n */\nfunction getEdgePoint(node, target) {\n const dx = target.cx - node.cx;\n const dy = target.cy - node.cy;\n\n if (node.type === 'circle') {\n const r = Math.min(node.w, node.h) / 2;\n const dist = Math.sqrt(dx * dx + dy * dy) || 1;\n return { x: node.cx + (dx / dist) * r, y: node.cy + (dy / dist) * r };\n }\n\n if (node.type === 'diamond') {\n // Diamond edge intersection\n const hw = node.w / 2 * 0.85;\n const hh = node.h / 2 * 0.85;\n const adx = Math.abs(dx) || 0.001;\n const ady = Math.abs(dy) || 0.001;\n const t = Math.min(hw / adx, hh / ady);\n return { x: node.cx + dx * t * 0.95, y: node.cy + dy * t * 0.95 };\n }\n\n // Rectangle / rounded rect / asymmetric - exit from edges\n const hw = node.w / 2;\n const hh = node.h / 2;\n\n if (Math.abs(dx) < 0.001 || Math.abs(dy) * hw > Math.abs(dx) * hh) {\n if (dy > 0) return { x: node.cx, y: node.y + node.h };\n return { x: node.cx, y: node.y };\n }\n if (dx > 0) return { x: node.x + node.w, y: node.cy };\n return { x: node.x, y: node.cy };\n}\n\nfunction parseColor(hex) {\n if (!hex || hex === 'transparent' || hex === 'none') return null;\n let c = hex.replace('#', '');\n // Support 3-char shorthand (#9f6 \u2192 #99ff66)\n if (c.length === 3) c = c[0] + c[0] + c[1] + c[1] + c[2] + c[2];\n if (c.length < 6) return null;\n return {\n r: parseInt(c.substring(0, 2), 16),\n g: parseInt(c.substring(2, 4), 16),\n b: parseInt(c.substring(4, 6), 16),\n };\n}\n\nfunction getLuminance(hex) {\n const rgb = parseColor(hex);\n if (!rgb) return 0;\n return 0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b;\n}\n\nfunction getContrastColor(bgHex) {\n // Pick dark or light text based on background luminance\n return getLuminance(bgHex) > 140 ? '#1a1a2e' : '#f0f0f0';\n}\n\n/**\n * Generate preview SVG for the modal.\n */\nexport function renderFlowchartPreviewSVG(diagram) {\n return renderFlowchartSVG(diagram, { width: 600, height: 450 });\n}\n\n/**\n * Render a flowchart diagram onto the canvas as a real engine `Frame`\n * containing independent shapes \u2014 Rectangle nodes (with embedded labels)\n * joined by Arrow edges. Each child is fully independent for click /\n * drag / resize / colour-change, exactly like a user-drawn shape; the\n * Frame's `_diagramType` marker means deleting it pulls every child with\n * it (so the diagram behaves as one logical unit when you're done with\n * it) \u2014 see Frame.destroy().\n *\n * Issue #34 bug #3 (follow-up to #22 phase 5): drops the shared `groupId`\n * glue that made selecting one shape select the whole diagram; the Frame\n * is the explicit container instead.\n */\nexport function renderFlowchartOnCanvas(diagram) {\n if (!diagram || !diagram.nodes || diagram.nodes.length === 0) return false;\n if (!window.svg || !window.Rectangle || !window.Frame) {\n console.error('[FlowchartRenderer] Engine not initialized');\n return false;\n }\n\n const nodes = diagram.nodes;\n const edges = diagram.edges || [];\n\n // Diagram bounds (in the renderer's natural coordinate space)\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n nodes.forEach((n) => {\n const nw = n.width || 140;\n const nh = n.height || 60;\n minX = Math.min(minX, n.x);\n minY = Math.min(minY, n.y);\n maxX = Math.max(maxX, n.x + nw);\n maxY = Math.max(maxY, n.y + nh);\n });\n const dw = (maxX - minX) || 1;\n const dh = (maxY - minY) || 1;\n\n // Center on the current viewport\n const vb = window.currentViewBox || { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight };\n const vcx = vb.x + vb.width / 2;\n const vcy = vb.y + vb.height / 2;\n const ox = vcx - dw / 2 - minX;\n const oy = vcy - dh / 2 - minY;\n\n // \u2500\u2500 Wrapper frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Created up-front so we can call addShapeToFrame as each child is\n // built. _diagramType marks it so Frame.destroy() takes the children\n // along on delete (issue #34 bug #3).\n //\n // PADDING bumped from 40 \u2192 90 so edge labels, rotated diamond nodes,\n // and arrow heads near the diagram boundary stay inside the frame\n // instead of getting clipped at the corners.\n const PADDING = 90;\n const frameTitle = diagram.title || 'Mermaid diagram';\n const frame = new window.Frame(\n vcx - dw / 2 - PADDING,\n vcy - dh / 2 - PADDING,\n dw + PADDING * 2,\n dh + PADDING * 2,\n {\n stroke: '#888',\n strokeWidth: 1,\n fill: 'transparent',\n opacity: 0.7,\n frameName: frameTitle,\n }\n );\n frame._diagramType = 'mermaid-flowchart';\n window.shapes.push(frame);\n if (window.pushCreateAction) window.pushCreateAction(frame);\n\n const nodeMap = new Map(); // id \u2192 shape\n\n // \u2500\u2500 Nodes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n for (const n of nodes) {\n const nw = n.width || 140;\n const nh = n.height || 60;\n const nx = n.x + ox;\n const ny = n.y + oy;\n const cx = nx + nw / 2;\n const cy = ny + nh / 2;\n\n const opts = {\n stroke: n.stroke || nodeStrokeColor(),\n strokeWidth: n.strokeWidth ?? 1.5,\n fill: n.fill || 'transparent',\n fillStyle: n.fill && n.fill !== 'transparent' ? 'solid' : 'none',\n roughness: 1,\n label: n.label || '',\n labelColor: n.labelColor || (n.fill && n.fill !== 'transparent' ? getContrastColor(n.fill) : nodeStrokeColor()),\n };\n\n let shape = null;\n try {\n if (n.type === 'circle' && window.Circle) {\n shape = new window.Circle(cx, cy, nw / 2, nh / 2, opts);\n } else if (n.type === 'diamond') {\n const sz = Math.max(nw, nh) * 0.75;\n shape = new window.Rectangle(cx - sz / 2, cy - sz / 2, sz, sz, opts);\n shape.rotation = 45;\n if (typeof shape.draw === 'function') shape.draw();\n } else if (n.type === 'roundrect') {\n shape = new window.Rectangle(nx, ny, nw, nh, { ...opts, cornerRadius: Math.min(nw, nh) * 0.2 });\n } else {\n shape = new window.Rectangle(nx, ny, nw, nh, opts);\n }\n } catch (err) {\n console.warn('[FlowchartRenderer] Node creation failed:', n.id, err);\n continue;\n }\n if (!shape) continue;\n\n window.shapes.push(shape);\n if (window.pushCreateAction) window.pushCreateAction(shape);\n frame.addShapeToFrame(shape);\n\n nodeMap.set(n.id, { shape, x: nx, y: ny, width: nw, height: nh, centerX: cx, centerY: cy });\n }\n\n // \u2500\u2500 Edges \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n for (const e of edges) {\n const fromNode = nodeMap.get(e.from);\n const toNode = nodeMap.get(e.to);\n if (!fromNode || !toNode) continue;\n\n // Connect from the source center to the target center \u2014 autoAttach\n // will snap each endpoint to the appropriate edge of the shape.\n const sp = { x: fromNode.centerX, y: fromNode.centerY };\n const ep = { x: toNode.centerX, y: toNode.centerY };\n\n const directed = e.directed !== false;\n const style = e.style || 'normal';\n const isThick = style === 'thick';\n const isDotted = style === 'dotted';\n\n const opts = {\n stroke: e.stroke || edgeStrokeColor(),\n strokeWidth: isThick ? 3 : 1.5,\n roughness: 1,\n strokeDasharray: isDotted ? '5 3' : '',\n label: e.label || '',\n labelColor: e.labelColor || edgeStrokeColor(),\n };\n\n let connector = null;\n try {\n if (directed && window.Arrow) {\n connector = new window.Arrow(sp, ep, opts);\n } else if (window.Line) {\n connector = new window.Line(sp, ep, opts);\n } else if (window.Arrow) {\n connector = new window.Arrow(sp, ep, opts);\n }\n } catch (err) {\n console.warn('[FlowchartRenderer] Edge creation failed:', e, err);\n continue;\n }\n if (!connector) continue;\n\n window.shapes.push(connector);\n if (window.pushCreateAction) window.pushCreateAction(connector);\n frame.addShapeToFrame(connector);\n\n // Wire arrow endpoints into the source/target shapes so moving a\n // node drags its connections along. window.__autoAttach is set up\n // by AIRenderer.initAIRenderer() during engine init.\n if (directed && connector.shapeName === 'arrow' && typeof window.__autoAttach === 'function') {\n try {\n window.__autoAttach(connector, fromNode.shape, true, sp);\n window.__autoAttach(connector, toNode.shape, false, ep);\n } catch (err) {\n console.warn('[FlowchartRenderer] autoAttach failed:', err);\n }\n }\n }\n\n // Select the first node so the user has feedback that something\n // landed. Selecting a child (not the frame) reinforces the\n // \"independent shapes inside a frame\" model.\n const first = nodeMap.values().next().value;\n if (first) {\n window.currentShape = first.shape;\n if (typeof first.shape.selectShape === 'function') first.shape.selectShape();\n }\n\n return true;\n}\n"],
|
|
5
|
+
"mappings": ";;;AAYA,IAAM,SAAS;AACf,IAAM,SAAS;AAGf,IAAM,cAAc;AACpB,IAAM,aAAa;AACnB,IAAM,cAAc;AAIpB,SAAS,cAAc;AACnB,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,MAAI,SAAS,MAAM;AACf,QAAI,SAAS,KAA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BAAiB,SAAS;AAC9D,UAAM,gBAAgB,SAAS;AAK/B,QAAI,YAAY,UAAU,cAAc,WAAW,OAAO,OAAO,iBAAiB,YAAY;AAC1F,UAAI;AACA,eAAO,aAAa,WAAW,SAAS,OAAO,MAAM,EAAE;AACvD,eAAO,aAAa,WAAW,OAAO,OAAO,OAAO,EAAE;AAAA,MAC1D,SAAS,KAAK;AACV,gBAAQ,KAAK,0CAA0C,GAAG;AAAA,MAC9D;AAAA,IACJ;AAAA,EACJ;AAKA,QAAM,QAAQ,QAAQ,OAAO,EAAE,KAAK,EAAE;AACtC,MAAI,OAAO;AACP,WAAO,eAAe,MAAM;AAC5B,QAAI,OAAO,MAAM,MAAM,gBAAgB,WAAY,OAAM,MAAM,YAAY;AAAA,EAC/E;AAEA,SAAO;AACX;",
|
|
6
|
+
"names": ["hw", "hh"]
|
|
7
|
+
}
|
package/dist/react/{MermaidSequenceRenderer-KCUHO7UI.js → MermaidSequenceRenderer-K4KHHEVC.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
parseSequenceDiagram
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MHV5P6TS.js";
|
|
5
5
|
|
|
6
6
|
// src/core/MermaidSequenceRenderer.js
|
|
7
7
|
var PARTICIPANT_W = 100;
|
|
@@ -15,7 +15,14 @@ var BOTTOM_MARGIN = 30;
|
|
|
15
15
|
var SIDE_MARGIN = 40;
|
|
16
16
|
var FONT_FAMILY = "lixFont, sans-serif";
|
|
17
17
|
function themeColors() {
|
|
18
|
-
const isDark =
|
|
18
|
+
const isDark = (() => {
|
|
19
|
+
if (typeof document === "undefined") return true;
|
|
20
|
+
if (document.body) {
|
|
21
|
+
if (document.body.classList.contains("theme-dark")) return true;
|
|
22
|
+
if (document.body.classList.contains("theme-light")) return false;
|
|
23
|
+
}
|
|
24
|
+
return !document.documentElement || document.documentElement.classList.contains("dark");
|
|
25
|
+
})();
|
|
19
26
|
if (isDark) return DARK_THEME;
|
|
20
27
|
return {
|
|
21
28
|
bg: "#fbfaf6",
|
|
@@ -511,4 +518,4 @@ export {
|
|
|
511
518
|
renderSequencePreviewSVG,
|
|
512
519
|
renderSequenceSVG
|
|
513
520
|
};
|
|
514
|
-
//# sourceMappingURL=MermaidSequenceRenderer-
|
|
521
|
+
//# sourceMappingURL=MermaidSequenceRenderer-K4KHHEVC.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/MermaidSequenceRenderer.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n/**\n * MermaidSequenceRenderer - Renders parsed sequence diagrams as high-quality SVG.\n *\n * One renderer for both preview and canvas \u2014 ensures they always match.\n * The canvas renderer inserts the SVG into a frame; elements inside are\n * individually editable (each participant box, message label, note, etc.\n * is its own SVG group with data attributes for the editor).\n *\n * Design follows the reference image: dark theme, clean lines,\n * participant boxes at top and bottom, dashed lifelines, arrow styles.\n */\n\nimport { parseSequenceDiagram } from './MermaidSequenceParser.js';\n\n// Layout constants\nconst PARTICIPANT_W = 100;\nconst PARTICIPANT_H = 36;\nconst PARTICIPANT_GAP = 140;\nconst MSG_ROW_HEIGHT = 50;\nconst NOTE_PAD = 10;\nconst NOTE_MAX_W = 160;\nconst TOP_MARGIN = 30;\nconst BOTTOM_MARGIN = 30;\nconst SIDE_MARGIN = 40;\nconst FONT_FAMILY = 'lixFont, sans-serif';\nconst CODE_FONT = 'lixCode, monospace';\n\n// Issue #38 follow-up: theme-aware palette. The on-canvas renderer reads\n// `themeColors()` at draw time so a single render call gets whichever\n// palette is active. The dark THEME object below is kept for the SVG-\n// string preview path (`renderSequenceSVG`), which is rendered inside\n// the modal's preview pane.\nfunction themeColors() {\n const isDark = (() => {\n if (typeof document === 'undefined') return true;\n if (document.body) {\n if (document.body.classList.contains('theme-dark')) return true;\n if (document.body.classList.contains('theme-light')) return false;\n }\n return !document.documentElement || document.documentElement.classList.contains('dark');\n })();\n if (isDark) return DARK_THEME;\n return {\n bg: '#fbfaf6',\n participantBg: '#ffffff',\n participantBorder: '#9c9c9c',\n participantText: '#38384e',\n lifeline: '#b0b0b8',\n messageLine: '#62627a',\n messageDash: '#888',\n messageText: '#38384e',\n noteBg: '#fffce0',\n noteBorder: '#c0b870',\n noteText: '#5e5230',\n blockBg: 'rgba(80,80,120,0.08)',\n blockBorder: '#9c9c9c',\n blockLabel: '#62627a',\n crossColor: '#c2483a',\n };\n}\n\n// Theme colors (dark theme \u2014 preview/SVG-string path).\nconst DARK_THEME = {\n bg: '#1e1e28',\n participantBg: '#232329',\n participantBorder: '#555',\n participantText: '#e8e8ee',\n lifeline: '#444',\n messageLine: '#888',\n messageDash: '#666',\n messageText: '#e0e0e0',\n noteBg: '#3a3520',\n noteBorder: '#665e30',\n noteText: '#d4c870',\n blockBg: 'rgba(80,80,120,0.12)',\n blockBorder: '#555',\n blockLabel: '#a0a0b0',\n crossColor: '#e74c3c',\n};\n\nfunction escapeXml(str) {\n return String(str)\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\n/**\n * Measure approximate text width (since we can't use DOM measurement in pure SVG generation).\n * Uses a rough character-width heuristic.\n */\nfunction measureText(text, fontSize) {\n const avgCharWidth = fontSize * 0.55;\n return text.length * avgCharWidth;\n}\n\n/**\n * Word-wrap text into lines that fit within maxWidth.\n */\nfunction wrapText(text, fontSize, maxWidth) {\n // Handle <br/> tags\n const segments = text.split(/<br\\s*\\/?>/i);\n const lines = [];\n for (const segment of segments) {\n const words = segment.split(/\\s+/);\n let currentLine = '';\n for (const word of words) {\n const testLine = currentLine ? currentLine + ' ' + word : word;\n if (measureText(testLine, fontSize) > maxWidth && currentLine) {\n lines.push(currentLine);\n currentLine = word;\n } else {\n currentLine = testLine;\n }\n }\n if (currentLine) lines.push(currentLine);\n }\n return lines.length > 0 ? lines : [''];\n}\n\n/**\n * Render a parsed sequence diagram to SVG markup.\n *\n * @param {Object} diagram - Parsed from parseSequenceDiagram()\n * @param {Object} opts - { width?, fitToContent? }\n * @returns {string} SVG markup string\n */\nexport function renderSequenceSVG(diagram, opts = {}) {\n if (!diagram || diagram.type !== 'sequenceDiagram') return '';\n\n const THEME = themeColors();\n\n const participants = diagram.participants;\n const messages = diagram.messages;\n const notes = diagram.notes;\n const blocks = diagram.blocks || [];\n\n const pCount = participants.length;\n if (pCount === 0) return '';\n\n // Build participant index map\n const pIndex = new Map();\n participants.forEach((p, i) => pIndex.set(p.name, i));\n\n // Calculate total width\n const contentWidth = (pCount - 1) * PARTICIPANT_GAP + PARTICIPANT_W;\n const totalWidth = opts.width || Math.max(contentWidth + SIDE_MARGIN * 2, 400);\n const startX = (totalWidth - contentWidth) / 2;\n\n // Participant X centers\n const pCenters = participants.map((_, i) => startX + i * PARTICIPANT_GAP + PARTICIPANT_W / 2);\n\n // Pre-calculate note heights to account for row expansion\n const noteAtMsg = new Map(); // msgIndex -> [{note, height}]\n for (const note of notes) {\n const fontSize = 11;\n const lines = wrapText(note.text, fontSize, NOTE_MAX_W - NOTE_PAD * 2);\n const h = lines.length * (fontSize + 4) + NOTE_PAD * 2;\n if (!noteAtMsg.has(note.atMessage)) noteAtMsg.set(note.atMessage, []);\n noteAtMsg.get(note.atMessage).push({ ...note, lines, height: h });\n }\n\n // Calculate message Y positions (accounting for notes that expand rows)\n const topBoxBottom = TOP_MARGIN + PARTICIPANT_H;\n let currentY = topBoxBottom + 30; // gap after top participant boxes\n\n const msgYPositions = [];\n for (let mi = 0; mi < messages.length; mi++) {\n // Check if notes appear before this message\n const notesBefore = noteAtMsg.get(mi);\n if (notesBefore) {\n const maxNoteH = Math.max(...notesBefore.map(n => n.height));\n currentY += maxNoteH + 10;\n }\n msgYPositions.push(currentY);\n currentY += MSG_ROW_HEIGHT;\n }\n\n // Notes after last message\n const notesAfterLast = noteAtMsg.get(messages.length);\n if (notesAfterLast) {\n const maxNoteH = Math.max(...notesAfterLast.map(n => n.height));\n currentY += maxNoteH + 10;\n }\n\n const bottomBoxTop = currentY + 20;\n const totalHeight = bottomBoxTop + PARTICIPANT_H + BOTTOM_MARGIN;\n\n // Start building SVG\n let svg = '';\n const defs = [];\n\n // Arrow markers\n defs.push(`<marker id=\"seq-arrow-open\" markerWidth=\"10\" markerHeight=\"7\" refX=\"9\" refY=\"3.5\" orient=\"auto\">\n <polyline points=\"1,1 9,3.5 1,6\" fill=\"none\" stroke=\"${THEME.messageLine}\" stroke-width=\"1.5\" stroke-linejoin=\"round\" />\n </marker>`);\n defs.push(`<marker id=\"seq-arrow-filled\" markerWidth=\"10\" markerHeight=\"7\" refX=\"9\" refY=\"3.5\" orient=\"auto\">\n <polygon points=\"1,1 9,3.5 1,6\" fill=\"${THEME.messageLine}\" stroke=\"none\" />\n </marker>`);\n\n // Background\n svg += `<rect x=\"0\" y=\"0\" width=\"${totalWidth}\" height=\"${totalHeight}\" fill=\"${THEME.bg}\" rx=\"8\" />`;\n\n // Title\n if (diagram.title) {\n svg += `<text x=\"${totalWidth / 2}\" y=\"${TOP_MARGIN - 8}\" text-anchor=\"middle\" fill=\"${THEME.participantText}\" font-size=\"14\" font-family=\"${FONT_FAMILY}\" font-weight=\"600\">${escapeXml(diagram.title)}</text>`;\n }\n\n // --- Lifelines (dashed vertical lines) ---\n for (let pi = 0; pi < pCount; pi++) {\n const cx = pCenters[pi];\n svg += `<line x1=\"${cx}\" y1=\"${topBoxBottom}\" x2=\"${cx}\" y2=\"${bottomBoxTop}\" stroke=\"${THEME.lifeline}\" stroke-width=\"1\" stroke-dasharray=\"6 4\" />`;\n }\n\n // --- Participant boxes (top) ---\n for (let pi = 0; pi < pCount; pi++) {\n const cx = pCenters[pi];\n const bx = cx - PARTICIPANT_W / 2;\n const by = TOP_MARGIN;\n svg += `<g data-seq-type=\"participant\" data-seq-id=\"${escapeXml(participants[pi].name)}\" data-seq-pos=\"top\">`;\n svg += `<rect x=\"${bx}\" y=\"${by}\" width=\"${PARTICIPANT_W}\" height=\"${PARTICIPANT_H}\" rx=\"4\" fill=\"${THEME.participantBg}\" stroke=\"${THEME.participantBorder}\" stroke-width=\"1.5\" />`;\n svg += `<text x=\"${cx}\" y=\"${by + PARTICIPANT_H / 2 + 1}\" text-anchor=\"middle\" dominant-baseline=\"central\" fill=\"${THEME.participantText}\" font-size=\"13\" font-family=\"${FONT_FAMILY}\">${escapeXml(participants[pi].name)}</text>`;\n svg += `</g>`;\n }\n\n // --- Participant boxes (bottom) ---\n for (let pi = 0; pi < pCount; pi++) {\n const cx = pCenters[pi];\n const bx = cx - PARTICIPANT_W / 2;\n const by = bottomBoxTop;\n svg += `<g data-seq-type=\"participant\" data-seq-id=\"${escapeXml(participants[pi].name)}\" data-seq-pos=\"bottom\">`;\n svg += `<rect x=\"${bx}\" y=\"${by}\" width=\"${PARTICIPANT_W}\" height=\"${PARTICIPANT_H}\" rx=\"4\" fill=\"${THEME.participantBg}\" stroke=\"${THEME.participantBorder}\" stroke-width=\"1.5\" />`;\n svg += `<text x=\"${cx}\" y=\"${by + PARTICIPANT_H / 2 + 1}\" text-anchor=\"middle\" dominant-baseline=\"central\" fill=\"${THEME.participantText}\" font-size=\"13\" font-family=\"${FONT_FAMILY}\">${escapeXml(participants[pi].name)}</text>`;\n svg += `</g>`;\n }\n\n // --- Blocks (alt/loop/opt etc.) ---\n for (const block of blocks) {\n const startY = block.startMsg < msgYPositions.length\n ? msgYPositions[block.startMsg] - 20\n : topBoxBottom + 20;\n const endY = block.endMsg <= msgYPositions.length\n ? (block.endMsg < msgYPositions.length ? msgYPositions[block.endMsg] - 10 : currentY)\n : currentY;\n\n const blockX = startX - 15;\n const blockW = contentWidth + 30;\n\n svg += `<g data-seq-type=\"block\" data-block-type=\"${block.type}\">`;\n svg += `<rect x=\"${blockX}\" y=\"${startY}\" width=\"${blockW}\" height=\"${endY - startY}\" rx=\"4\" fill=\"${THEME.blockBg}\" stroke=\"${THEME.blockBorder}\" stroke-width=\"1\" stroke-dasharray=\"4 2\" />`;\n // Type label in top-left corner\n svg += `<rect x=\"${blockX}\" y=\"${startY}\" width=\"${measureText(block.type, 10) + 12}\" height=\"18\" rx=\"3\" fill=\"${THEME.blockBorder}\" />`;\n svg += `<text x=\"${blockX + 6}\" y=\"${startY + 12}\" fill=\"${THEME.bg}\" font-size=\"10\" font-family=\"${FONT_FAMILY}\" font-weight=\"600\">${escapeXml(block.type)}</text>`;\n // Condition label\n if (block.label) {\n svg += `<text x=\"${blockX + measureText(block.type, 10) + 20}\" y=\"${startY + 12}\" fill=\"${THEME.blockLabel}\" font-size=\"10\" font-family=\"${FONT_FAMILY}\" font-style=\"italic\">[${escapeXml(block.label)}]</text>`;\n }\n\n // Section dividers (else sections)\n for (let si = 1; si < block.sections.length; si++) {\n const section = block.sections[si];\n const secY = section.startMsg < msgYPositions.length\n ? msgYPositions[section.startMsg] - 15\n : endY - 10;\n svg += `<line x1=\"${blockX}\" y1=\"${secY}\" x2=\"${blockX + blockW}\" y2=\"${secY}\" stroke=\"${THEME.blockBorder}\" stroke-width=\"1\" stroke-dasharray=\"4 2\" />`;\n if (section.label) {\n svg += `<text x=\"${blockX + 8}\" y=\"${secY + 13}\" fill=\"${THEME.blockLabel}\" font-size=\"10\" font-family=\"${FONT_FAMILY}\" font-style=\"italic\">[${escapeXml(section.label)}]</text>`;\n }\n }\n svg += `</g>`;\n }\n\n // --- Messages ---\n for (let mi = 0; mi < messages.length; mi++) {\n const msg = messages[mi];\n const y = msgYPositions[mi];\n const fromIdx = pIndex.get(msg.from);\n const toIdx = pIndex.get(msg.to);\n if (fromIdx === undefined || toIdx === undefined) continue;\n\n const fromX = pCenters[fromIdx];\n const toX = pCenters[toIdx];\n const isSelf = fromIdx === toIdx;\n\n svg += `<g data-seq-type=\"message\" data-seq-idx=\"${mi}\">`;\n\n if (isSelf) {\n // Self-message: loop arrow to the right\n const loopW = 40;\n const loopH = 25;\n const dash = msg.solid ? '' : ` stroke-dasharray=\"6 3\"`;\n svg += `<path d=\"M ${fromX} ${y} L ${fromX + loopW} ${y} L ${fromX + loopW} ${y + loopH} L ${fromX + 4} ${y + loopH}\" fill=\"none\" stroke=\"${THEME.messageLine}\" stroke-width=\"1.5\"${dash} marker-end=\"url(#seq-arrow-open)\" />`;\n if (msg.text) {\n svg += `<text x=\"${fromX + loopW + 6}\" y=\"${y + loopH / 2 + 1}\" dominant-baseline=\"central\" fill=\"${THEME.messageText}\" font-size=\"12\" font-family=\"${FONT_FAMILY}\">${escapeXml(msg.text)}</text>`;\n }\n } else {\n const isLeft = toX < fromX;\n const lineEndX = isLeft ? toX + 4 : toX - 4;\n const dash = msg.solid ? '' : ` stroke-dasharray=\"6 3\"`;\n\n // Arrow line\n const markerId = msg.arrowHead === 'filled' ? 'seq-arrow-filled' : 'seq-arrow-open';\n\n if (msg.cross) {\n // Cross at end (lost message)\n svg += `<line x1=\"${fromX}\" y1=\"${y}\" x2=\"${lineEndX}\" y2=\"${y}\" stroke=\"${THEME.messageLine}\" stroke-width=\"1.5\"${dash} />`;\n // X mark\n const xSize = 6;\n svg += `<line x1=\"${toX - xSize}\" y1=\"${y - xSize}\" x2=\"${toX + xSize}\" y2=\"${y + xSize}\" stroke=\"${THEME.crossColor}\" stroke-width=\"2\" />`;\n svg += `<line x1=\"${toX + xSize}\" y1=\"${y - xSize}\" x2=\"${toX - xSize}\" y2=\"${y + xSize}\" stroke=\"${THEME.crossColor}\" stroke-width=\"2\" />`;\n } else {\n svg += `<line x1=\"${fromX}\" y1=\"${y}\" x2=\"${lineEndX}\" y2=\"${y}\" stroke=\"${THEME.messageLine}\" stroke-width=\"1.5\"${dash} marker-end=\"url(#${markerId})\" />`;\n }\n\n // Message text (centered above the line)\n if (msg.text) {\n const midX = (fromX + toX) / 2;\n const textContent = msg.number ? `${msg.number}. ${msg.text}` : msg.text;\n svg += `<text x=\"${midX}\" y=\"${y - 8}\" text-anchor=\"middle\" fill=\"${THEME.messageText}\" font-size=\"12\" font-family=\"${FONT_FAMILY}\">${escapeXml(textContent)}</text>`;\n }\n }\n\n svg += `</g>`;\n }\n\n // --- Notes ---\n for (const [msgIdx, noteGroup] of noteAtMsg.entries()) {\n const baseY = msgIdx < msgYPositions.length\n ? msgYPositions[msgIdx] - 15\n : (msgIdx > 0 ? msgYPositions[msgIdx - 1] + MSG_ROW_HEIGHT - 15 : topBoxBottom + 30);\n\n for (const note of noteGroup) {\n const targetIdxs = note.targets.map(t => pIndex.get(t)).filter(i => i !== undefined);\n if (targetIdxs.length === 0) continue;\n\n const fontSize = 11;\n const lineH = fontSize + 4;\n const noteH = note.lines.length * lineH + NOTE_PAD * 2;\n const noteW = Math.min(\n NOTE_MAX_W,\n Math.max(...note.lines.map(l => measureText(l, fontSize))) + NOTE_PAD * 2 + 10\n );\n\n let noteX;\n if (note.position === 'left of') {\n const px = pCenters[targetIdxs[0]];\n noteX = px - PARTICIPANT_W / 2 - noteW - 8;\n } else if (note.position === 'right of') {\n const px = pCenters[targetIdxs[0]];\n noteX = px + PARTICIPANT_W / 2 + 8;\n } else {\n // 'over' - center between targets\n if (targetIdxs.length >= 2) {\n const minP = Math.min(...targetIdxs);\n const maxP = Math.max(...targetIdxs);\n const center = (pCenters[minP] + pCenters[maxP]) / 2;\n noteX = center - noteW / 2;\n } else {\n noteX = pCenters[targetIdxs[0]] - noteW / 2;\n }\n }\n\n const noteY = baseY - noteH;\n\n svg += `<g data-seq-type=\"note\">`;\n svg += `<rect x=\"${noteX}\" y=\"${noteY}\" width=\"${noteW}\" height=\"${noteH}\" rx=\"3\" fill=\"${THEME.noteBg}\" stroke=\"${THEME.noteBorder}\" stroke-width=\"1\" />`;\n // Render wrapped text lines\n note.lines.forEach((line, li) => {\n svg += `<text x=\"${noteX + NOTE_PAD}\" y=\"${noteY + NOTE_PAD + li * lineH + fontSize}\" fill=\"${THEME.noteText}\" font-size=\"${fontSize}\" font-family=\"${FONT_FAMILY}\">${escapeXml(line)}</text>`;\n });\n svg += `</g>`;\n }\n }\n\n // Build final SVG\n const defsStr = defs.length > 0 ? `<defs>${defs.join('')}</defs>` : '';\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${totalWidth}\" height=\"${totalHeight}\" viewBox=\"0 0 ${totalWidth} ${totalHeight}\">${defsStr}${svg}</svg>`;\n}\n\n/**\n * Generate preview SVG for the modal (fixed width).\n */\nexport function renderSequencePreviewSVG(diagram) {\n return renderSequenceSVG(diagram, { width: 620 });\n}\n\n/**\n * Parse raw mermaid source and render sequence SVG.\n * Returns SVG string or empty string if not a sequence diagram.\n */\nexport function parseAndRenderSequence(src) {\n const diagram = parseSequenceDiagram(src);\n if (!diagram) return '';\n return renderSequenceSVG(diagram);\n}\n\n/**\n * Render a sequence diagram onto the canvas as a real engine `Frame`\n * containing independent shapes \u2014 top + bottom participant boxes,\n * dashed lifelines, and a real Arrow (or Line for `--x`/`-x`) per\n * message. Each child is fully independent for click / drag / resize;\n * the Frame's `_diagramType` marker makes Frame.destroy() pull the\n * children along on delete, so the diagram still behaves as one\n * logical unit when discarded.\n *\n * Issue #34 bug #3 (follow-up to #24 per-actor split): drops the shared\n * `groupId` glue so clicking one shape selects only that shape.\n *\n * Notes and block frames are ordinary labelled rectangles. Self messages\n * use three line segments plus an arrow, keeping every visible component\n * editable with the same primitives users draw manually.\n */\nexport function renderSequenceOnCanvas(diagram) {\n if (!diagram || diagram.type !== 'sequenceDiagram') return false;\n if (!window.svg || !window.Rectangle || !window.Line || !window.Arrow) {\n console.error('[SequenceRenderer] Engine not initialized (Rectangle / Line / Arrow missing)');\n return false;\n }\n\n const participants = diagram.participants || [];\n const messages = diagram.messages || [];\n const notes = diagram.notes || [];\n const blocks = diagram.blocks || [];\n if (participants.length === 0) return false;\n\n // Mirror the layout math from renderSequenceSVG so the canvas layout\n // matches the modal preview.\n const pCount = participants.length;\n const contentWidth = (pCount - 1) * PARTICIPANT_GAP + PARTICIPANT_W;\n const totalWidth = Math.max(contentWidth + SIDE_MARGIN * 2, 400);\n const startX = (totalWidth - contentWidth) / 2;\n const pCenters = participants.map((_, i) => startX + i * PARTICIPANT_GAP + PARTICIPANT_W / 2);\n\n const topBoxBottom = TOP_MARGIN + PARTICIPANT_H;\n const noteAtMsg = new Map();\n notes.forEach((note) => {\n const lines = wrapText(note.text, 11, NOTE_MAX_W - NOTE_PAD * 2);\n const height = lines.length * 15 + NOTE_PAD * 2;\n if (!noteAtMsg.has(note.atMessage)) noteAtMsg.set(note.atMessage, []);\n noteAtMsg.get(note.atMessage).push({ ...note, lines, height });\n });\n const msgYPositions = [];\n let currentY = topBoxBottom + 30;\n for (let mi = 0; mi < messages.length; mi++) {\n const before = noteAtMsg.get(mi);\n if (before?.length) currentY += Math.max(...before.map(note => note.height)) + 10;\n msgYPositions.push(currentY);\n currentY += MSG_ROW_HEIGHT;\n }\n const trailingNotes = noteAtMsg.get(messages.length);\n if (trailingNotes?.length) currentY += Math.max(...trailingNotes.map(note => note.height)) + 10;\n const bottomBoxTop = currentY + 20;\n const totalHeight = bottomBoxTop + PARTICIPANT_H + BOTTOM_MARGIN;\n\n // Centre the diagram on the current viewport so the user sees it\n // right where they invoked the renderer.\n const vb = window.currentViewBox || { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight };\n const ox = vb.x + vb.width / 2 - totalWidth / 2;\n const oy = vb.y + vb.height / 2 - totalHeight / 2;\n\n // \u2500\u2500 Wrapper frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Issue #34 bug #3: drop the shared groupId glue. Each child is\n // independent for click / drag / resize. The Frame's `_diagramType`\n // marker makes Frame.destroy() pull the children along on delete,\n // so the diagram still behaves as one logical unit when discarded.\n if (!window.Frame) {\n console.error('[SequenceRenderer] window.Frame missing \u2014 cannot wrap diagram');\n return false;\n }\n // Padding bumped 24 \u2192 60 so participant labels + message text near\n // the frame's edges stay inside on the new wider light canvas.\n const PADDING = 60;\n const TK = themeColors();\n const frameTitle = diagram.title || 'Sequence diagram';\n const frame = new window.Frame(\n ox - PADDING,\n oy - PADDING,\n totalWidth + PADDING * 2,\n totalHeight + PADDING * 2,\n {\n stroke: TK.blockBorder,\n strokeWidth: 1,\n fill: 'transparent',\n opacity: 0.7,\n frameName: frameTitle,\n }\n );\n frame._diagramType = 'mermaid-sequence';\n window.shapes.push(frame);\n if (window.pushCreateAction) window.pushCreateAction(frame);\n\n const created = [];\n\n // \u2500\u2500 Participants: top box + lifeline (and bottom box) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const pIndex = new Map();\n for (let pi = 0; pi < pCount; pi++) {\n const p = participants[pi];\n pIndex.set(p.name, pi);\n const cx = pCenters[pi] + ox;\n const bx = cx - PARTICIPANT_W / 2;\n\n try {\n // Top participant box\n const topBox = new window.Rectangle(bx, TOP_MARGIN + oy, PARTICIPANT_W, PARTICIPANT_H, {\n stroke: TK.participantBorder,\n strokeWidth: 1.5,\n fill: TK.participantBg,\n fillStyle: 'solid',\n roughness: 1,\n label: p.name,\n labelColor: TK.participantText,\n });\n window.shapes.push(topBox);\n if (window.pushCreateAction) window.pushCreateAction(topBox);\n frame.addShapeToFrame(topBox);\n created.push(topBox);\n\n // Lifeline (dashed vertical line spanning the diagram height)\n const lifeline = new window.Line(\n { x: cx, y: topBoxBottom + oy },\n { x: cx, y: bottomBoxTop + oy },\n {\n stroke: TK.lifeline,\n strokeWidth: 1,\n strokeDasharray: '6 4',\n roughness: 0,\n }\n );\n window.shapes.push(lifeline);\n if (window.pushCreateAction) window.pushCreateAction(lifeline);\n frame.addShapeToFrame(lifeline);\n created.push(lifeline);\n\n // Bottom participant box (mirrors top \u2014 Mermaid convention)\n const bottomBox = new window.Rectangle(bx, bottomBoxTop + oy, PARTICIPANT_W, PARTICIPANT_H, {\n stroke: TK.participantBorder,\n strokeWidth: 1.5,\n fill: TK.participantBg,\n fillStyle: 'solid',\n roughness: 1,\n label: p.name,\n labelColor: TK.participantText,\n });\n window.shapes.push(bottomBox);\n if (window.pushCreateAction) window.pushCreateAction(bottomBox);\n frame.addShapeToFrame(bottomBox);\n created.push(bottomBox);\n } catch (err) {\n console.warn('[SequenceRenderer] Participant creation failed:', p.name, err);\n }\n }\n\n // \u2500\u2500 Blocks: editable containers behind message rows \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n for (const block of blocks) {\n const startY = block.startMsg < msgYPositions.length ? msgYPositions[block.startMsg] - 22 : topBoxBottom + 15;\n const endY = block.endMsg < msgYPositions.length ? msgYPositions[block.endMsg] - 8 : currentY;\n try {\n const blockShape = new window.Rectangle(\n startX - 18 + ox,\n startY + oy,\n contentWidth + 36,\n Math.max(36, endY - startY),\n {\n stroke: TK.blockBorder,\n strokeWidth: 1,\n strokeDasharray: '5 3',\n fill: 'transparent',\n fillStyle: 'none',\n roughness: .5,\n label: [block.type, block.label].filter(Boolean).join(': '),\n labelColor: TK.blockLabel,\n labelFontSize: 10,\n }\n );\n window.shapes.push(blockShape);\n if (window.pushCreateAction) window.pushCreateAction(blockShape);\n frame.addShapeToFrame(blockShape);\n created.push(blockShape);\n } catch (err) {\n console.warn('[SequenceRenderer] Block creation failed:', block, err);\n }\n }\n\n // \u2500\u2500 Messages: arrow (or line for --x style) per row \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n for (let mi = 0; mi < messages.length; mi++) {\n const m = messages[mi];\n const fromI = pIndex.get(m.from);\n const toI = pIndex.get(m.to);\n if (fromI == null || toI == null) continue;\n\n const fromCx = pCenters[fromI] + ox;\n const toCx = pCenters[toI] + ox;\n const y = msgYPositions[mi] + oy;\n\n const labelText = m.number ? `${m.number}. ${m.text}` : m.text;\n\n // Solid vs dashed (sync vs async response). `cross` style (-x)\n // would render as a line with an X at the head \u2014 fall back to a\n // line for that, arrow otherwise.\n const isCross = !!m.cross && m.arrowHead === 'cross';\n const opts = {\n stroke: TK.messageLine,\n strokeWidth: 1.5,\n roughness: 0,\n strokeDasharray: m.solid ? '' : '6 4',\n label: labelText || '',\n labelColor: TK.messageText,\n };\n\n try {\n const sp = { x: fromCx, y };\n const ep = { x: toCx, y };\n if (fromI === toI) {\n const loopWidth = 46;\n const loopHeight = 28;\n const a = { x: fromCx, y };\n const b = { x: fromCx + loopWidth, y };\n const c = { x: fromCx + loopWidth, y: y + loopHeight };\n const d = { x: fromCx + 5, y: y + loopHeight };\n const segments = [\n new window.Line(a, b, opts),\n new window.Line(b, c, opts),\n new window.Arrow(c, d, opts),\n ];\n segments.forEach((segment) => {\n window.shapes.push(segment);\n if (window.pushCreateAction) window.pushCreateAction(segment);\n frame.addShapeToFrame(segment);\n created.push(segment);\n });\n continue;\n }\n const connector = isCross\n ? new window.Line(sp, ep, opts)\n : new window.Arrow(sp, ep, opts);\n window.shapes.push(connector);\n if (window.pushCreateAction) window.pushCreateAction(connector);\n frame.addShapeToFrame(connector);\n created.push(connector);\n } catch (err) {\n console.warn('[SequenceRenderer] Message creation failed:', m, err);\n }\n }\n\n\n // \u2500\u2500 Notes: one independently editable rectangle per note \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n for (const [messageIndex, noteGroup] of noteAtMsg.entries()) {\n const baseY = messageIndex < msgYPositions.length\n ? msgYPositions[messageIndex] - 15\n : (messageIndex > 0 ? msgYPositions[messageIndex - 1] + MSG_ROW_HEIGHT - 15 : topBoxBottom + 30);\n noteGroup.forEach((note, noteIndex) => {\n const indexes = note.targets.map(target => pIndex.get(target)).filter(index => index !== undefined);\n if (!indexes.length) return;\n const noteWidth = NOTE_MAX_W;\n let centerX = pCenters[indexes[0]];\n if (note.position === 'over' && indexes.length > 1) {\n centerX = (pCenters[Math.min(...indexes)] + pCenters[Math.max(...indexes)]) / 2;\n } else if (note.position === 'left of') {\n centerX -= PARTICIPANT_W / 2 + noteWidth / 2 + 8;\n } else if (note.position === 'right of') {\n centerX += PARTICIPANT_W / 2 + noteWidth / 2 + 8;\n }\n try {\n const noteShape = new window.Rectangle(\n centerX - noteWidth / 2 + ox,\n baseY - note.height - noteIndex * (note.height + 6) + oy,\n noteWidth,\n note.height,\n {\n stroke: TK.noteBorder,\n strokeWidth: 1,\n fill: TK.noteBg,\n fillStyle: 'solid',\n roughness: .7,\n label: note.text,\n labelColor: TK.noteText,\n labelFontSize: 11,\n }\n );\n window.shapes.push(noteShape);\n if (window.pushCreateAction) window.pushCreateAction(noteShape);\n frame.addShapeToFrame(noteShape);\n created.push(noteShape);\n } catch (err) {\n console.warn('[SequenceRenderer] Note creation failed:', note, err);\n }\n });\n }\n\n // Auto-select the first node so the user has feedback that the\n // diagram landed. Selecting a child (not the frame) reinforces the\n // \"independent shapes inside a frame\" model from issue #34 bug #3.\n const first = created[0];\n if (first) {\n window.currentShape = first;\n if (typeof first.selectShape === 'function') first.selectShape();\n }\n\n console.log(`[SequenceRenderer] Done: ${pCount} participants, ${messages.length} messages`);\n return true;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAgBA,IAAM,gBAAgB;AACtB,IAAM,gBAAgB;AACtB,IAAM,kBAAkB;AACxB,IAAM,iBAAiB;AACvB,IAAM,WAAW;AACjB,IAAM,aAAa;AACnB,IAAM,aAAa;AACnB,IAAM,gBAAgB;AACtB,IAAM,cAAc;AACpB,IAAM,cAAc;AAQpB,SAAS,cAAc;AACnB,QAAM,UAAU,MAAM;AAClB,QAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,QAAI,SAAS,MAAM;AACf,UAAI,SAAS,KAAK,UAAU,SAAS,YAAY,EAAG,QAAO;AAC3D,UAAI,SAAS,KAAK,UAAU,SAAS,aAAa,EAAG,QAAO;AAAA,IAChE;AACA,WAAO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A,MACnD,WAAW,KAAK,aAAa,YAAY;AACrC,mBAAW,gBAAgB,IAAI,YAAY,IAAI;AAAA,MACnD;AACA,UAAI;AACA,cAAM,YAAY,IAAI,OAAO;AAAA,UACzB,UAAU,YAAY,IAAI;AAAA,UAC1B,QAAQ,KAAK,SAAS,aAAa,KAAK,SAAS,KAAK;AAAA,UACtD;AAAA,UACA,KAAK;AAAA,UACL;AAAA,YACI,QAAQ,GAAG;AAAA,YACX,aAAa;AAAA,YACb,MAAM,GAAG;AAAA,YACT,WAAW;AAAA,YACX,WAAW;AAAA,YACX,OAAO,KAAK;AAAA,YACZ,YAAY,GAAG;AAAA,YACf,eAAe;AAAA,UACnB;AAAA,QACJ;AACA,eAAO,OAAO,KAAK,SAAS;AAC5B,YAAI,OAAO,iBAAkB,QAAO,iBAAiB,SAAS;AAC9D,cAAM,gBAAgB,SAAS;AAC/B,gBAAQ,KAAK,SAAS;AAAA,MAC1B,SAAS,KAAK;AACV,gBAAQ,KAAK,4CAA4C,MAAM,GAAG;AAAA,MACtE;AAAA,IACJ,CAAC;AAAA,EACL;AAKA,QAAM,QAAQ,QAAQ,CAAC;AACvB,MAAI,OAAO;AACP,WAAO,eAAe;AACtB,QAAI,OAAO,MAAM,gBAAgB,WAAY,OAAM,YAAY;AAAA,EACnE;AAEA,UAAQ,IAAI,4BAA4B,MAAM,kBAAkB,SAAS,MAAM,WAAW;AAC1F,SAAO;AACX;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/react/{MermaidStructuredRenderer-W7UKN7BM.js → MermaidStructuredRenderer-6LN3WISP.js}
RENAMED
|
@@ -24,7 +24,12 @@ function contrastText(fill) {
|
|
|
24
24
|
return luminance > 145 ? "#34304a" : "#ffffff";
|
|
25
25
|
}
|
|
26
26
|
function isDark() {
|
|
27
|
-
|
|
27
|
+
if (typeof document === "undefined") return true;
|
|
28
|
+
if (document.body) {
|
|
29
|
+
if (document.body.classList.contains("theme-dark")) return true;
|
|
30
|
+
if (document.body.classList.contains("theme-light")) return false;
|
|
31
|
+
}
|
|
32
|
+
return !document.documentElement || document.documentElement.classList.contains("dark");
|
|
28
33
|
}
|
|
29
34
|
function theme() {
|
|
30
35
|
return isDark() ? { bg: "#20232a", text: "#f0eee8", line: "#aaa89f", frame: "#77766f", panel: "#292d34" } : { bg: "#fbfaf6", text: "#343832", line: "#6e746c", frame: "#b9b7ac", panel: "#f5f2ea" };
|
|
@@ -524,4 +529,4 @@ export {
|
|
|
524
529
|
renderEROnCanvas,
|
|
525
530
|
renderERPreviewSVG
|
|
526
531
|
};
|
|
527
|
-
//# sourceMappingURL=MermaidStructuredRenderer-
|
|
532
|
+
//# sourceMappingURL=MermaidStructuredRenderer-6LN3WISP.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/MermaidStructuredRenderer.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n/**\n * Native renderers for Mermaid ER and chart diagrams.\n *\n * Preview is SVG, while canvas placement deliberately creates ordinary\n * LixSketch shapes. That keeps entities, attributes, relationships, bars,\n * points, and legend items independently selectable and editable.\n */\n\nconst NS = 'http://www.w3.org/2000/svg';\nconst PALETTE = [\n { fill: '#8b7abb', stroke: '#665793' },\n { fill: '#a992cf', stroke: '#7762a6' },\n { fill: '#c2addc', stroke: '#8974aa' },\n { fill: '#7765a6', stroke: '#584883' },\n { fill: '#9d83c1', stroke: '#725b9a' },\n { fill: '#d1c3e7', stroke: '#927daf' },\n];\n\nfunction escapeXml(value) {\n return String(value ?? '')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\nfunction contrastText(fill) {\n const raw = String(fill || '').replace('#', '');\n const hex = raw.length === 3 ? raw.split('').map(char => char + char).join('') : raw;\n if (!/^[0-9a-f]{6}$/i.test(hex)) return theme().text;\n const red = parseInt(hex.slice(0, 2), 16);\n const green = parseInt(hex.slice(2, 4), 16);\n const blue = parseInt(hex.slice(4, 6), 16);\n const luminance = .299 * red + .587 * green + .114 * blue;\n return luminance > 145 ? '#34304a' : '#ffffff';\n}\n\nfunction isDark() {\n if (typeof document === 'undefined') return true;\n if (document.body) {\n if (document.body.classList.contains('theme-dark')) return true;\n if (document.body.classList.contains('theme-light')) return false;\n }\n return !document.documentElement || document.documentElement.classList.contains('dark');\n}\n\nfunction theme() {\n return isDark()\n ? { bg: '#20232a', text: '#f0eee8', line: '#aaa89f', frame: '#77766f', panel: '#292d34' }\n : { bg: '#fbfaf6', text: '#343832', line: '#6e746c', frame: '#b9b7ac', panel: '#f5f2ea' };\n}\n\nfunction sourceLines(src) {\n return src.split('\\n').map(line => line.trim()).filter(line => line && !line.startsWith('%%'));\n}\n\nexport function detectStructuredMermaid(src) {\n const header = sourceLines(src)[0]?.toLowerCase() || '';\n if (header === 'erdiagram') return 'er';\n if (/^pie(?:\\s|$)/.test(header) || /^xychart(?:-beta)?(?:\\s|$)/.test(header)) return 'chart';\n return null;\n}\n\n// ---------------------------------------------------------------------\n// Entity relationship diagrams\n// ---------------------------------------------------------------------\n\nexport function parseERDiagram(src) {\n const lines = sourceLines(src);\n if (lines[0]?.toLowerCase() !== 'erdiagram') return null;\n\n const entityMap = new Map();\n const relationships = [];\n let current = null;\n\n const ensureEntity = (name) => {\n if (!entityMap.has(name)) entityMap.set(name, { name, attributes: [] });\n return entityMap.get(name);\n };\n\n for (let index = 1; index < lines.length; index++) {\n const line = lines[index];\n const entityStart = line.match(/^([\\w-]+)\\s*\\{$/);\n if (entityStart) {\n current = ensureEntity(entityStart[1]);\n continue;\n }\n if (line === '}') {\n current = null;\n continue;\n }\n if (current) {\n const attribute = line.match(/^(\\S+)\\s+(\\S+)(?:\\s+(.+))?$/);\n if (attribute) {\n current.attributes.push({\n type: attribute[1],\n name: attribute[2],\n key: attribute[3] || '',\n });\n }\n continue;\n }\n\n // CUSTOMER ||--o{ ORDER : places\n const relation = line.match(/^([\\w-]+)\\s+([|o}{.]+)(?:--|\\.\\.)([|o}{.]+)\\s+([\\w-]+)\\s*:\\s*(.+)$/);\n if (relation) {\n ensureEntity(relation[1]);\n ensureEntity(relation[4]);\n relationships.push({\n from: relation[1],\n fromCardinality: relation[2],\n toCardinality: relation[3],\n to: relation[4],\n label: relation[5],\n });\n }\n }\n\n if (entityMap.size === 0) return null;\n return { type: 'erDiagram', title: 'Entity relationship diagram', entities: [...entityMap.values()], relationships };\n}\n\nfunction layoutER(diagram) {\n const width = 230;\n const headerHeight = 44;\n const rowHeight = 30;\n const columns = Math.max(1, Math.ceil(Math.sqrt(diagram.entities.length)));\n return diagram.entities.map((entity, index) => ({\n ...entity,\n x: 60 + (index % columns) * 330,\n y: 55 + Math.floor(index / columns) * 270,\n width,\n headerHeight,\n rowHeight,\n height: headerHeight + Math.max(1, entity.attributes.length) * rowHeight,\n color: PALETTE[index % PALETTE.length],\n }));\n}\n\nexport function renderERPreviewSVG(diagram) {\n if (!diagram?.entities?.length) return '';\n const TK = theme();\n const entities = layoutER(diagram);\n const byName = new Map(entities.map(entity => [entity.name, entity]));\n const maxX = Math.max(...entities.map(entity => entity.x + entity.width)) + 60;\n const maxY = Math.max(...entities.map(entity => entity.y + entity.height)) + 55;\n let content = `<rect width=\"${maxX}\" height=\"${maxY}\" rx=\"10\" fill=\"${TK.bg}\"/>`;\n content += `<defs><marker id=\"er-arrow\" markerWidth=\"9\" markerHeight=\"7\" refX=\"8\" refY=\"3.5\" orient=\"auto\"><path d=\"M1 1 L8 3.5 L1 6\" fill=\"none\" stroke=\"${TK.line}\" stroke-width=\"1.4\"/></marker></defs>`;\n\n for (const relation of diagram.relationships) {\n const from = byName.get(relation.from);\n const to = byName.get(relation.to);\n if (!from || !to) continue;\n const x1 = from.x + from.width / 2;\n const y1 = from.y + from.height / 2;\n const x2 = to.x + to.width / 2;\n const y2 = to.y + to.height / 2;\n const mx = (x1 + x2) / 2;\n const my = (y1 + y2) / 2;\n content += `<line x1=\"${x1}\" y1=\"${y1}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${TK.line}\" stroke-width=\"1.6\" marker-end=\"url(#er-arrow)\"/>`;\n content += `<text x=\"${mx}\" y=\"${my - 8}\" text-anchor=\"middle\" fill=\"${TK.text}\" font-size=\"12\" font-family=\"lixFont\">${escapeXml(`${relation.fromCardinality} ${relation.label} ${relation.toCardinality}`)}</text>`;\n }\n\n for (const entity of entities) {\n content += `<g><rect x=\"${entity.x}\" y=\"${entity.y}\" width=\"${entity.width}\" height=\"${entity.height}\" rx=\"8\" fill=\"${TK.panel}\" stroke=\"${entity.color.stroke}\" stroke-width=\"1.5\"/>`;\n content += `<rect x=\"${entity.x}\" y=\"${entity.y}\" width=\"${entity.width}\" height=\"${entity.headerHeight}\" rx=\"8\" fill=\"${entity.color.fill}\" stroke=\"${entity.color.stroke}\" stroke-width=\"1.5\"/>`;\n content += `<text x=\"${entity.x + entity.width / 2}\" y=\"${entity.y + 27}\" text-anchor=\"middle\" fill=\"${contrastText(entity.color.fill)}\" font-size=\"14\" font-weight=\"600\" font-family=\"lixFont\">${escapeXml(entity.name)}</text>`;\n const attributes = entity.attributes.length ? entity.attributes : [{ type: '', name: 'No attributes', key: '' }];\n attributes.forEach((attribute, row) => {\n const y = entity.y + entity.headerHeight + row * entity.rowHeight;\n content += `<line x1=\"${entity.x}\" y1=\"${y}\" x2=\"${entity.x + entity.width}\" y2=\"${y}\" stroke=\"${TK.frame}\" stroke-width=\"0.8\"/>`;\n content += `<text x=\"${entity.x + 10}\" y=\"${y + 20}\" fill=\"${TK.text}\" font-size=\"11\" font-family=\"lixCode\">${escapeXml([attribute.type, attribute.name, attribute.key].filter(Boolean).join(' '))}</text>`;\n });\n content += '</g>';\n }\n return `<svg xmlns=\"${NS}\" width=\"600\" height=\"450\" viewBox=\"0 0 ${maxX} ${maxY}\">${content}</svg>`;\n}\n\n// ---------------------------------------------------------------------\n// Pie and XY charts\n// ---------------------------------------------------------------------\n\nfunction numberList(value) {\n return value.replace(/^\\[|\\]$/g, '').split(',').map(item => Number(item.trim())).filter(Number.isFinite);\n}\n\nexport function parseChartDiagram(src) {\n const lines = sourceLines(src);\n const header = lines[0]?.toLowerCase() || '';\n if (/^pie(?:\\s|$)/.test(header)) {\n let title = lines[0].replace(/^pie(?:\\s+showData)?\\s*/i, '').replace(/^title\\s+/i, '').trim() || 'Pie chart';\n const values = [];\n for (let index = 1; index < lines.length; index++) {\n const titleMatch = lines[index].match(/^title\\s+(.+)$/i);\n if (titleMatch) { title = titleMatch[1]; continue; }\n const item = lines[index].match(/^\"?(.+?)\"?\\s*:\\s*(-?\\d+(?:\\.\\d+)?)$/);\n if (item) values.push({ label: item[1], value: Number(item[2]) });\n }\n return values.length ? { type: 'chart', kind: 'pie', title, categories: values.map(v => v.label), series: [{ name: title, values: values.map(v => v.value) }] } : null;\n }\n if (!/^xychart(?:-beta)?(?:\\s|$)/.test(header)) return null;\n let title = 'Chart';\n let categories = [];\n const series = [];\n for (let index = 1; index < lines.length; index++) {\n const titleMatch = lines[index].match(/^title\\s+\"?(.+?)\"?$/i);\n const axisMatch = lines[index].match(/^x-axis(?:\\s+\".*?\")?\\s+(\\[.+\\])/i);\n const seriesMatch = lines[index].match(/^(bar|line)(?:\\s+\"?([^\"\\[]+)\"?)?\\s+(\\[.+\\])$/i);\n if (titleMatch) title = titleMatch[1];\n else if (axisMatch) categories = axisMatch[1].replace(/^\\[|\\]$/g, '').split(',').map(v => v.trim().replace(/^\"|\"$/g, ''));\n else if (seriesMatch) series.push({ kind: seriesMatch[1].toLowerCase(), name: seriesMatch[2]?.trim() || seriesMatch[1], values: numberList(seriesMatch[3]) });\n }\n const maxItems = Math.max(0, ...series.map(item => item.values.length));\n if (!categories.length) categories = Array.from({ length: maxItems }, (_, index) => String(index + 1));\n return series.length ? { type: 'chart', kind: 'xy', title, categories, series } : null;\n}\n\n// Mermaid permits bar and line declarations in one xychart. LixSketch keeps a\n// bar chart visually bar-only: when at least one bar series exists, line\n// series (and their point markers) are omitted consistently from preview and\n// canvas placement. A chart made only from line declarations remains a line\n// chart.\nfunction renderedSeries(chart) {\n if (chart?.kind !== 'xy') return chart?.series || [];\n const bars = chart.series.filter(series => series.kind === 'bar');\n return bars.length ? bars : chart.series.filter(series => series.kind === 'line');\n}\n\nexport function renderChartPreviewSVG(chart) {\n if (!chart?.series?.length) return '';\n const TK = theme();\n const width = 720;\n const height = 450;\n\n if (chart.kind === 'pie') {\n const values = chart.series[0].values.map(value => Math.max(0, value));\n const total = values.reduce((sum, value) => sum + value, 0);\n if (total <= 0) return '';\n const cx = 255;\n const cy = 235;\n const radius = 145;\n let startAngle = -Math.PI / 2;\n let content = `<rect width=\"${width}\" height=\"${height}\" rx=\"10\" fill=\"${TK.bg}\"/><text x=\"${width / 2}\" y=\"32\" text-anchor=\"middle\" fill=\"${TK.text}\" font-size=\"18\" font-family=\"lixFont\">${escapeXml(chart.title)}</text>`;\n\n values.forEach((value, index) => {\n const endAngle = startAngle + value / total * Math.PI * 2;\n const x1 = cx + Math.cos(startAngle) * radius;\n const y1 = cy + Math.sin(startAngle) * radius;\n const x2 = cx + Math.cos(endAngle) * radius;\n const y2 = cy + Math.sin(endAngle) * radius;\n const largeArc = endAngle - startAngle > Math.PI ? 1 : 0;\n const color = PALETTE[index % PALETTE.length];\n content += `<path d=\"M ${cx} ${cy} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} Z\" fill=\"${color.fill}\" stroke=\"${TK.bg}\" stroke-width=\"3\"/>`;\n const percent = Math.round(value / total * 100);\n const legendY = 125 + index * 42;\n content += `<rect x=\"460\" y=\"${legendY - 14}\" width=\"18\" height=\"18\" rx=\"4\" fill=\"${color.fill}\" stroke=\"${color.stroke}\"/><text x=\"488\" y=\"${legendY}\" fill=\"${TK.text}\" font-size=\"12\" font-family=\"lixFont\">${escapeXml(chart.categories[index] || index + 1)} \u2014 ${value} (${percent}%)</text>`;\n startAngle = endAngle;\n });\n return `<svg xmlns=\"${NS}\" width=\"600\" height=\"450\" viewBox=\"0 0 ${width} ${height}\">${content}</svg>`;\n }\n\n const left = 70;\n const top = 60;\n const plotWidth = 580;\n const plotHeight = 300;\n const seriesToRender = renderedSeries(chart);\n const values = seriesToRender.flatMap(series => series.values);\n const maximum = Math.max(1, ...values.map(Math.abs));\n const categoryCount = Math.max(1, chart.categories.length);\n const slot = plotWidth / categoryCount;\n let content = `<rect width=\"${width}\" height=\"${height}\" rx=\"10\" fill=\"${TK.bg}\"/><text x=\"${width / 2}\" y=\"32\" text-anchor=\"middle\" fill=\"${TK.text}\" font-size=\"18\" font-family=\"lixFont\">${escapeXml(chart.title)}</text>`;\n content += `<line x1=\"${left}\" y1=\"${top}\" x2=\"${left}\" y2=\"${top + plotHeight}\" stroke=\"${TK.line}\"/><line x1=\"${left}\" y1=\"${top + plotHeight}\" x2=\"${left + plotWidth}\" y2=\"${top + plotHeight}\" stroke=\"${TK.line}\"/>`;\n\n chart.categories.forEach((category, index) => {\n content += `<text x=\"${left + slot * (index + .5)}\" y=\"${top + plotHeight + 24}\" text-anchor=\"middle\" fill=\"${TK.text}\" font-size=\"11\" font-family=\"lixFont\">${escapeXml(category)}</text>`;\n });\n\n seriesToRender.forEach((series, seriesIndex) => {\n const color = PALETTE[seriesIndex % PALETTE.length];\n if (series.kind === 'line') {\n const points = series.values.map((value, index) => `${left + slot * (index + .5)},${top + plotHeight - Math.abs(value) / maximum * plotHeight}`).join(' ');\n content += `<polyline points=\"${points}\" fill=\"none\" stroke=\"${color.stroke}\" stroke-width=\"3\"/>`;\n series.values.forEach((value, index) => content += `<circle cx=\"${left + slot * (index + .5)}\" cy=\"${top + plotHeight - Math.abs(value) / maximum * plotHeight}\" r=\"5\" fill=\"${color.fill}\" stroke=\"${color.stroke}\" stroke-width=\"2\"/>`);\n } else {\n const barWidth = Math.max(12, slot * .7 / seriesToRender.length);\n series.values.forEach((value, index) => {\n const barHeight = Math.abs(value) / maximum * plotHeight;\n const x = left + slot * index + slot * .15 + seriesIndex * barWidth;\n content += `<rect x=\"${x}\" y=\"${top + plotHeight - barHeight}\" width=\"${barWidth}\" height=\"${barHeight}\" rx=\"4\" fill=\"${color.fill}\" stroke=\"${color.stroke}\" stroke-width=\"1.5\"/><text x=\"${x + barWidth / 2}\" y=\"${top + plotHeight - barHeight - 7}\" text-anchor=\"middle\" fill=\"${TK.text}\" font-size=\"10\" font-family=\"lixFont\">${value}</text>`;\n });\n }\n });\n return `<svg xmlns=\"${NS}\" width=\"600\" height=\"450\" viewBox=\"0 0 ${width} ${height}\">${content}</svg>`;\n}\n\n// ---------------------------------------------------------------------\n// Native canvas placement helpers\n// ---------------------------------------------------------------------\n\nfunction push(shape, frame) {\n if (!shape) return null;\n window.shapes.push(shape);\n if (window.pushCreateAction) window.pushCreateAction(shape);\n if (frame?.addShapeToFrame) frame.addShapeToFrame(shape);\n return shape;\n}\n\nfunction pushText(text, x, y, fontSize, fill, frame, textAnchor = 'start') {\n if (!window.TextShape || !window.svg) return null;\n const group = document.createElementNS(NS, 'g');\n group.setAttribute('data-type', 'text-group');\n group.setAttribute('transform', `translate(${x}, ${y})`);\n group.setAttribute('data-x', x);\n group.setAttribute('data-y', y);\n\n const element = document.createElementNS(NS, 'text');\n element.setAttribute('x', 0);\n element.setAttribute('y', 0);\n element.setAttribute('dominant-baseline', 'central');\n element.setAttribute('text-anchor', textAnchor);\n element.setAttribute('fill', fill);\n element.setAttribute('font-size', fontSize);\n element.setAttribute('font-family', 'lixFont, sans-serif');\n element.setAttribute('data-initial-font', 'lixFont');\n element.setAttribute('data-initial-color', fill);\n element.setAttribute('data-initial-size', `${fontSize}px`);\n element.textContent = text;\n group.appendChild(element);\n window.svg.appendChild(group);\n return push(new window.TextShape(group), frame);\n}\n\nfunction canvasOrigin(width, height) {\n const vb = window.currentViewBox || { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight };\n return { x: vb.x + vb.width / 2 - width / 2, y: vb.y + vb.height / 2 - height / 2 };\n}\n\nfunction createFrame(x, y, width, height, name, type) {\n const TK = theme();\n const frame = new window.Frame(x - 45, y - 45, width + 90, height + 90, {\n stroke: TK.frame, strokeWidth: 1, fill: 'transparent', opacity: .75,\n frameName: name, labelColor: TK.text,\n });\n frame._diagramType = type;\n push(frame);\n return frame;\n}\n\nfunction selectOnlyFrame(frame) {\n if (!frame) return;\n if (window.multiSelection?.clearSelection) window.multiSelection.clearSelection();\n if (window.currentShape && window.currentShape !== frame && typeof window.currentShape.removeSelection === 'function') {\n window.currentShape.removeSelection();\n }\n if (window.__deselectTextElement) window.__deselectTextElement();\n window.currentShape = frame;\n if (typeof frame.selectFrame === 'function') frame.selectFrame();\n}\n\nexport function renderEROnCanvas(diagram) {\n if (!diagram?.entities?.length || !window.Rectangle || !window.Arrow || !window.Frame) return false;\n const TK = theme();\n const entities = layoutER(diagram);\n const width = Math.max(...entities.map(entity => entity.x + entity.width)) + 40;\n const height = Math.max(...entities.map(entity => entity.y + entity.height)) + 40;\n const origin = canvasOrigin(width, height);\n const frame = createFrame(origin.x, origin.y, width, height, diagram.title, 'mermaid-er');\n const entityShapes = new Map();\n let first = null;\n\n for (const entity of entities) {\n const x = origin.x + entity.x;\n const y = origin.y + entity.y;\n const header = push(new window.Rectangle(x, y, entity.width, entity.headerHeight, {\n stroke: entity.color.stroke, strokeWidth: 1.5, fill: entity.color.fill, fillStyle: 'solid', roughness: 0, fillWeight: 0.5,\n label: entity.name, labelColor: contrastText(entity.color.fill), labelFontSize: 15, labelBg: false,\n }), frame);\n if (!first) first = header;\n entityShapes.set(entity.name, { shape: header, x, y, width: entity.width, height: entity.headerHeight });\n const attributes = entity.attributes.length ? entity.attributes : [{ type: '', name: 'No attributes', key: '' }];\n attributes.forEach((attribute, row) => push(new window.Rectangle(\n x, y + entity.headerHeight + row * entity.rowHeight, entity.width, entity.rowHeight,\n { stroke: TK.frame, strokeWidth: 1, fill: TK.panel, fillStyle: 'solid', roughness: 0, fillWeight: 0.5,\n label: [attribute.type, attribute.name, attribute.key].filter(Boolean).join(' '), labelColor: TK.text, labelFontSize: 11, labelBg: false }\n ), frame));\n }\n\n for (const relation of diagram.relationships) {\n const from = entityShapes.get(relation.from);\n const to = entityShapes.get(relation.to);\n if (!from || !to) continue;\n const fromCenter = { x: from.x + from.width / 2, y: from.y + from.height / 2 };\n const toCenter = { x: to.x + to.width / 2, y: to.y + to.height / 2 };\n // Anchor the arrow at the actual box boundary (not the box center) so\n // it terminates at the entity edge instead of drawing through \u2014 and\n // over \u2014 the header label, and so autoAttach's nearest-side check\n // (which compares against this point) resolves to the side actually\n // facing the other entity rather than whichever side happens to be\n // closest to the geometric center on a short, wide header box.\n const start = rectBoundaryPoint(from, toCenter);\n const end = rectBoundaryPoint(to, fromCenter);\n const arrow = push(new window.Arrow(start, end, {\n stroke: TK.line, strokeWidth: 1.5, roughness: 0,\n label: `${relation.fromCardinality} ${relation.label} ${relation.toCardinality}`,\n labelColor: TK.text, labelBg: false, labelOffsetY: -12,\n }), frame);\n if (arrow && window.__autoAttach) {\n window.__autoAttach(arrow, from.shape, true, start);\n window.__autoAttach(arrow, to.shape, false, end);\n }\n }\n if (first?.selectShape) { window.currentShape = first; first.selectShape(); }\n return true;\n}\n\n// Intersection of the line from `box`'s center toward `target` with box's\n// own rectangular boundary. Used to anchor ER relationship arrows exactly\n// at the entity edge instead of the entity center.\nfunction rectBoundaryPoint(box, target) {\n const cx = box.x + box.width / 2;\n const cy = box.y + box.height / 2;\n const dx = target.x - cx;\n const dy = target.y - cy;\n const hw = box.width / 2;\n const hh = box.height / 2;\n if (dx === 0 && dy === 0) return { x: cx, y: cy };\n const scale = 1 / Math.max(Math.abs(dx) / hw, Math.abs(dy) / hh);\n return { x: cx + dx * scale, y: cy + dy * scale };\n}\n\nexport function renderChartOnCanvas(chart) {\n if (!chart?.series?.length || !window.Rectangle || !window.Circle || !window.Line || !window.FreehandStroke || !window.Frame) return false;\n if (chart.kind === 'pie') return renderPieOnCanvas(chart);\n const TK = theme();\n const width = 720;\n const height = 450;\n const origin = canvasOrigin(width, height);\n const frame = createFrame(origin.x, origin.y, width, height, chart.title, 'mermaid-chart');\n const left = origin.x + 70;\n const top = origin.y + 65;\n const plotWidth = 580;\n const plotHeight = 300;\n const seriesToRender = renderedSeries(chart);\n const values = seriesToRender.flatMap(series => series.values);\n const maximum = Math.max(1, ...values.map(Math.abs));\n const slot = plotWidth / Math.max(1, chart.categories.length);\n push(new window.Line({ x: left, y: top }, { x: left, y: top + plotHeight }, { stroke: TK.line, strokeWidth: 1.5, roughness: 0 }), frame);\n push(new window.Line({ x: left, y: top + plotHeight }, { x: left + plotWidth, y: top + plotHeight }, { stroke: TK.line, strokeWidth: 1.5, roughness: 0 }), frame);\n\n // Match the preview layout: categories live below the axis and values sit\n // above bars. Embedding both strings in the rectangle used to add an\n // opaque canvas-coloured label pill through the middle of every bar,\n // visually splitting it and changing the perceived series colour.\n chart.categories.forEach((category, index) => pushText(\n category,\n left + slot * (index + .5),\n top + plotHeight + 24,\n 11,\n TK.text,\n frame,\n 'middle',\n ));\n\n seriesToRender.forEach((series, seriesIndex) => {\n const color = PALETTE[seriesIndex % PALETTE.length];\n if (series.kind === 'line') {\n const linePoints = series.values.map((value, index) => {\n const point = { x: left + slot * (index + .5), y: top + plotHeight - Math.abs(value) / maximum * plotHeight };\n push(new window.Circle(point.x, point.y, 8, 8, {\n stroke: color.stroke, strokeWidth: 2, fill: color.fill,\n fillStyle: 'solid', roughness: 0, disableMultiStroke: true,\n }), frame);\n return [point.x, point.y, .5];\n });\n if (linePoints.length > 1) {\n push(new window.FreehandStroke(linePoints, {\n stroke: color.stroke,\n strokeWidth: 3,\n thinning: 0,\n roughness: 0,\n strokeStyle: 'solid',\n }), frame);\n }\n } else {\n const barWidth = Math.max(18, slot * .7 / seriesToRender.length);\n series.values.forEach((value, index) => {\n const barHeight = Math.max(8, Math.abs(value) / maximum * plotHeight);\n const x = left + slot * index + slot * .15 + seriesIndex * barWidth;\n push(new window.Rectangle(x, top + plotHeight - barHeight, barWidth, barHeight, {\n stroke: color.stroke, strokeWidth: 1.5, fill: color.fill,\n fillStyle: 'solid', roughness: 0, disableMultiStroke: true,\n disableMultiStrokeFill: true, preserveVertices: true,\n }), frame);\n pushText(String(value), x + barWidth / 2, top + plotHeight - barHeight - 7, 10, TK.text, frame, 'middle');\n });\n }\n });\n selectOnlyFrame(frame);\n return true;\n}\n\nfunction renderPieOnCanvas(chart) {\n if (!window.FreehandStroke || !window.TextShape) return false;\n const width = 720;\n const height = 450;\n const origin = canvasOrigin(width, height);\n const frame = createFrame(origin.x, origin.y, width, height, chart.title, 'mermaid-pie');\n const values = chart.series[0].values.map(value => Math.max(0, value));\n const total = values.reduce((sum, value) => sum + value, 0);\n if (total <= 0) return false;\n\n const cx = origin.x + 255;\n const cy = origin.y + 235;\n const radius = 145;\n let startAngle = -Math.PI / 2;\n\n values.forEach((value, index) => {\n const sweep = value / total * Math.PI * 2;\n const endAngle = startAngle + sweep;\n const steps = Math.max(6, Math.ceil(sweep / (Math.PI / 60)));\n const points = [[cx, cy, .5]];\n for (let step = 0; step <= steps; step++) {\n const angle = startAngle + sweep * (step / steps);\n points.push([\n cx + Math.cos(angle) * radius,\n cy + Math.sin(angle) * radius,\n .5,\n ]);\n }\n const color = PALETTE[index % PALETTE.length];\n push(new window.FreehandStroke(points, {\n stroke: color.fill,\n strokeWidth: 3,\n outlineStroke: theme().bg,\n outlineWidth: 3,\n closedFill: true,\n roughness: 0,\n strokeStyle: 'solid',\n }), frame);\n const percent = Math.round(value / total * 100);\n const legendY = origin.y + 125 + index * 42;\n push(new window.Rectangle(origin.x + 460, legendY - 14, 18, 18, {\n stroke: color.stroke,\n strokeWidth: 1,\n fill: color.fill,\n fillStyle: 'solid',\n roughness: .5,\n }), frame);\n pushText(\n `${chart.categories[index] || index + 1} \u2014 ${value} (${percent}%)`,\n origin.x + 488,\n legendY,\n 12,\n theme().text,\n frame,\n );\n startAngle = endAngle;\n });\n\n selectOnlyFrame(frame);\n return true;\n}\n"],
|
|
5
|
+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