@elixpo/lixsketch 5.4.7 → 5.5.1
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/react/AIRenderer-M4LMJ66J.js +1105 -0
- package/dist/react/AIRenderer-M4LMJ66J.js.map +7 -0
- package/dist/react/Arrow-BJDAXPMH.js +8 -0
- package/dist/react/Arrow-BJDAXPMH.js.map +7 -0
- package/dist/react/Circle-KPG7TKIX.js +8 -0
- package/dist/react/Circle-KPG7TKIX.js.map +7 -0
- package/dist/react/CodeShape-K4DIZAIV.js +8 -0
- package/dist/react/CodeShape-K4DIZAIV.js.map +7 -0
- package/dist/react/CopyPaste-4CKJRHJ3.js +569 -0
- package/dist/react/CopyPaste-4CKJRHJ3.js.map +7 -0
- package/dist/react/EraserTrail-PA6IQLQN.js +20 -0
- package/dist/react/EraserTrail-PA6IQLQN.js.map +7 -0
- package/dist/react/EventDispatcher-SRFH6LQZ.js +463 -0
- package/dist/react/EventDispatcher-SRFH6LQZ.js.map +7 -0
- package/dist/react/Frame-6UR5XPAX.js +10 -0
- package/dist/react/Frame-6UR5XPAX.js.map +7 -0
- package/dist/react/FreehandStroke-CK24NUT3.js +8 -0
- package/dist/react/FreehandStroke-CK24NUT3.js.map +7 -0
- package/dist/react/GraphEngine-QE5B2PMR.js +340 -0
- package/dist/react/GraphEngine-QE5B2PMR.js.map +7 -0
- package/dist/react/GraphMathParser-2WMTY4IE.js +10 -0
- package/dist/react/GraphMathParser-2WMTY4IE.js.map +7 -0
- package/dist/react/IconShape-KMIA6T2H.js +10 -0
- package/dist/react/IconShape-KMIA6T2H.js.map +7 -0
- package/dist/react/ImageShape-CHHGBXUQ.js +10 -0
- package/dist/react/ImageShape-CHHGBXUQ.js.map +7 -0
- package/dist/react/LayerOrder-XCHF4MSS.js +66 -0
- package/dist/react/LayerOrder-XCHF4MSS.js.map +7 -0
- package/dist/react/Line-2KOQEEGA.js +10 -0
- package/dist/react/Line-2KOQEEGA.js.map +7 -0
- package/dist/react/LixScriptParser-JYWJX375.js +1033 -0
- package/dist/react/LixScriptParser-JYWJX375.js.map +7 -0
- package/dist/react/MermaidFlowchartRenderer-4QBAZ5MB.js +412 -0
- package/dist/react/MermaidFlowchartRenderer-4QBAZ5MB.js.map +7 -0
- package/dist/react/MermaidSequenceParser-UKG2NSZY.js +8 -0
- package/dist/react/MermaidSequenceParser-UKG2NSZY.js.map +7 -0
- package/dist/react/MermaidSequenceRenderer-HPLHY5II.js +387 -0
- package/dist/react/MermaidSequenceRenderer-HPLHY5II.js.map +7 -0
- package/dist/react/Rectangle-6FE7RN6W.js +8 -0
- package/dist/react/Rectangle-6FE7RN6W.js.map +7 -0
- package/dist/react/ResizeCode-WAMDTKSW.js +2 -0
- package/dist/react/ResizeCode-WAMDTKSW.js.map +7 -0
- package/dist/react/ResizeShapes-LKEQTITP.js +250 -0
- package/dist/react/ResizeShapes-LKEQTITP.js.map +7 -0
- package/dist/react/SceneSerializer-4U4B24JM.js +739 -0
- package/dist/react/SceneSerializer-4U4B24JM.js.map +7 -0
- package/dist/react/Selection-VVUHY5YJ.js +34 -0
- package/dist/react/Selection-VVUHY5YJ.js.map +7 -0
- package/dist/react/SketchEngine-YA4RG3KX.js +413 -0
- package/dist/react/SketchEngine-YA4RG3KX.js.map +7 -0
- package/dist/react/TextShape-54ZJ66E3.js +8 -0
- package/dist/react/TextShape-54ZJ66E3.js.map +7 -0
- package/dist/react/UndoRedo-M2JZUBKN.js +30 -0
- package/dist/react/UndoRedo-M2JZUBKN.js.map +7 -0
- package/dist/react/ZoomPan-U3TXC5AJ.js +186 -0
- package/dist/react/ZoomPan-U3TXC5AJ.js.map +7 -0
- package/dist/react/arrowTool-CWEMIRXK.js +17 -0
- package/dist/react/arrowTool-CWEMIRXK.js.map +7 -0
- package/dist/react/boxicons-5JNJQPUP.woff +0 -0
- package/dist/react/boxicons-6NVWQSCQ.eot +0 -0
- package/dist/react/boxicons-AQ5N6WP7.woff2 +0 -0
- package/dist/react/boxicons-GDR4JU3X.ttf +0 -0
- package/dist/react/boxicons-NNFHLMOR.svg +1660 -0
- package/dist/react/chunk-2OQXI7QB.js +564 -0
- package/dist/react/chunk-2OQXI7QB.js.map +7 -0
- package/dist/react/chunk-5OUBTHHO.js +187 -0
- package/dist/react/chunk-5OUBTHHO.js.map +7 -0
- package/dist/react/chunk-6PFXZKL2.js +628 -0
- package/dist/react/chunk-6PFXZKL2.js.map +7 -0
- package/dist/react/chunk-6SFNWGGZ.js +453 -0
- package/dist/react/chunk-6SFNWGGZ.js.map +7 -0
- package/dist/react/chunk-7TZSIR6V.js +210 -0
- package/dist/react/chunk-7TZSIR6V.js.map +7 -0
- package/dist/react/chunk-AJAZC37E.js +662 -0
- package/dist/react/chunk-AJAZC37E.js.map +7 -0
- package/dist/react/chunk-BU4D2WYQ.js +1213 -0
- package/dist/react/chunk-BU4D2WYQ.js.map +7 -0
- package/dist/react/chunk-BZE4CEBG.js +747 -0
- package/dist/react/chunk-BZE4CEBG.js.map +7 -0
- package/dist/react/chunk-CB2RANCB.js +212 -0
- package/dist/react/chunk-CB2RANCB.js.map +7 -0
- package/dist/react/chunk-DNAG7ML6.js +128 -0
- package/dist/react/chunk-DNAG7ML6.js.map +7 -0
- package/dist/react/chunk-HZWLPXFN.js +198 -0
- package/dist/react/chunk-HZWLPXFN.js.map +7 -0
- package/dist/react/chunk-I6HCCIXB.js +572 -0
- package/dist/react/chunk-I6HCCIXB.js.map +7 -0
- package/dist/react/chunk-IZ5OGWGW.js +235 -0
- package/dist/react/chunk-IZ5OGWGW.js.map +7 -0
- package/dist/react/chunk-JJCJNLNN.js +1490 -0
- package/dist/react/chunk-JJCJNLNN.js.map +7 -0
- package/dist/react/chunk-JQ3IRFDP.js +222 -0
- package/dist/react/chunk-JQ3IRFDP.js.map +7 -0
- package/dist/react/chunk-L5OARZJ7.js +1134 -0
- package/dist/react/chunk-L5OARZJ7.js.map +7 -0
- package/dist/react/chunk-LHRTXNVE.js +1600 -0
- package/dist/react/chunk-LHRTXNVE.js.map +7 -0
- package/dist/react/chunk-Q2GA4MBZ.js +1653 -0
- package/dist/react/chunk-Q2GA4MBZ.js.map +7 -0
- package/dist/react/chunk-QNSE5BAY.js +519 -0
- package/dist/react/chunk-QNSE5BAY.js.map +7 -0
- package/dist/react/chunk-QXFBG7OM.js +191 -0
- package/dist/react/chunk-QXFBG7OM.js.map +7 -0
- package/dist/react/chunk-T6ZVV5ZO.js +714 -0
- package/dist/react/chunk-T6ZVV5ZO.js.map +7 -0
- package/dist/react/chunk-URB6MY46.js +974 -0
- package/dist/react/chunk-URB6MY46.js.map +7 -0
- package/dist/react/chunk-VN62KLOC.js +931 -0
- package/dist/react/chunk-VN62KLOC.js.map +7 -0
- package/dist/react/chunk-VQVEPJSA.js +158 -0
- package/dist/react/chunk-VQVEPJSA.js.map +7 -0
- package/dist/react/chunk-XISEAGBV.js +1632 -0
- package/dist/react/chunk-XISEAGBV.js.map +7 -0
- package/dist/react/chunk-YKJUBFHE.js +575 -0
- package/dist/react/chunk-YKJUBFHE.js.map +7 -0
- package/dist/react/circleTool-NUATSEI2.js +14 -0
- package/dist/react/circleTool-NUATSEI2.js.map +7 -0
- package/dist/react/codeTool-MHCB2FNB.js +38 -0
- package/dist/react/codeTool-MHCB2FNB.js.map +7 -0
- package/dist/react/eraserTool-2GS2LQCS.js +103 -0
- package/dist/react/eraserTool-2GS2LQCS.js.map +7 -0
- package/dist/react/frameTool-PWVKKXSP.js +14 -0
- package/dist/react/frameTool-PWVKKXSP.js.map +7 -0
- package/dist/react/freehandTool-SLYGASVP.js +14 -0
- package/dist/react/freehandTool-SLYGASVP.js.map +7 -0
- package/dist/react/iconTool-GPZ7O7NH.js +18 -0
- package/dist/react/iconTool-GPZ7O7NH.js.map +7 -0
- package/dist/react/imageTool-D5R4XGEU.js +15 -0
- package/dist/react/imageTool-D5R4XGEU.js.map +7 -0
- package/dist/react/index.js +5349 -0
- package/dist/react/index.js.map +7 -0
- package/dist/react/laserTool-XVMV63AV.js +239 -0
- package/dist/react/laserTool-XVMV63AV.js.map +7 -0
- package/dist/react/lineTool-WNI5EMZ5.js +14 -0
- package/dist/react/lineTool-WNI5EMZ5.js.map +7 -0
- package/dist/react/lixCode-OJMVUXXI.ttf +0 -0
- package/dist/react/lixDefault-JEAPAUJL.ttf +0 -0
- package/dist/react/lixFancy-BPXYM5CQ.ttf +0 -0
- package/dist/react/lixFont-CPKEUDVM.woff2 +0 -0
- package/dist/react/rectangleTool-U7DZ6ZTA.js +14 -0
- package/dist/react/rectangleTool-U7DZ6ZTA.js.map +7 -0
- package/dist/react/styles.css +6627 -0
- package/dist/react/textTool-M7S6F3VC.js +21 -0
- package/dist/react/textTool-M7S6F3VC.js.map +7 -0
- package/package.json +39 -5
- package/src/EngineShortcuts.js +83 -27
- package/src/core/AIRenderer.js +30 -18
- package/src/core/GraphEngine.js +64 -41
- package/src/core/MermaidFlowchartRenderer.js +153 -88
- package/src/core/MermaidSequenceRenderer.js +168 -93
- package/src/core/SceneSerializer.js +86 -2
- package/src/core/Selection.js +119 -19
- package/src/core/UndoRedo.js +82 -15
- package/src/core/ZoomPan.js +15 -5
- package/src/index.js +14 -1
- package/src/react/LixSketchCanvas.jsx +347 -0
- package/src/react/components/AppMenu.jsx +482 -0
- package/src/react/components/Footer.jsx +85 -0
- package/src/react/components/Toolbar.jsx +140 -0
- package/src/react/components/canvas/CanvasLoadingOverlay.jsx +76 -0
- package/src/react/components/canvas/ContextMenu.jsx +466 -0
- package/src/react/components/canvas/FindBar.jsx +177 -0
- package/src/react/components/canvas/ImageSourcePicker.jsx +133 -0
- package/src/react/components/canvas/MultiSelectActions.jsx +120 -0
- package/src/react/components/canvas/SVGCanvas.jsx +145 -0
- package/src/react/components/canvas/SaveStatusIndicator.jsx +29 -0
- package/src/react/components/modals/CanvasPropertiesModal.jsx +358 -0
- package/src/react/components/modals/CommandPalette.jsx +307 -0
- package/src/react/components/modals/ExportImageModal.jsx +287 -0
- package/src/react/components/modals/GraphModal.jsx +174 -0
- package/src/react/components/modals/HelpModal.jsx +208 -0
- package/src/react/components/modals/LixScriptModal.jsx +130 -0
- package/src/react/components/modals/ShortcutsModal.jsx +125 -0
- package/src/react/components/sidebars/ArrowSidebar.jsx +173 -0
- package/src/react/components/sidebars/CircleSidebar.jsx +134 -0
- package/src/react/components/sidebars/FrameSidebar.jsx +263 -0
- package/src/react/components/sidebars/IconSidebar.jsx +279 -0
- package/src/react/components/sidebars/ImageSidebar.jsx +69 -0
- package/src/react/components/sidebars/LineSidebar.jsx +109 -0
- package/src/react/components/sidebars/PaintbrushSidebar.jsx +119 -0
- package/src/react/components/sidebars/RectangleSidebar.jsx +165 -0
- package/src/react/components/sidebars/ShapeSidebar.jsx +130 -0
- package/src/react/components/sidebars/TextSidebar.jsx +174 -0
- package/src/react/hooks/inertStores.js +58 -0
- package/src/react/hooks/useSketchEngine.js +76 -0
- package/src/react/hooks/useTranslation.js +92 -0
- package/src/react/index.js +41 -0
- package/src/react/store/useSketchStore.js +234 -0
- package/src/react/store/useUIStore.js +196 -0
- package/src/react/styles/arrowSidebar.css +263 -0
- package/src/react/styles/canvasStroke.css +47 -0
- package/src/react/styles/canvasTools.css +769 -0
- package/src/react/styles/circleSidebar.css +206 -0
- package/src/react/styles/fonts/fonts.css +29 -0
- package/src/react/styles/fonts/lixCode.ttf +0 -0
- package/src/react/styles/fonts/lixDefault.ttf +0 -0
- package/src/react/styles/fonts/lixDocs.ttf +0 -0
- package/src/react/styles/fonts/lixFancy.ttf +0 -0
- package/src/react/styles/fonts/lixFont.woff2 +0 -0
- package/src/react/styles/lineSidebar.css +207 -0
- package/src/react/styles/paintbrushSidebar.css +247 -0
- package/src/react/styles/squareSidebar.css +206 -0
- package/src/react/styles/writeText.css +149 -0
- package/src/react/styles.css +175 -0
- package/src/react/toolsEnum.js +20 -0
- package/src/react/utils/toast.js +18 -0
- package/src/shapes/Frame.js +7 -1
- package/src/shapes/Line.js +11 -5
- package/src/tools/arrowTool.js +30 -4
- package/src/tools/circleTool.js +33 -9
- package/src/tools/codeTool.js +5 -3
- package/src/tools/frameTool.js +47 -7
- package/src/tools/freehandTool.js +12 -4
- package/src/tools/iconTool.js +7 -1
- package/src/tools/imageTool.js +7 -1
- package/src/tools/lineTool.js +27 -3
- package/src/tools/rectangleTool.js +45 -8
- package/src/tools/textTool.js +23 -6
|
@@ -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// Theme colors (dark theme)\nconst 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\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 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 let labelFill = nFill && nFill !== 'transparent' && nFill !== THEME.nodeBg ? getContrastColor(nFill) : nStroke;\n if (isColorTooDark(labelFill)) labelFill = '#d0d0d0';\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 isColorTooDark(hex) {\n if (!hex || hex === 'transparent' || hex === 'none') return false;\n const rgb = parseColor(hex);\n if (!rgb) return false;\n return (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) < 80;\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 const PADDING = 40;\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 || '#fff',\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 };\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 || '#fff',\n strokeWidth: isThick ? 3 : 1.5,\n roughness: 1,\n strokeDasharray: isDotted ? '5 3' : '',\n label: e.label || '',\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;AAGpB,IAAM,QAAQ;AAAA,EACV,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,YAA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|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
parseSequenceDiagram
|
|
4
|
+
} from "./chunk-VQVEPJSA.js";
|
|
5
|
+
|
|
6
|
+
// src/core/MermaidSequenceRenderer.js
|
|
7
|
+
var PARTICIPANT_W = 100;
|
|
8
|
+
var PARTICIPANT_H = 36;
|
|
9
|
+
var PARTICIPANT_GAP = 140;
|
|
10
|
+
var MSG_ROW_HEIGHT = 50;
|
|
11
|
+
var NOTE_PAD = 10;
|
|
12
|
+
var NOTE_MAX_W = 160;
|
|
13
|
+
var TOP_MARGIN = 30;
|
|
14
|
+
var BOTTOM_MARGIN = 30;
|
|
15
|
+
var SIDE_MARGIN = 40;
|
|
16
|
+
var FONT_FAMILY = "lixFont, sans-serif";
|
|
17
|
+
var THEME = {
|
|
18
|
+
bg: "#1e1e28",
|
|
19
|
+
participantBg: "#232329",
|
|
20
|
+
participantBorder: "#555",
|
|
21
|
+
participantText: "#e8e8ee",
|
|
22
|
+
lifeline: "#444",
|
|
23
|
+
messageLine: "#888",
|
|
24
|
+
messageDash: "#666",
|
|
25
|
+
messageText: "#e0e0e0",
|
|
26
|
+
noteBg: "#3a3520",
|
|
27
|
+
noteBorder: "#665e30",
|
|
28
|
+
noteText: "#d4c870",
|
|
29
|
+
blockBg: "rgba(80,80,120,0.12)",
|
|
30
|
+
blockBorder: "#555",
|
|
31
|
+
blockLabel: "#a0a0b0",
|
|
32
|
+
crossColor: "#e74c3c"
|
|
33
|
+
};
|
|
34
|
+
function escapeXml(str) {
|
|
35
|
+
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
36
|
+
}
|
|
37
|
+
function measureText(text, fontSize) {
|
|
38
|
+
const avgCharWidth = fontSize * 0.55;
|
|
39
|
+
return text.length * avgCharWidth;
|
|
40
|
+
}
|
|
41
|
+
function wrapText(text, fontSize, maxWidth) {
|
|
42
|
+
const segments = text.split(/<br\s*\/?>/i);
|
|
43
|
+
const lines = [];
|
|
44
|
+
for (const segment of segments) {
|
|
45
|
+
const words = segment.split(/\s+/);
|
|
46
|
+
let currentLine = "";
|
|
47
|
+
for (const word of words) {
|
|
48
|
+
const testLine = currentLine ? currentLine + " " + word : word;
|
|
49
|
+
if (measureText(testLine, fontSize) > maxWidth && currentLine) {
|
|
50
|
+
lines.push(currentLine);
|
|
51
|
+
currentLine = word;
|
|
52
|
+
} else {
|
|
53
|
+
currentLine = testLine;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (currentLine) lines.push(currentLine);
|
|
57
|
+
}
|
|
58
|
+
return lines.length > 0 ? lines : [""];
|
|
59
|
+
}
|
|
60
|
+
function renderSequenceSVG(diagram, opts = {}) {
|
|
61
|
+
if (!diagram || diagram.type !== "sequenceDiagram") return "";
|
|
62
|
+
const participants = diagram.participants;
|
|
63
|
+
const messages = diagram.messages;
|
|
64
|
+
const notes = diagram.notes;
|
|
65
|
+
const blocks = diagram.blocks || [];
|
|
66
|
+
const pCount = participants.length;
|
|
67
|
+
if (pCount === 0) return "";
|
|
68
|
+
const pIndex = /* @__PURE__ */ new Map();
|
|
69
|
+
participants.forEach((p, i) => pIndex.set(p.name, i));
|
|
70
|
+
const contentWidth = (pCount - 1) * PARTICIPANT_GAP + PARTICIPANT_W;
|
|
71
|
+
const totalWidth = opts.width || Math.max(contentWidth + SIDE_MARGIN * 2, 400);
|
|
72
|
+
const startX = (totalWidth - contentWidth) / 2;
|
|
73
|
+
const pCenters = participants.map((_, i) => startX + i * PARTICIPANT_GAP + PARTICIPANT_W / 2);
|
|
74
|
+
const noteAtMsg = /* @__PURE__ */ new Map();
|
|
75
|
+
for (const note of notes) {
|
|
76
|
+
const fontSize = 11;
|
|
77
|
+
const lines = wrapText(note.text, fontSize, NOTE_MAX_W - NOTE_PAD * 2);
|
|
78
|
+
const h = lines.length * (fontSize + 4) + NOTE_PAD * 2;
|
|
79
|
+
if (!noteAtMsg.has(note.atMessage)) noteAtMsg.set(note.atMessage, []);
|
|
80
|
+
noteAtMsg.get(note.atMessage).push({ ...note, lines, height: h });
|
|
81
|
+
}
|
|
82
|
+
const topBoxBottom = TOP_MARGIN + PARTICIPANT_H;
|
|
83
|
+
let currentY = topBoxBottom + 30;
|
|
84
|
+
const msgYPositions = [];
|
|
85
|
+
for (let mi = 0; mi < messages.length; mi++) {
|
|
86
|
+
const notesBefore = noteAtMsg.get(mi);
|
|
87
|
+
if (notesBefore) {
|
|
88
|
+
const maxNoteH = Math.max(...notesBefore.map((n) => n.height));
|
|
89
|
+
currentY += maxNoteH + 10;
|
|
90
|
+
}
|
|
91
|
+
msgYPositions.push(currentY);
|
|
92
|
+
currentY += MSG_ROW_HEIGHT;
|
|
93
|
+
}
|
|
94
|
+
const notesAfterLast = noteAtMsg.get(messages.length);
|
|
95
|
+
if (notesAfterLast) {
|
|
96
|
+
const maxNoteH = Math.max(...notesAfterLast.map((n) => n.height));
|
|
97
|
+
currentY += maxNoteH + 10;
|
|
98
|
+
}
|
|
99
|
+
const bottomBoxTop = currentY + 20;
|
|
100
|
+
const totalHeight = bottomBoxTop + PARTICIPANT_H + BOTTOM_MARGIN;
|
|
101
|
+
let svg = "";
|
|
102
|
+
const defs = [];
|
|
103
|
+
defs.push(`<marker id="seq-arrow-open" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
104
|
+
<polyline points="1,1 9,3.5 1,6" fill="none" stroke="${THEME.messageLine}" stroke-width="1.5" stroke-linejoin="round" />
|
|
105
|
+
</marker>`);
|
|
106
|
+
defs.push(`<marker id="seq-arrow-filled" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
107
|
+
<polygon points="1,1 9,3.5 1,6" fill="${THEME.messageLine}" stroke="none" />
|
|
108
|
+
</marker>`);
|
|
109
|
+
svg += `<rect x="0" y="0" width="${totalWidth}" height="${totalHeight}" fill="${THEME.bg}" rx="8" />`;
|
|
110
|
+
if (diagram.title) {
|
|
111
|
+
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>`;
|
|
112
|
+
}
|
|
113
|
+
for (let pi = 0; pi < pCount; pi++) {
|
|
114
|
+
const cx = pCenters[pi];
|
|
115
|
+
svg += `<line x1="${cx}" y1="${topBoxBottom}" x2="${cx}" y2="${bottomBoxTop}" stroke="${THEME.lifeline}" stroke-width="1" stroke-dasharray="6 4" />`;
|
|
116
|
+
}
|
|
117
|
+
for (let pi = 0; pi < pCount; pi++) {
|
|
118
|
+
const cx = pCenters[pi];
|
|
119
|
+
const bx = cx - PARTICIPANT_W / 2;
|
|
120
|
+
const by = TOP_MARGIN;
|
|
121
|
+
svg += `<g data-seq-type="participant" data-seq-id="${escapeXml(participants[pi].name)}" data-seq-pos="top">`;
|
|
122
|
+
svg += `<rect x="${bx}" y="${by}" width="${PARTICIPANT_W}" height="${PARTICIPANT_H}" rx="4" fill="${THEME.participantBg}" stroke="${THEME.participantBorder}" stroke-width="1.5" />`;
|
|
123
|
+
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>`;
|
|
124
|
+
svg += `</g>`;
|
|
125
|
+
}
|
|
126
|
+
for (let pi = 0; pi < pCount; pi++) {
|
|
127
|
+
const cx = pCenters[pi];
|
|
128
|
+
const bx = cx - PARTICIPANT_W / 2;
|
|
129
|
+
const by = bottomBoxTop;
|
|
130
|
+
svg += `<g data-seq-type="participant" data-seq-id="${escapeXml(participants[pi].name)}" data-seq-pos="bottom">`;
|
|
131
|
+
svg += `<rect x="${bx}" y="${by}" width="${PARTICIPANT_W}" height="${PARTICIPANT_H}" rx="4" fill="${THEME.participantBg}" stroke="${THEME.participantBorder}" stroke-width="1.5" />`;
|
|
132
|
+
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>`;
|
|
133
|
+
svg += `</g>`;
|
|
134
|
+
}
|
|
135
|
+
for (const block of blocks) {
|
|
136
|
+
const startY = block.startMsg < msgYPositions.length ? msgYPositions[block.startMsg] - 20 : topBoxBottom + 20;
|
|
137
|
+
const endY = block.endMsg <= msgYPositions.length ? block.endMsg < msgYPositions.length ? msgYPositions[block.endMsg] - 10 : currentY : currentY;
|
|
138
|
+
const blockX = startX - 15;
|
|
139
|
+
const blockW = contentWidth + 30;
|
|
140
|
+
svg += `<g data-seq-type="block" data-block-type="${block.type}">`;
|
|
141
|
+
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" />`;
|
|
142
|
+
svg += `<rect x="${blockX}" y="${startY}" width="${measureText(block.type, 10) + 12}" height="18" rx="3" fill="${THEME.blockBorder}" />`;
|
|
143
|
+
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>`;
|
|
144
|
+
if (block.label) {
|
|
145
|
+
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>`;
|
|
146
|
+
}
|
|
147
|
+
for (let si = 1; si < block.sections.length; si++) {
|
|
148
|
+
const section = block.sections[si];
|
|
149
|
+
const secY = section.startMsg < msgYPositions.length ? msgYPositions[section.startMsg] - 15 : endY - 10;
|
|
150
|
+
svg += `<line x1="${blockX}" y1="${secY}" x2="${blockX + blockW}" y2="${secY}" stroke="${THEME.blockBorder}" stroke-width="1" stroke-dasharray="4 2" />`;
|
|
151
|
+
if (section.label) {
|
|
152
|
+
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>`;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
svg += `</g>`;
|
|
156
|
+
}
|
|
157
|
+
for (let mi = 0; mi < messages.length; mi++) {
|
|
158
|
+
const msg = messages[mi];
|
|
159
|
+
const y = msgYPositions[mi];
|
|
160
|
+
const fromIdx = pIndex.get(msg.from);
|
|
161
|
+
const toIdx = pIndex.get(msg.to);
|
|
162
|
+
if (fromIdx === void 0 || toIdx === void 0) continue;
|
|
163
|
+
const fromX = pCenters[fromIdx];
|
|
164
|
+
const toX = pCenters[toIdx];
|
|
165
|
+
const isSelf = fromIdx === toIdx;
|
|
166
|
+
svg += `<g data-seq-type="message" data-seq-idx="${mi}">`;
|
|
167
|
+
if (isSelf) {
|
|
168
|
+
const loopW = 40;
|
|
169
|
+
const loopH = 25;
|
|
170
|
+
const dash = msg.solid ? "" : ` stroke-dasharray="6 3"`;
|
|
171
|
+
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)" />`;
|
|
172
|
+
if (msg.text) {
|
|
173
|
+
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>`;
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
const isLeft = toX < fromX;
|
|
177
|
+
const lineEndX = isLeft ? toX + 4 : toX - 4;
|
|
178
|
+
const dash = msg.solid ? "" : ` stroke-dasharray="6 3"`;
|
|
179
|
+
const markerId = msg.arrowHead === "filled" ? "seq-arrow-filled" : "seq-arrow-open";
|
|
180
|
+
if (msg.cross) {
|
|
181
|
+
svg += `<line x1="${fromX}" y1="${y}" x2="${lineEndX}" y2="${y}" stroke="${THEME.messageLine}" stroke-width="1.5"${dash} />`;
|
|
182
|
+
const xSize = 6;
|
|
183
|
+
svg += `<line x1="${toX - xSize}" y1="${y - xSize}" x2="${toX + xSize}" y2="${y + xSize}" stroke="${THEME.crossColor}" stroke-width="2" />`;
|
|
184
|
+
svg += `<line x1="${toX + xSize}" y1="${y - xSize}" x2="${toX - xSize}" y2="${y + xSize}" stroke="${THEME.crossColor}" stroke-width="2" />`;
|
|
185
|
+
} else {
|
|
186
|
+
svg += `<line x1="${fromX}" y1="${y}" x2="${lineEndX}" y2="${y}" stroke="${THEME.messageLine}" stroke-width="1.5"${dash} marker-end="url(#${markerId})" />`;
|
|
187
|
+
}
|
|
188
|
+
if (msg.text) {
|
|
189
|
+
const midX = (fromX + toX) / 2;
|
|
190
|
+
const textContent = msg.number ? `${msg.number}. ${msg.text}` : msg.text;
|
|
191
|
+
svg += `<text x="${midX}" y="${y - 8}" text-anchor="middle" fill="${THEME.messageText}" font-size="12" font-family="${FONT_FAMILY}">${escapeXml(textContent)}</text>`;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
svg += `</g>`;
|
|
195
|
+
}
|
|
196
|
+
for (const [msgIdx, noteGroup] of noteAtMsg.entries()) {
|
|
197
|
+
const baseY = msgIdx < msgYPositions.length ? msgYPositions[msgIdx] - 15 : msgIdx > 0 ? msgYPositions[msgIdx - 1] + MSG_ROW_HEIGHT - 15 : topBoxBottom + 30;
|
|
198
|
+
for (const note of noteGroup) {
|
|
199
|
+
const targetIdxs = note.targets.map((t) => pIndex.get(t)).filter((i) => i !== void 0);
|
|
200
|
+
if (targetIdxs.length === 0) continue;
|
|
201
|
+
const fontSize = 11;
|
|
202
|
+
const lineH = fontSize + 4;
|
|
203
|
+
const noteH = note.lines.length * lineH + NOTE_PAD * 2;
|
|
204
|
+
const noteW = Math.min(
|
|
205
|
+
NOTE_MAX_W,
|
|
206
|
+
Math.max(...note.lines.map((l) => measureText(l, fontSize))) + NOTE_PAD * 2 + 10
|
|
207
|
+
);
|
|
208
|
+
let noteX;
|
|
209
|
+
if (note.position === "left of") {
|
|
210
|
+
const px = pCenters[targetIdxs[0]];
|
|
211
|
+
noteX = px - PARTICIPANT_W / 2 - noteW - 8;
|
|
212
|
+
} else if (note.position === "right of") {
|
|
213
|
+
const px = pCenters[targetIdxs[0]];
|
|
214
|
+
noteX = px + PARTICIPANT_W / 2 + 8;
|
|
215
|
+
} else {
|
|
216
|
+
if (targetIdxs.length >= 2) {
|
|
217
|
+
const minP = Math.min(...targetIdxs);
|
|
218
|
+
const maxP = Math.max(...targetIdxs);
|
|
219
|
+
const center = (pCenters[minP] + pCenters[maxP]) / 2;
|
|
220
|
+
noteX = center - noteW / 2;
|
|
221
|
+
} else {
|
|
222
|
+
noteX = pCenters[targetIdxs[0]] - noteW / 2;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const noteY = baseY - noteH;
|
|
226
|
+
svg += `<g data-seq-type="note">`;
|
|
227
|
+
svg += `<rect x="${noteX}" y="${noteY}" width="${noteW}" height="${noteH}" rx="3" fill="${THEME.noteBg}" stroke="${THEME.noteBorder}" stroke-width="1" />`;
|
|
228
|
+
note.lines.forEach((line, li) => {
|
|
229
|
+
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>`;
|
|
230
|
+
});
|
|
231
|
+
svg += `</g>`;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const defsStr = defs.length > 0 ? `<defs>${defs.join("")}</defs>` : "";
|
|
235
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${totalWidth}" height="${totalHeight}" viewBox="0 0 ${totalWidth} ${totalHeight}">${defsStr}${svg}</svg>`;
|
|
236
|
+
}
|
|
237
|
+
function renderSequencePreviewSVG(diagram) {
|
|
238
|
+
return renderSequenceSVG(diagram, { width: 620 });
|
|
239
|
+
}
|
|
240
|
+
function parseAndRenderSequence(src) {
|
|
241
|
+
const diagram = parseSequenceDiagram(src);
|
|
242
|
+
if (!diagram) return "";
|
|
243
|
+
return renderSequenceSVG(diagram);
|
|
244
|
+
}
|
|
245
|
+
function renderSequenceOnCanvas(diagram) {
|
|
246
|
+
if (!diagram || diagram.type !== "sequenceDiagram") return false;
|
|
247
|
+
if (!window.svg || !window.Rectangle || !window.Line || !window.Arrow) {
|
|
248
|
+
console.error("[SequenceRenderer] Engine not initialized (Rectangle / Line / Arrow missing)");
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
const participants = diagram.participants || [];
|
|
252
|
+
const messages = diagram.messages || [];
|
|
253
|
+
if (participants.length === 0) return false;
|
|
254
|
+
const pCount = participants.length;
|
|
255
|
+
const contentWidth = (pCount - 1) * PARTICIPANT_GAP + PARTICIPANT_W;
|
|
256
|
+
const totalWidth = Math.max(contentWidth + SIDE_MARGIN * 2, 400);
|
|
257
|
+
const startX = (totalWidth - contentWidth) / 2;
|
|
258
|
+
const pCenters = participants.map((_, i) => startX + i * PARTICIPANT_GAP + PARTICIPANT_W / 2);
|
|
259
|
+
const topBoxBottom = TOP_MARGIN + PARTICIPANT_H;
|
|
260
|
+
const msgYPositions = [];
|
|
261
|
+
let currentY = topBoxBottom + 30;
|
|
262
|
+
for (let mi = 0; mi < messages.length; mi++) {
|
|
263
|
+
msgYPositions.push(currentY);
|
|
264
|
+
currentY += MSG_ROW_HEIGHT;
|
|
265
|
+
}
|
|
266
|
+
const bottomBoxTop = currentY + 20;
|
|
267
|
+
const totalHeight = bottomBoxTop + PARTICIPANT_H + BOTTOM_MARGIN;
|
|
268
|
+
const vb = window.currentViewBox || { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight };
|
|
269
|
+
const ox = vb.x + vb.width / 2 - totalWidth / 2;
|
|
270
|
+
const oy = vb.y + vb.height / 2 - totalHeight / 2;
|
|
271
|
+
if (!window.Frame) {
|
|
272
|
+
console.error("[SequenceRenderer] window.Frame missing \u2014 cannot wrap diagram");
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
const PADDING = 24;
|
|
276
|
+
const frameTitle = diagram.title || "Sequence diagram";
|
|
277
|
+
const frame = new window.Frame(
|
|
278
|
+
ox - PADDING,
|
|
279
|
+
oy - PADDING,
|
|
280
|
+
totalWidth + PADDING * 2,
|
|
281
|
+
totalHeight + PADDING * 2,
|
|
282
|
+
{
|
|
283
|
+
stroke: "#888",
|
|
284
|
+
strokeWidth: 1,
|
|
285
|
+
fill: "transparent",
|
|
286
|
+
opacity: 0.7,
|
|
287
|
+
frameName: frameTitle
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
frame._diagramType = "mermaid-sequence";
|
|
291
|
+
window.shapes.push(frame);
|
|
292
|
+
if (window.pushCreateAction) window.pushCreateAction(frame);
|
|
293
|
+
const created = [];
|
|
294
|
+
const pIndex = /* @__PURE__ */ new Map();
|
|
295
|
+
for (let pi = 0; pi < pCount; pi++) {
|
|
296
|
+
const p = participants[pi];
|
|
297
|
+
pIndex.set(p.name, pi);
|
|
298
|
+
const cx = pCenters[pi] + ox;
|
|
299
|
+
const bx = cx - PARTICIPANT_W / 2;
|
|
300
|
+
try {
|
|
301
|
+
const topBox = new window.Rectangle(bx, TOP_MARGIN + oy, PARTICIPANT_W, PARTICIPANT_H, {
|
|
302
|
+
stroke: THEME.participantBorder,
|
|
303
|
+
strokeWidth: 1.5,
|
|
304
|
+
fill: THEME.participantBg,
|
|
305
|
+
fillStyle: "solid",
|
|
306
|
+
roughness: 1,
|
|
307
|
+
label: p.name
|
|
308
|
+
});
|
|
309
|
+
window.shapes.push(topBox);
|
|
310
|
+
if (window.pushCreateAction) window.pushCreateAction(topBox);
|
|
311
|
+
frame.addShapeToFrame(topBox);
|
|
312
|
+
created.push(topBox);
|
|
313
|
+
const lifeline = new window.Line(
|
|
314
|
+
{ x: cx, y: topBoxBottom + oy },
|
|
315
|
+
{ x: cx, y: bottomBoxTop + oy },
|
|
316
|
+
{
|
|
317
|
+
stroke: THEME.lifeline,
|
|
318
|
+
strokeWidth: 1,
|
|
319
|
+
strokeDasharray: "6 4",
|
|
320
|
+
roughness: 0
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
window.shapes.push(lifeline);
|
|
324
|
+
if (window.pushCreateAction) window.pushCreateAction(lifeline);
|
|
325
|
+
frame.addShapeToFrame(lifeline);
|
|
326
|
+
created.push(lifeline);
|
|
327
|
+
const bottomBox = new window.Rectangle(bx, bottomBoxTop + oy, PARTICIPANT_W, PARTICIPANT_H, {
|
|
328
|
+
stroke: THEME.participantBorder,
|
|
329
|
+
strokeWidth: 1.5,
|
|
330
|
+
fill: THEME.participantBg,
|
|
331
|
+
fillStyle: "solid",
|
|
332
|
+
roughness: 1,
|
|
333
|
+
label: p.name
|
|
334
|
+
});
|
|
335
|
+
window.shapes.push(bottomBox);
|
|
336
|
+
if (window.pushCreateAction) window.pushCreateAction(bottomBox);
|
|
337
|
+
frame.addShapeToFrame(bottomBox);
|
|
338
|
+
created.push(bottomBox);
|
|
339
|
+
} catch (err) {
|
|
340
|
+
console.warn("[SequenceRenderer] Participant creation failed:", p.name, err);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
for (let mi = 0; mi < messages.length; mi++) {
|
|
344
|
+
const m = messages[mi];
|
|
345
|
+
const fromI = pIndex.get(m.from);
|
|
346
|
+
const toI = pIndex.get(m.to);
|
|
347
|
+
if (fromI == null || toI == null) continue;
|
|
348
|
+
if (fromI === toI) continue;
|
|
349
|
+
const fromCx = pCenters[fromI] + ox;
|
|
350
|
+
const toCx = pCenters[toI] + ox;
|
|
351
|
+
const y = msgYPositions[mi] + oy;
|
|
352
|
+
const labelText = m.number ? `${m.number}. ${m.text}` : m.text;
|
|
353
|
+
const isCross = !!m.cross && m.arrowHead === "cross";
|
|
354
|
+
const opts = {
|
|
355
|
+
stroke: THEME.messageLine,
|
|
356
|
+
strokeWidth: 1.5,
|
|
357
|
+
roughness: 0,
|
|
358
|
+
strokeDasharray: m.solid ? "" : "6 4",
|
|
359
|
+
label: labelText || ""
|
|
360
|
+
};
|
|
361
|
+
try {
|
|
362
|
+
const sp = { x: fromCx, y };
|
|
363
|
+
const ep = { x: toCx, y };
|
|
364
|
+
const connector = isCross ? new window.Line(sp, ep, opts) : new window.Arrow(sp, ep, opts);
|
|
365
|
+
window.shapes.push(connector);
|
|
366
|
+
if (window.pushCreateAction) window.pushCreateAction(connector);
|
|
367
|
+
frame.addShapeToFrame(connector);
|
|
368
|
+
created.push(connector);
|
|
369
|
+
} catch (err) {
|
|
370
|
+
console.warn("[SequenceRenderer] Message creation failed:", m, err);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const first = created[0];
|
|
374
|
+
if (first) {
|
|
375
|
+
window.currentShape = first;
|
|
376
|
+
if (typeof first.selectShape === "function") first.selectShape();
|
|
377
|
+
}
|
|
378
|
+
console.log(`[SequenceRenderer] Done: ${pCount} participants, ${messages.length} messages`);
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
export {
|
|
382
|
+
parseAndRenderSequence,
|
|
383
|
+
renderSequenceOnCanvas,
|
|
384
|
+
renderSequencePreviewSVG,
|
|
385
|
+
renderSequenceSVG
|
|
386
|
+
};
|
|
387
|
+
//# sourceMappingURL=MermaidSequenceRenderer-HPLHY5II.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// Theme colors (dark theme matching the app)\nconst 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 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 (alt/opt/loop) are skipped for now \u2014 they'd\n * either need their own shape types or a richer label model. Self-\n * messages are also skipped (would need a curved arrow).\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 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 msgYPositions = [];\n let currentY = topBoxBottom + 30;\n for (let mi = 0; mi < messages.length; mi++) {\n msgYPositions.push(currentY);\n currentY += MSG_ROW_HEIGHT;\n }\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 const PADDING = 24;\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: '#888',\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: THEME.participantBorder,\n strokeWidth: 1.5,\n fill: THEME.participantBg,\n fillStyle: 'solid',\n roughness: 1,\n label: p.name,\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: THEME.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: THEME.participantBorder,\n strokeWidth: 1.5,\n fill: THEME.participantBg,\n fillStyle: 'solid',\n roughness: 1,\n label: p.name,\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 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 if (fromI === toI) continue; // skip self-messages (v1 limitation)\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: THEME.messageLine,\n strokeWidth: 1.5,\n roughness: 0,\n strokeDasharray: m.solid ? '' : '6 4',\n label: labelText || '',\n };\n\n try {\n const sp = { x: fromCx, y };\n const ep = { x: toCx, y };\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 // 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\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;AAIpB,IAAM,QAAQ;AAAA,EACV,IAAI;AAAA,EACJ,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,aAAa;AAAA,E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