@elixpo/lixsketch 5.5.12 → 5.5.13
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-PWWLWI6U.js → AIRenderer-ATIKGFB4.js} +90 -8
- package/dist/react/{AIRenderer-PWWLWI6U.js.map → AIRenderer-ATIKGFB4.js.map} +2 -2
- package/dist/react/{CopyPaste-SA72NDFN.js → CopyPaste-VUM5WRDX.js} +2 -2
- package/dist/react/FreehandStroke-JKTCTOKU.js +8 -0
- package/dist/react/{GraphEngine-IHRVGUGG.js → GraphEngine-KQXHNTZQ.js} +39 -1
- package/dist/react/{GraphEngine-IHRVGUGG.js.map → GraphEngine-KQXHNTZQ.js.map} +2 -2
- package/dist/react/{MermaidStructuredRenderer-GGOOGON5.js → MermaidStructuredRenderer-26WGA6YD.js} +152 -25
- package/dist/react/MermaidStructuredRenderer-26WGA6YD.js.map +7 -0
- package/dist/react/{SceneSerializer-ZPHV6IUP.js → SceneSerializer-3RWFYSLY.js} +2 -2
- package/dist/react/{SketchEngine-NPF2XN6Z.js → SketchEngine-WW5LIHNT.js} +6 -6
- package/dist/react/{chunk-YKJUBFHE.js → chunk-ABZEV54U.js} +23 -2
- package/dist/react/chunk-ABZEV54U.js.map +7 -0
- package/dist/react/index.js +26 -18
- package/dist/react/index.js.map +2 -2
- package/dist/react/styles.css +10 -3
- package/package.json +1 -1
- package/src/core/AIRenderer.js +104 -6
- package/src/core/GraphEngine.js +45 -0
- package/src/core/MermaidStructuredRenderer.js +162 -22
- package/src/react/LixSketchCanvas.jsx +4 -0
- package/src/react/components/AppMenu.jsx +2 -2
- package/src/react/components/Toolbar.jsx +1 -1
- package/src/react/components/modals/CommandPalette.jsx +3 -3
- package/src/react/components/sidebars/FrameSidebar.jsx +1 -1
- package/src/react/components/sidebars/IconSidebar.jsx +2 -2
- package/src/react/components/sidebars/ShapeSidebar.jsx +1 -1
- package/src/react/store/useSketchStore.js +7 -2
- package/src/react/store/useUIStore.js +3 -4
- package/src/react/styles.css +12 -3
- package/src/shapes/FreehandStroke.js +28 -3
- package/dist/react/FreehandStroke-CK24NUT3.js +0 -8
- package/dist/react/MermaidStructuredRenderer-GGOOGON5.js.map +0 -7
- package/dist/react/chunk-YKJUBFHE.js.map +0 -7
- /package/dist/react/{CopyPaste-SA72NDFN.js.map → CopyPaste-VUM5WRDX.js.map} +0 -0
- /package/dist/react/{FreehandStroke-CK24NUT3.js.map → FreehandStroke-JKTCTOKU.js.map} +0 -0
- /package/dist/react/{SceneSerializer-ZPHV6IUP.js.map → SceneSerializer-3RWFYSLY.js.map} +0 -0
- /package/dist/react/{SketchEngine-NPF2XN6Z.js.map → SketchEngine-WW5LIHNT.js.map} +0 -0
|
@@ -332,12 +332,50 @@ function renderGraphOnCanvas(equations, settings) {
|
|
|
332
332
|
if (typeof window.updateAttachedArrows === "function") {
|
|
333
333
|
window.updateAttachedArrows(this);
|
|
334
334
|
}
|
|
335
|
+
},
|
|
336
|
+
adaptToBackground(background, foreground, muted) {
|
|
337
|
+
const ensureContrast = window.__ensureCanvasContrast || ((color) => color);
|
|
338
|
+
this.group.querySelectorAll("rect").forEach((rect) => {
|
|
339
|
+
const fill = rect.getAttribute("fill");
|
|
340
|
+
const stroke = rect.getAttribute("stroke");
|
|
341
|
+
if (fill && fill !== "none") rect.setAttribute("fill", background);
|
|
342
|
+
if (stroke && stroke !== "none") {
|
|
343
|
+
rect.setAttribute("stroke", muted);
|
|
344
|
+
rect.setAttribute("stroke-opacity", "0.45");
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
this.group.querySelectorAll("line").forEach((line) => {
|
|
348
|
+
const width = Number.parseFloat(line.getAttribute("stroke-width") || "1");
|
|
349
|
+
line.setAttribute("stroke", foreground);
|
|
350
|
+
line.setAttribute("stroke-opacity", width <= 0.5 ? "0.18" : "0.5");
|
|
351
|
+
});
|
|
352
|
+
this.group.querySelectorAll("path[stroke]").forEach((path) => {
|
|
353
|
+
const original = path.dataset.graphColor || path.getAttribute("stroke");
|
|
354
|
+
if (!original || original === "none") return;
|
|
355
|
+
path.dataset.graphColor = original;
|
|
356
|
+
path.setAttribute("stroke", ensureContrast(original, background, 3));
|
|
357
|
+
});
|
|
358
|
+
this.group.querySelectorAll("circle[fill]").forEach((circle) => {
|
|
359
|
+
const original = circle.dataset.graphColor || circle.getAttribute("fill");
|
|
360
|
+
if (!original || original === "none") return;
|
|
361
|
+
circle.dataset.graphColor = original;
|
|
362
|
+
circle.setAttribute("fill", ensureContrast(original, background, 3));
|
|
363
|
+
});
|
|
364
|
+
this.group.querySelectorAll("text").forEach((text) => {
|
|
365
|
+
const original = text.dataset.graphColor || text.getAttribute("fill");
|
|
366
|
+
if (original) text.dataset.graphColor = original;
|
|
367
|
+
const isAxisLabel = !original || ["#8b949e", "#62627a"].includes(original.toLowerCase());
|
|
368
|
+
text.setAttribute("fill", isAxisLabel ? muted : ensureContrast(original, background, 4.5));
|
|
369
|
+
});
|
|
335
370
|
}
|
|
336
371
|
};
|
|
337
372
|
window.shapes.push(graphShape);
|
|
338
373
|
if (window.pushCreateAction) window.pushCreateAction(graphShape);
|
|
339
374
|
window.currentShape = graphShape;
|
|
340
375
|
graphShape.selectShape();
|
|
376
|
+
window.__adaptCanvasContrast?.(
|
|
377
|
+
window.getComputedStyle(window.svg).backgroundColor || "#13171C"
|
|
378
|
+
);
|
|
341
379
|
} catch (err) {
|
|
342
380
|
console.error("[GraphEngine] SVG insertion failed:", err);
|
|
343
381
|
return false;
|
|
@@ -359,4 +397,4 @@ function initGraphEngine() {
|
|
|
359
397
|
export {
|
|
360
398
|
initGraphEngine
|
|
361
399
|
};
|
|
362
|
-
//# sourceMappingURL=GraphEngine-
|
|
400
|
+
//# sourceMappingURL=GraphEngine-KQXHNTZQ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/core/GraphRenderer.js", "../../src/core/GraphEngine.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable */\n/**\n * GraphRenderer - Renders mathematical equations as SVG graphs.\n * Produces axes, grid, tick labels, and equation curves.\n */\n\nimport { parseExpression } from './GraphMathParser.js';\n\nconst GRAPH_COLORS = [\n '#4A90D9', '#E74C3C', '#2ECC71', '#F39C12', '#9B59B6',\n '#1ABC9C', '#E67E22', '#3498DB', '#E91E63', '#00BCD4',\n];\n\n// Issue #38 follow-up: theme-aware graph chrome. Light mode flips every\n// hardcoded `rgba(255,255,255,X)` token (designed for dark canvas) to a\n// matching `rgba(60,60,80,X)` so the grid, axes, plot border, and tick\n// labels stay readable on the warm off-white canvas. The equation\n// curves themselves keep their colours from GRAPH_COLORS.\nfunction graphThemeTokens() {\n const isDark = typeof document !== 'undefined'\n && document.body\n && document.body.classList.contains('theme-dark');\n if (isDark) {\n return {\n outerBg: '#0d1117',\n plotBg: '#111822',\n gridStroke:'rgba(255,255,255,0.06)',\n axisStroke:'rgba(255,255,255,0.25)',\n borderStroke:'rgba(255,255,255,0.1)',\n tickLabel: '#8b949e',\n };\n }\n return {\n outerBg: '#fbfaf6',\n plotBg: '#ffffff',\n gridStroke:'rgba(60,60,80,0.08)',\n axisStroke:'rgba(60,60,80,0.35)',\n borderStroke:'rgba(60,60,80,0.16)',\n tickLabel: '#62627a',\n };\n}\n\n/**\n * Calculate nice tick intervals for a given range.\n */\nfunction niceInterval(range) {\n const rough = range / 8;\n const mag = Math.pow(10, Math.floor(Math.log10(rough)));\n const residual = rough / mag;\n let nice;\n if (residual <= 1.5) nice = 1;\n else if (residual <= 3) nice = 2;\n else if (residual <= 7) nice = 5;\n else nice = 10;\n return nice * mag;\n}\n\n/**\n * Render graph as SVG markup string.\n * @param {Array} equations - [{expression: string, color: string}]\n * @param {Object} settings - {xMin, xMax, yMin, yMax, showGrid, width, height}\n * @returns {string} SVG markup\n */\nexport function renderGraphSVG(equations, settings) {\n const {\n xMin = -10, xMax = 10,\n yMin = -10, yMax = 10,\n showGrid = true,\n width = 600, height = 400,\n } = settings || {};\n\n const pad = { top: 20, right: 20, bottom: 35, left: 45 };\n const plotW = width - pad.left - pad.right;\n const plotH = height - pad.top - pad.bottom;\n const xRange = xMax - xMin || 1;\n const yRange = yMax - yMin || 1;\n\n // Coordinate transforms\n const toSvgX = (x) => pad.left + ((x - xMin) / xRange) * plotW;\n const toSvgY = (y) => pad.top + ((yMax - y) / yRange) * plotH;\n\n let svg = '';\n const tk = graphThemeTokens();\n\n // Background\n svg += `<rect x=\"0\" y=\"0\" width=\"${width}\" height=\"${height}\" fill=\"${tk.outerBg}\" rx=\"8\" />`;\n svg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"${tk.plotBg}\" />`;\n\n // Grid & ticks\n const xTick = niceInterval(xRange);\n const yTick = niceInterval(yRange);\n\n // Vertical grid lines + x labels\n const xStart = Math.ceil(xMin / xTick) * xTick;\n for (let x = xStart; x <= xMax; x += xTick) {\n const sx = toSvgX(x);\n if (sx < pad.left || sx > pad.left + plotW) continue;\n if (showGrid) {\n svg += `<line x1=\"${sx}\" y1=\"${pad.top}\" x2=\"${sx}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(x) < 1e-10 ? '0' : (Number.isInteger(x) ? x : x.toFixed(1));\n svg += `<text x=\"${sx}\" y=\"${pad.top + plotH + 16}\" text-anchor=\"middle\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n\n // Horizontal grid lines + y labels\n const yStart = Math.ceil(yMin / yTick) * yTick;\n for (let y = yStart; y <= yMax; y += yTick) {\n const sy = toSvgY(y);\n if (sy < pad.top || sy > pad.top + plotH) continue;\n if (showGrid) {\n svg += `<line x1=\"${pad.left}\" y1=\"${sy}\" x2=\"${pad.left + plotW}\" y2=\"${sy}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(y) < 1e-10 ? '0' : (Number.isInteger(y) ? y : y.toFixed(1));\n svg += `<text x=\"${pad.left - 8}\" y=\"${sy + 3}\" text-anchor=\"end\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n\n // Axes\n if (xMin <= 0 && xMax >= 0) {\n const ax = toSvgX(0);\n svg += `<line x1=\"${ax}\" y1=\"${pad.top}\" x2=\"${ax}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n if (yMin <= 0 && yMax >= 0) {\n const ay = toSvgY(0);\n svg += `<line x1=\"${pad.left}\" y1=\"${ay}\" x2=\"${pad.left + plotW}\" y2=\"${ay}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n\n // Plot border\n svg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"none\" stroke=\"${tk.borderStroke}\" stroke-width=\"1\" />`;\n\n // Equations\n const samplesPerPixel = 2;\n const totalSamples = plotW * samplesPerPixel;\n const dx = xRange / totalSamples;\n\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n\n const fn = parseExpression(eq.expression);\n if (!fn) return;\n\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n let pathData = '';\n let drawing = false;\n\n for (let i = 0; i <= totalSamples; i++) {\n const x = xMin + i * dx;\n let y;\n try { y = fn(x); } catch { y = NaN; }\n\n if (!isFinite(y) || isNaN(y) || y < yMin - yRange * 5 || y > yMax + yRange * 5) {\n drawing = false;\n continue;\n }\n\n // Clamp to plot area for rendering\n const clampedY = Math.max(yMin - yRange * 0.5, Math.min(yMax + yRange * 0.5, y));\n const sx = toSvgX(x);\n const sy = toSvgY(clampedY);\n\n if (!drawing) {\n pathData += `M ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n drawing = true;\n } else {\n pathData += `L ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n }\n }\n\n if (pathData) {\n svg += `<path d=\"${pathData.trim()}\" fill=\"none\" stroke=\"${color}\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />`;\n }\n });\n\n // Clip path for plot area\n const clipId = 'graph-clip-' + Date.now();\n const defs = `<defs><clipPath id=\"${clipId}\"><rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" /></clipPath></defs>`;\n\n // Re-wrap: curves should be clipped\n // Rebuild with clip group\n let curves = '';\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n const fn = parseExpression(eq.expression);\n if (!fn) return;\n\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n let pathData = '';\n let drawing = false;\n\n for (let i = 0; i <= totalSamples; i++) {\n const x = xMin + i * dx;\n let y;\n try { y = fn(x); } catch { y = NaN; }\n\n if (!isFinite(y) || isNaN(y)) { drawing = false; continue; }\n\n const sx = toSvgX(x);\n const sy = toSvgY(y);\n\n if (!drawing) {\n pathData += `M ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n drawing = true;\n } else {\n pathData += `L ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n }\n }\n\n if (pathData) {\n curves += `<path d=\"${pathData.trim()}\" fill=\"none\" stroke=\"${color}\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />`;\n }\n });\n\n // Equation legend\n let legendY = pad.top + 12;\n let legend = '';\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n legend += `<circle cx=\"${pad.left + 12}\" cy=\"${legendY}\" r=\"4\" fill=\"${color}\" />`;\n legend += `<text x=\"${pad.left + 22}\" y=\"${legendY + 3}\" fill=\"${color}\" font-size=\"11\" font-family=\"lixCode, monospace\">${escapeXml(eq.expression)}</text>`;\n legendY += 18;\n });\n\n // Remove the non-clipped curves from svg (we added them above for building)\n // Rebuild cleanly\n let cleanSvg = '';\n cleanSvg += `<rect x=\"0\" y=\"0\" width=\"${width}\" height=\"${height}\" fill=\"${tk.outerBg}\" rx=\"8\" />`;\n cleanSvg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"${tk.plotBg}\" />`;\n\n // Grid + ticks (re-add)\n for (let x = xStart; x <= xMax; x += xTick) {\n const sx = toSvgX(x);\n if (sx < pad.left || sx > pad.left + plotW) continue;\n if (showGrid) {\n cleanSvg += `<line x1=\"${sx}\" y1=\"${pad.top}\" x2=\"${sx}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(x) < 1e-10 ? '0' : (Number.isInteger(x) ? x : x.toFixed(1));\n cleanSvg += `<text x=\"${sx}\" y=\"${pad.top + plotH + 16}\" text-anchor=\"middle\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n for (let y = yStart; y <= yMax; y += yTick) {\n const sy = toSvgY(y);\n if (sy < pad.top || sy > pad.top + plotH) continue;\n if (showGrid) {\n cleanSvg += `<line x1=\"${pad.left}\" y1=\"${sy}\" x2=\"${pad.left + plotW}\" y2=\"${sy}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(y) < 1e-10 ? '0' : (Number.isInteger(y) ? y : y.toFixed(1));\n cleanSvg += `<text x=\"${pad.left - 8}\" y=\"${sy + 3}\" text-anchor=\"end\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n // Axes\n if (xMin <= 0 && xMax >= 0) {\n const ax = toSvgX(0);\n cleanSvg += `<line x1=\"${ax}\" y1=\"${pad.top}\" x2=\"${ax}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n if (yMin <= 0 && yMax >= 0) {\n const ay = toSvgY(0);\n cleanSvg += `<line x1=\"${pad.left}\" y1=\"${ay}\" x2=\"${pad.left + plotW}\" y2=\"${ay}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n // Plot border\n cleanSvg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"none\" stroke=\"${tk.borderStroke}\" stroke-width=\"1\" />`;\n\n // Clipped curves\n cleanSvg += `<g clip-path=\"url(#${clipId})\">${curves}</g>`;\n\n // Legend\n cleanSvg += legend;\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${width}\" height=\"${height}\" viewBox=\"0 0 ${width} ${height}\">${defs}${cleanSvg}</svg>`;\n}\n\n/**\n * Generate a preview SVG for the modal.\n */\nexport function renderGraphPreviewSVG(equations, settings) {\n return renderGraphSVG(equations, {\n ...settings,\n width: 520,\n height: 380,\n });\n}\n\nfunction escapeXml(str) {\n return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n}\n\nexport { GRAPH_COLORS };\n", "/* eslint-disable */\n/**\n * GraphEngine - Bridge between graph rendering and the sketch canvas.\n * Creates Frames containing rendered graph SVG elements.\n */\n\nimport { parseExpression, isValidExpression } from './GraphMathParser.js';\nimport { renderGraphSVG, renderGraphPreviewSVG, GRAPH_COLORS } from './GraphRenderer.js';\n\nconst NS = 'http://www.w3.org/2000/svg';\nconst GRAPH_WIDTH = 600;\nconst GRAPH_HEIGHT = 420;\n\n/**\n * Place a graph on the canvas inside a Frame.\n */\nfunction renderGraphOnCanvas(equations, settings) {\n if (!equations || equations.length === 0) return false;\n if (!window.svg || !window.Frame) {\n console.error('[GraphEngine] Engine not initialized');\n return false;\n }\n\n // Generate full-size SVG\n const svgMarkup = renderGraphSVG(equations, {\n ...settings,\n width: GRAPH_WIDTH,\n height: GRAPH_HEIGHT,\n });\n if (!svgMarkup) return false;\n\n // Viewport center\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\n const frameW = GRAPH_WIDTH + 40;\n const frameH = GRAPH_HEIGHT + 40;\n const frameX = vcx - frameW / 2;\n const frameY = vcy - frameH / 2;\n\n // Build title from equations\n const eqLabels = equations\n .filter(eq => eq.expression && eq.expression.trim())\n .map(eq => eq.expression.trim())\n .slice(0, 3);\n const title = eqLabels.length > 0\n ? 'Graph: ' + eqLabels.join(', ')\n : 'Graph';\n\n // Phase 5 (issue #22): no wrapper frame. The graph is conceptually a\n // single rendering \u2014 axes, grid, curves all interlocked \u2014 so we don't\n // split it into per-curve shapes. Instead the graph becomes ONE\n // first-class shape on the canvas: a `graphShape` that implements the\n // shape API the engine relies on (contains / selectShape / etc.) so\n // it can be selected, dragged, attached to by arrows, picked up by\n // the rect-drag \u2014 exactly like a user-drawn shape.\n try {\n const parser = new DOMParser();\n const doc = parser.parseFromString(svgMarkup, 'image/svg+xml');\n const svgEl = doc.querySelector('svg');\n if (!svgEl) return false;\n\n const graphGroup = document.createElementNS(NS, 'g');\n graphGroup.setAttribute('data-type', 'graph-group');\n graphGroup.setAttribute('transform', `translate(${frameX + 20}, ${frameY + 20})`);\n\n // Copy defs (clip paths)\n const defs = svgEl.querySelector('defs');\n if (defs) {\n const defsClone = defs.cloneNode(true);\n window.svg.querySelector('defs')?.appendChild(defsClone.firstChild) ||\n window.svg.insertBefore(defsClone, window.svg.firstChild);\n }\n\n while (svgEl.childNodes.length > 0) {\n const child = svgEl.childNodes[0];\n if (child.nodeName === 'defs') { svgEl.removeChild(child); continue; }\n graphGroup.appendChild(child);\n }\n window.svg.appendChild(graphGroup);\n\n const graphShape = {\n shapeName: 'graph', // first-class shapeName\n shapeID: `graph-${Date.now().toString(36)}-${Math.floor(Math.random() * 10000)}`,\n group: graphGroup,\n element: graphGroup,\n x: frameX + 20,\n y: frameY + 20,\n width: GRAPH_WIDTH,\n height: GRAPH_HEIGHT,\n rotation: 0,\n isSelected: false,\n _selectionRect: null,\n _graphData: {\n equations: equations.map(eq => ({ expression: eq.expression, color: eq.color })),\n settings: { ...settings },\n },\n\n // \u2500\u2500 Shape API the engine relies on \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 contains(px, py) {\n return px >= this.x && px <= this.x + this.width\n && py >= this.y && py <= this.y + this.height;\n },\n move(dx, dy) {\n this.x += dx; this.y += dy;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y})`);\n this._updateSelectionRect();\n },\n selectShape() {\n this.isSelected = true;\n if (this._selectionRect) return;\n const r = document.createElementNS(NS, 'rect');\n r.setAttribute('fill', 'none');\n r.setAttribute('stroke', '#9b7bf7');\n r.setAttribute('stroke-width', '1.5');\n r.setAttribute('stroke-dasharray', '4 3');\n r.setAttribute('pointer-events', 'none');\n window.svg.appendChild(r);\n this._selectionRect = r;\n this._updateSelectionRect();\n },\n removeSelection() {\n this.isSelected = false;\n if (this._selectionRect && this._selectionRect.parentNode) {\n this._selectionRect.parentNode.removeChild(this._selectionRect);\n }\n this._selectionRect = null;\n },\n _updateSelectionRect() {\n if (!this._selectionRect) return;\n const pad = 4;\n this._selectionRect.setAttribute('x', this.x - pad);\n this._selectionRect.setAttribute('y', this.y - pad);\n this._selectionRect.setAttribute('width', this.width + pad * 2);\n this._selectionRect.setAttribute('height', this.height + pad * 2);\n },\n updateAttachedArrows() {\n if (typeof window.updateAttachedArrows === 'function') {\n window.updateAttachedArrows(this);\n }\n },\n };\n\n window.shapes.push(graphShape);\n if (window.pushCreateAction) window.pushCreateAction(graphShape);\n\n // Auto-select so the user sees something landed.\n window.currentShape = graphShape;\n graphShape.selectShape();\n } catch (err) {\n console.error('[GraphEngine] SVG insertion failed:', err);\n return false;\n }\n\n return true;\n}\n\n/**\n * Initialize the graph engine \u2014 expose bridge functions on window.\n */\nexport function initGraphEngine() {\n window.__graphPreview = (equations, settings) => {\n return renderGraphPreviewSVG(equations, settings);\n };\n window.__graphRenderer = renderGraphOnCanvas;\n window.__graphParser = (expr) => {\n const fn = parseExpression(expr);\n return fn ? true : false;\n };\n window.__graphValidate = isValidExpression;\n window.__graphColors = GRAPH_COLORS;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAQA,IAAM,eAAe;AAAA,EACjB;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAC5C;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAChD;AAOA,SAAS,mBAAmB;AACxB,QAAM,SAAS,OAAO,aAAa,eAC5B,SAAS,QACT,SAAS,KAAK,UAAU,SAAS,YAAY;AACpD,MAAI,QAAQ;AACR,WAAO;AAAA,MACH,SAAW;AAAA,MACX,QAAW;AAAA,MACX,YAAW;AAAA,MACX,YAAW;AAAA,MACX,cAAa;AAAA,MACb,WAAW;AAAA,IACf;AAAA,EACJ;AACA,SAAO;AAAA,IACH,SAAW;AAAA,IACX,QAAW;AAAA,IACX,YAAW;AAAA,IACX,YAAW;AAAA,IACX,cAAa;AAAA,IACb,WAAW;AAAA,EACf;AACJ;AAKA,SAAS,aAAa,OAAO;AACzB,QAAM,QAAQ,QAAQ;AACtB,QAAM,MAAM,KAAK,IAAI,IAAI,KAAK,MAAM,KAAK,MAAM,KAAK,CAAC,CAAC;AACtD,QAAM,WAAW,QAAQ;AACzB,MAAI;AACJ,MAAI,YAAY,IAAK,QAAO;AAAA,WACnB,YAAY,EAAG,QAAO;AAAA,WACtB,YAAY,EAAG,QAAO;AAAA,MAC1B,QAAO;AACZ,SAAO,OAAO;AAClB;AAQO,SAAS,eAAe,WAAW,UAAU;AAChD,QAAM;AAAA,IACF,OAAO;AAAA,IAAK,OAAO;AAAA,IACnB,OAAO;AAAA,IAAK,OAAO;AAAA,IACnB,WAAW;AA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AAK,SAAS,MAAM,CAAC;AAAA,MACpE;AAAA,MACA,uBAAuB;AACnB,YAAI,OAAO,OAAO,yBAAyB,YAAY;AACnD,iBAAO,qBAAqB,IAAI;AAAA,QACpC;AAAA,MACJ;AAAA,IACJ;AAEA,WAAO,OAAO,KAAK,UAAU;AAC7B,QAAI,OAAO,iBAAkB,QAAO,iBAAiB,UAAU;AAG/D,WAAO,eAAe;AACtB,eAAW,YAAY;AAAA,EAC3B,SAAS,KAAK;AACV,YAAQ,MAAM,uCAAuC,GAAG;AACxD,WAAO;AAAA,EACX;AAEA,SAAO;AACX;AAKO,SAAS,kBAAkB;AAC9B,SAAO,iBAAiB,CAAC,WAAW,aAAa;AAC7C,WAAO,sBAAsB,WAAW,QAAQ;AAAA,EACpD;AACA,SAAO,kBAAkB;AACzB,SAAO,gBAAgB,CAAC,SAAS;AAC7B,UAAM,KAAK,gBAAgB,IAAI;AAC/B,WAAO,KAAK,OAAO;AAAA,EACvB;AACA,SAAO,kBAAkB;AACzB,SAAO,gBAAgB;AAC3B;",
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n/**\n * GraphRenderer - Renders mathematical equations as SVG graphs.\n * Produces axes, grid, tick labels, and equation curves.\n */\n\nimport { parseExpression } from './GraphMathParser.js';\n\nconst GRAPH_COLORS = [\n '#4A90D9', '#E74C3C', '#2ECC71', '#F39C12', '#9B59B6',\n '#1ABC9C', '#E67E22', '#3498DB', '#E91E63', '#00BCD4',\n];\n\n// Issue #38 follow-up: theme-aware graph chrome. Light mode flips every\n// hardcoded `rgba(255,255,255,X)` token (designed for dark canvas) to a\n// matching `rgba(60,60,80,X)` so the grid, axes, plot border, and tick\n// labels stay readable on the warm off-white canvas. The equation\n// curves themselves keep their colours from GRAPH_COLORS.\nfunction graphThemeTokens() {\n const isDark = typeof document !== 'undefined'\n && document.body\n && document.body.classList.contains('theme-dark');\n if (isDark) {\n return {\n outerBg: '#0d1117',\n plotBg: '#111822',\n gridStroke:'rgba(255,255,255,0.06)',\n axisStroke:'rgba(255,255,255,0.25)',\n borderStroke:'rgba(255,255,255,0.1)',\n tickLabel: '#8b949e',\n };\n }\n return {\n outerBg: '#fbfaf6',\n plotBg: '#ffffff',\n gridStroke:'rgba(60,60,80,0.08)',\n axisStroke:'rgba(60,60,80,0.35)',\n borderStroke:'rgba(60,60,80,0.16)',\n tickLabel: '#62627a',\n };\n}\n\n/**\n * Calculate nice tick intervals for a given range.\n */\nfunction niceInterval(range) {\n const rough = range / 8;\n const mag = Math.pow(10, Math.floor(Math.log10(rough)));\n const residual = rough / mag;\n let nice;\n if (residual <= 1.5) nice = 1;\n else if (residual <= 3) nice = 2;\n else if (residual <= 7) nice = 5;\n else nice = 10;\n return nice * mag;\n}\n\n/**\n * Render graph as SVG markup string.\n * @param {Array} equations - [{expression: string, color: string}]\n * @param {Object} settings - {xMin, xMax, yMin, yMax, showGrid, width, height}\n * @returns {string} SVG markup\n */\nexport function renderGraphSVG(equations, settings) {\n const {\n xMin = -10, xMax = 10,\n yMin = -10, yMax = 10,\n showGrid = true,\n width = 600, height = 400,\n } = settings || {};\n\n const pad = { top: 20, right: 20, bottom: 35, left: 45 };\n const plotW = width - pad.left - pad.right;\n const plotH = height - pad.top - pad.bottom;\n const xRange = xMax - xMin || 1;\n const yRange = yMax - yMin || 1;\n\n // Coordinate transforms\n const toSvgX = (x) => pad.left + ((x - xMin) / xRange) * plotW;\n const toSvgY = (y) => pad.top + ((yMax - y) / yRange) * plotH;\n\n let svg = '';\n const tk = graphThemeTokens();\n\n // Background\n svg += `<rect x=\"0\" y=\"0\" width=\"${width}\" height=\"${height}\" fill=\"${tk.outerBg}\" rx=\"8\" />`;\n svg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"${tk.plotBg}\" />`;\n\n // Grid & ticks\n const xTick = niceInterval(xRange);\n const yTick = niceInterval(yRange);\n\n // Vertical grid lines + x labels\n const xStart = Math.ceil(xMin / xTick) * xTick;\n for (let x = xStart; x <= xMax; x += xTick) {\n const sx = toSvgX(x);\n if (sx < pad.left || sx > pad.left + plotW) continue;\n if (showGrid) {\n svg += `<line x1=\"${sx}\" y1=\"${pad.top}\" x2=\"${sx}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(x) < 1e-10 ? '0' : (Number.isInteger(x) ? x : x.toFixed(1));\n svg += `<text x=\"${sx}\" y=\"${pad.top + plotH + 16}\" text-anchor=\"middle\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n\n // Horizontal grid lines + y labels\n const yStart = Math.ceil(yMin / yTick) * yTick;\n for (let y = yStart; y <= yMax; y += yTick) {\n const sy = toSvgY(y);\n if (sy < pad.top || sy > pad.top + plotH) continue;\n if (showGrid) {\n svg += `<line x1=\"${pad.left}\" y1=\"${sy}\" x2=\"${pad.left + plotW}\" y2=\"${sy}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(y) < 1e-10 ? '0' : (Number.isInteger(y) ? y : y.toFixed(1));\n svg += `<text x=\"${pad.left - 8}\" y=\"${sy + 3}\" text-anchor=\"end\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n\n // Axes\n if (xMin <= 0 && xMax >= 0) {\n const ax = toSvgX(0);\n svg += `<line x1=\"${ax}\" y1=\"${pad.top}\" x2=\"${ax}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n if (yMin <= 0 && yMax >= 0) {\n const ay = toSvgY(0);\n svg += `<line x1=\"${pad.left}\" y1=\"${ay}\" x2=\"${pad.left + plotW}\" y2=\"${ay}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n\n // Plot border\n svg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"none\" stroke=\"${tk.borderStroke}\" stroke-width=\"1\" />`;\n\n // Equations\n const samplesPerPixel = 2;\n const totalSamples = plotW * samplesPerPixel;\n const dx = xRange / totalSamples;\n\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n\n const fn = parseExpression(eq.expression);\n if (!fn) return;\n\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n let pathData = '';\n let drawing = false;\n\n for (let i = 0; i <= totalSamples; i++) {\n const x = xMin + i * dx;\n let y;\n try { y = fn(x); } catch { y = NaN; }\n\n if (!isFinite(y) || isNaN(y) || y < yMin - yRange * 5 || y > yMax + yRange * 5) {\n drawing = false;\n continue;\n }\n\n // Clamp to plot area for rendering\n const clampedY = Math.max(yMin - yRange * 0.5, Math.min(yMax + yRange * 0.5, y));\n const sx = toSvgX(x);\n const sy = toSvgY(clampedY);\n\n if (!drawing) {\n pathData += `M ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n drawing = true;\n } else {\n pathData += `L ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n }\n }\n\n if (pathData) {\n svg += `<path d=\"${pathData.trim()}\" fill=\"none\" stroke=\"${color}\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />`;\n }\n });\n\n // Clip path for plot area\n const clipId = 'graph-clip-' + Date.now();\n const defs = `<defs><clipPath id=\"${clipId}\"><rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" /></clipPath></defs>`;\n\n // Re-wrap: curves should be clipped\n // Rebuild with clip group\n let curves = '';\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n const fn = parseExpression(eq.expression);\n if (!fn) return;\n\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n let pathData = '';\n let drawing = false;\n\n for (let i = 0; i <= totalSamples; i++) {\n const x = xMin + i * dx;\n let y;\n try { y = fn(x); } catch { y = NaN; }\n\n if (!isFinite(y) || isNaN(y)) { drawing = false; continue; }\n\n const sx = toSvgX(x);\n const sy = toSvgY(y);\n\n if (!drawing) {\n pathData += `M ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n drawing = true;\n } else {\n pathData += `L ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n }\n }\n\n if (pathData) {\n curves += `<path d=\"${pathData.trim()}\" fill=\"none\" stroke=\"${color}\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />`;\n }\n });\n\n // Equation legend\n let legendY = pad.top + 12;\n let legend = '';\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n legend += `<circle cx=\"${pad.left + 12}\" cy=\"${legendY}\" r=\"4\" fill=\"${color}\" />`;\n legend += `<text x=\"${pad.left + 22}\" y=\"${legendY + 3}\" fill=\"${color}\" font-size=\"11\" font-family=\"lixCode, monospace\">${escapeXml(eq.expression)}</text>`;\n legendY += 18;\n });\n\n // Remove the non-clipped curves from svg (we added them above for building)\n // Rebuild cleanly\n let cleanSvg = '';\n cleanSvg += `<rect x=\"0\" y=\"0\" width=\"${width}\" height=\"${height}\" fill=\"${tk.outerBg}\" rx=\"8\" />`;\n cleanSvg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"${tk.plotBg}\" />`;\n\n // Grid + ticks (re-add)\n for (let x = xStart; x <= xMax; x += xTick) {\n const sx = toSvgX(x);\n if (sx < pad.left || sx > pad.left + plotW) continue;\n if (showGrid) {\n cleanSvg += `<line x1=\"${sx}\" y1=\"${pad.top}\" x2=\"${sx}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(x) < 1e-10 ? '0' : (Number.isInteger(x) ? x : x.toFixed(1));\n cleanSvg += `<text x=\"${sx}\" y=\"${pad.top + plotH + 16}\" text-anchor=\"middle\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n for (let y = yStart; y <= yMax; y += yTick) {\n const sy = toSvgY(y);\n if (sy < pad.top || sy > pad.top + plotH) continue;\n if (showGrid) {\n cleanSvg += `<line x1=\"${pad.left}\" y1=\"${sy}\" x2=\"${pad.left + plotW}\" y2=\"${sy}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(y) < 1e-10 ? '0' : (Number.isInteger(y) ? y : y.toFixed(1));\n cleanSvg += `<text x=\"${pad.left - 8}\" y=\"${sy + 3}\" text-anchor=\"end\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n // Axes\n if (xMin <= 0 && xMax >= 0) {\n const ax = toSvgX(0);\n cleanSvg += `<line x1=\"${ax}\" y1=\"${pad.top}\" x2=\"${ax}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n if (yMin <= 0 && yMax >= 0) {\n const ay = toSvgY(0);\n cleanSvg += `<line x1=\"${pad.left}\" y1=\"${ay}\" x2=\"${pad.left + plotW}\" y2=\"${ay}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n // Plot border\n cleanSvg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"none\" stroke=\"${tk.borderStroke}\" stroke-width=\"1\" />`;\n\n // Clipped curves\n cleanSvg += `<g clip-path=\"url(#${clipId})\">${curves}</g>`;\n\n // Legend\n cleanSvg += legend;\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${width}\" height=\"${height}\" viewBox=\"0 0 ${width} ${height}\">${defs}${cleanSvg}</svg>`;\n}\n\n/**\n * Generate a preview SVG for the modal.\n */\nexport function renderGraphPreviewSVG(equations, settings) {\n return renderGraphSVG(equations, {\n ...settings,\n width: 520,\n height: 380,\n });\n}\n\nfunction escapeXml(str) {\n return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\"/g, '"');\n}\n\nexport { GRAPH_COLORS };\n", "/* eslint-disable */\n/**\n * GraphEngine - Bridge between graph rendering and the sketch canvas.\n * Creates Frames containing rendered graph SVG elements.\n */\n\nimport { parseExpression, isValidExpression } from './GraphMathParser.js';\nimport { renderGraphSVG, renderGraphPreviewSVG, GRAPH_COLORS } from './GraphRenderer.js';\n\nconst NS = 'http://www.w3.org/2000/svg';\nconst GRAPH_WIDTH = 600;\nconst GRAPH_HEIGHT = 420;\n\n/**\n * Place a graph on the canvas inside a Frame.\n */\nfunction renderGraphOnCanvas(equations, settings) {\n if (!equations || equations.length === 0) return false;\n if (!window.svg || !window.Frame) {\n console.error('[GraphEngine] Engine not initialized');\n return false;\n }\n\n // Generate full-size SVG\n const svgMarkup = renderGraphSVG(equations, {\n ...settings,\n width: GRAPH_WIDTH,\n height: GRAPH_HEIGHT,\n });\n if (!svgMarkup) return false;\n\n // Viewport center\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\n const frameW = GRAPH_WIDTH + 40;\n const frameH = GRAPH_HEIGHT + 40;\n const frameX = vcx - frameW / 2;\n const frameY = vcy - frameH / 2;\n\n // Build title from equations\n const eqLabels = equations\n .filter(eq => eq.expression && eq.expression.trim())\n .map(eq => eq.expression.trim())\n .slice(0, 3);\n const title = eqLabels.length > 0\n ? 'Graph: ' + eqLabels.join(', ')\n : 'Graph';\n\n // Phase 5 (issue #22): no wrapper frame. The graph is conceptually a\n // single rendering \u2014 axes, grid, curves all interlocked \u2014 so we don't\n // split it into per-curve shapes. Instead the graph becomes ONE\n // first-class shape on the canvas: a `graphShape` that implements the\n // shape API the engine relies on (contains / selectShape / etc.) so\n // it can be selected, dragged, attached to by arrows, picked up by\n // the rect-drag \u2014 exactly like a user-drawn shape.\n try {\n const parser = new DOMParser();\n const doc = parser.parseFromString(svgMarkup, 'image/svg+xml');\n const svgEl = doc.querySelector('svg');\n if (!svgEl) return false;\n\n const graphGroup = document.createElementNS(NS, 'g');\n graphGroup.setAttribute('data-type', 'graph-group');\n graphGroup.setAttribute('transform', `translate(${frameX + 20}, ${frameY + 20})`);\n\n // Copy defs (clip paths)\n const defs = svgEl.querySelector('defs');\n if (defs) {\n const defsClone = defs.cloneNode(true);\n window.svg.querySelector('defs')?.appendChild(defsClone.firstChild) ||\n window.svg.insertBefore(defsClone, window.svg.firstChild);\n }\n\n while (svgEl.childNodes.length > 0) {\n const child = svgEl.childNodes[0];\n if (child.nodeName === 'defs') { svgEl.removeChild(child); continue; }\n graphGroup.appendChild(child);\n }\n window.svg.appendChild(graphGroup);\n\n const graphShape = {\n shapeName: 'graph', // first-class shapeName\n shapeID: `graph-${Date.now().toString(36)}-${Math.floor(Math.random() * 10000)}`,\n group: graphGroup,\n element: graphGroup,\n x: frameX + 20,\n y: frameY + 20,\n width: GRAPH_WIDTH,\n height: GRAPH_HEIGHT,\n rotation: 0,\n isSelected: false,\n _selectionRect: null,\n _graphData: {\n equations: equations.map(eq => ({ expression: eq.expression, color: eq.color })),\n settings: { ...settings },\n },\n\n // \u2500\u2500 Shape API the engine relies on \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 contains(px, py) {\n return px >= this.x && px <= this.x + this.width\n && py >= this.y && py <= this.y + this.height;\n },\n move(dx, dy) {\n this.x += dx; this.y += dy;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y})`);\n this._updateSelectionRect();\n },\n selectShape() {\n this.isSelected = true;\n if (this._selectionRect) return;\n const r = document.createElementNS(NS, 'rect');\n r.setAttribute('fill', 'none');\n r.setAttribute('stroke', '#9b7bf7');\n r.setAttribute('stroke-width', '1.5');\n r.setAttribute('stroke-dasharray', '4 3');\n r.setAttribute('pointer-events', 'none');\n window.svg.appendChild(r);\n this._selectionRect = r;\n this._updateSelectionRect();\n },\n removeSelection() {\n this.isSelected = false;\n if (this._selectionRect && this._selectionRect.parentNode) {\n this._selectionRect.parentNode.removeChild(this._selectionRect);\n }\n this._selectionRect = null;\n },\n _updateSelectionRect() {\n if (!this._selectionRect) return;\n const pad = 4;\n this._selectionRect.setAttribute('x', this.x - pad);\n this._selectionRect.setAttribute('y', this.y - pad);\n this._selectionRect.setAttribute('width', this.width + pad * 2);\n this._selectionRect.setAttribute('height', this.height + pad * 2);\n },\n updateAttachedArrows() {\n if (typeof window.updateAttachedArrows === 'function') {\n window.updateAttachedArrows(this);\n }\n },\n adaptToBackground(background, foreground, muted) {\n const ensureContrast = window.__ensureCanvasContrast || ((color) => color);\n\n this.group.querySelectorAll('rect').forEach((rect) => {\n const fill = rect.getAttribute('fill');\n const stroke = rect.getAttribute('stroke');\n if (fill && fill !== 'none') rect.setAttribute('fill', background);\n if (stroke && stroke !== 'none') {\n rect.setAttribute('stroke', muted);\n rect.setAttribute('stroke-opacity', '0.45');\n }\n });\n\n this.group.querySelectorAll('line').forEach((line) => {\n const width = Number.parseFloat(line.getAttribute('stroke-width') || '1');\n line.setAttribute('stroke', foreground);\n line.setAttribute('stroke-opacity', width <= 0.5 ? '0.18' : '0.5');\n });\n\n this.group.querySelectorAll('path[stroke]').forEach((path) => {\n const original = path.dataset.graphColor || path.getAttribute('stroke');\n if (!original || original === 'none') return;\n path.dataset.graphColor = original;\n path.setAttribute('stroke', ensureContrast(original, background, 3));\n });\n\n this.group.querySelectorAll('circle[fill]').forEach((circle) => {\n const original = circle.dataset.graphColor || circle.getAttribute('fill');\n if (!original || original === 'none') return;\n circle.dataset.graphColor = original;\n circle.setAttribute('fill', ensureContrast(original, background, 3));\n });\n\n this.group.querySelectorAll('text').forEach((text) => {\n const original = text.dataset.graphColor || text.getAttribute('fill');\n if (original) text.dataset.graphColor = original;\n const isAxisLabel = !original || ['#8b949e', '#62627a'].includes(original.toLowerCase());\n text.setAttribute('fill', isAxisLabel\n ? muted\n : ensureContrast(original, background, 4.5));\n });\n },\n };\n\n window.shapes.push(graphShape);\n if (window.pushCreateAction) window.pushCreateAction(graphShape);\n\n // Auto-select so the user sees something landed.\n window.currentShape = graphShape;\n graphShape.selectShape();\n window.__adaptCanvasContrast?.(\n window.getComputedStyle(window.svg).backgroundColor || '#13171C'\n );\n } catch (err) {\n console.error('[GraphEngine] SVG insertion failed:', err);\n return false;\n }\n\n return true;\n}\n\n/**\n * Initialize the graph engine \u2014 expose bridge functions on window.\n */\nexport function initGraphEngine() {\n window.__graphPreview = (equations, settings) => {\n return renderGraphPreviewSVG(equations, settings);\n };\n window.__graphRenderer = renderGraphOnCanvas;\n window.__graphParser = (expr) => {\n const fn = parseExpression(expr);\n return fn ? true : false;\n };\n window.__graphValidate = isValidExpression;\n window.__graphColors = GRAPH_COLORS;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAQA,IAAM,eAAe;AAAA,EACjB;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAC5C;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAChD;AAOA,SAAS,mBAAmB;AACxB,QAAM,SAAS,OAAO,aAAa,eAC5B,SAAS,QACT,SAAS,KAAK,UAAU,SAAS,YAAY;AACpD,MAAI,QAAQ;AACR,WAAO;AAAA,MACH,SAAW;AAAA,MACX,QAAW;AAAA,MACX,YAAW;AAAA,MACX,YAAW;AAAA,MACX,cAAa;AAAA,MACb,WAAW;AAAA,IACf;AAAA,EACJ;AACA,SAAO;AAAA,IACH,SAAW;AAAA,IACX,QAAW;AAAA,IACX,YAAW;AAAA,IACX,YAAW;AAAA,IACX,cAAa;AAAA,IACb,WAAW;AAAA,EACf;AACJ;AAKA,SAAS,aAAa,OAAO;AACzB,QAAM,QAAQ,QAAQ;AACtB,QAAM,MAAM,KAAK,IA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AK,OAAO;AAAA,EACvB;AACA,SAAO,kBAAkB;AACzB,SAAO,gBAAgB;AAC3B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/react/{MermaidStructuredRenderer-GGOOGON5.js → MermaidStructuredRenderer-26WGA6YD.js}
RENAMED
|
@@ -3,16 +3,26 @@
|
|
|
3
3
|
// src/core/MermaidStructuredRenderer.js
|
|
4
4
|
var NS = "http://www.w3.org/2000/svg";
|
|
5
5
|
var PALETTE = [
|
|
6
|
-
{ fill: "#
|
|
7
|
-
{ fill: "#
|
|
8
|
-
{ fill: "#
|
|
9
|
-
{ fill: "#
|
|
10
|
-
{ fill: "#
|
|
11
|
-
{ fill: "#
|
|
6
|
+
{ fill: "#8b7abb", stroke: "#665793" },
|
|
7
|
+
{ fill: "#a992cf", stroke: "#7762a6" },
|
|
8
|
+
{ fill: "#c2addc", stroke: "#8974aa" },
|
|
9
|
+
{ fill: "#7765a6", stroke: "#584883" },
|
|
10
|
+
{ fill: "#9d83c1", stroke: "#725b9a" },
|
|
11
|
+
{ fill: "#d1c3e7", stroke: "#927daf" }
|
|
12
12
|
];
|
|
13
13
|
function escapeXml(value) {
|
|
14
14
|
return String(value ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
15
15
|
}
|
|
16
|
+
function contrastText(fill) {
|
|
17
|
+
const raw = String(fill || "").replace("#", "");
|
|
18
|
+
const hex = raw.length === 3 ? raw.split("").map((char) => char + char).join("") : raw;
|
|
19
|
+
if (!/^[0-9a-f]{6}$/i.test(hex)) return theme().text;
|
|
20
|
+
const red = parseInt(hex.slice(0, 2), 16);
|
|
21
|
+
const green = parseInt(hex.slice(2, 4), 16);
|
|
22
|
+
const blue = parseInt(hex.slice(4, 6), 16);
|
|
23
|
+
const luminance = 0.299 * red + 0.587 * green + 0.114 * blue;
|
|
24
|
+
return luminance > 145 ? "#34304a" : "#ffffff";
|
|
25
|
+
}
|
|
16
26
|
function isDark() {
|
|
17
27
|
return typeof document !== "undefined" && document.body?.classList.contains("theme-dark");
|
|
18
28
|
}
|
|
@@ -117,7 +127,7 @@ function renderERPreviewSVG(diagram) {
|
|
|
117
127
|
for (const entity of entities) {
|
|
118
128
|
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"/>`;
|
|
119
129
|
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"/>`;
|
|
120
|
-
content += `<text x="${entity.x + entity.width / 2}" y="${entity.y + 27}" text-anchor="middle" fill="
|
|
130
|
+
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>`;
|
|
121
131
|
const attributes = entity.attributes.length ? entity.attributes : [{ type: "", name: "No attributes", key: "" }];
|
|
122
132
|
attributes.forEach((attribute, row) => {
|
|
123
133
|
const y = entity.y + entity.headerHeight + row * entity.rowHeight;
|
|
@@ -169,6 +179,31 @@ function renderChartPreviewSVG(chart) {
|
|
|
169
179
|
const TK = theme();
|
|
170
180
|
const width = 720;
|
|
171
181
|
const height = 450;
|
|
182
|
+
if (chart.kind === "pie") {
|
|
183
|
+
const values2 = chart.series[0].values.map((value) => Math.max(0, value));
|
|
184
|
+
const total = values2.reduce((sum, value) => sum + value, 0);
|
|
185
|
+
if (total <= 0) return "";
|
|
186
|
+
const cx = 255;
|
|
187
|
+
const cy = 235;
|
|
188
|
+
const radius = 145;
|
|
189
|
+
let startAngle = -Math.PI / 2;
|
|
190
|
+
let content2 = `<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>`;
|
|
191
|
+
values2.forEach((value, index) => {
|
|
192
|
+
const endAngle = startAngle + value / total * Math.PI * 2;
|
|
193
|
+
const x1 = cx + Math.cos(startAngle) * radius;
|
|
194
|
+
const y1 = cy + Math.sin(startAngle) * radius;
|
|
195
|
+
const x2 = cx + Math.cos(endAngle) * radius;
|
|
196
|
+
const y2 = cy + Math.sin(endAngle) * radius;
|
|
197
|
+
const largeArc = endAngle - startAngle > Math.PI ? 1 : 0;
|
|
198
|
+
const color = PALETTE[index % PALETTE.length];
|
|
199
|
+
content2 += `<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"/>`;
|
|
200
|
+
const percent = Math.round(value / total * 100);
|
|
201
|
+
const legendY = 125 + index * 42;
|
|
202
|
+
content2 += `<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>`;
|
|
203
|
+
startAngle = endAngle;
|
|
204
|
+
});
|
|
205
|
+
return `<svg xmlns="${NS}" width="600" height="450" viewBox="0 0 ${width} ${height}">${content2}</svg>`;
|
|
206
|
+
}
|
|
172
207
|
const left = 70;
|
|
173
208
|
const top = 60;
|
|
174
209
|
const plotWidth = 580;
|
|
@@ -206,6 +241,28 @@ function push(shape, frame) {
|
|
|
206
241
|
if (frame?.addShapeToFrame) frame.addShapeToFrame(shape);
|
|
207
242
|
return shape;
|
|
208
243
|
}
|
|
244
|
+
function pushText(text, x, y, fontSize, fill, frame) {
|
|
245
|
+
if (!window.TextShape || !window.svg) return null;
|
|
246
|
+
const group = document.createElementNS(NS, "g");
|
|
247
|
+
group.setAttribute("data-type", "text-group");
|
|
248
|
+
group.setAttribute("transform", `translate(${x}, ${y})`);
|
|
249
|
+
group.setAttribute("data-x", x);
|
|
250
|
+
group.setAttribute("data-y", y);
|
|
251
|
+
const element = document.createElementNS(NS, "text");
|
|
252
|
+
element.setAttribute("x", 0);
|
|
253
|
+
element.setAttribute("y", 0);
|
|
254
|
+
element.setAttribute("dominant-baseline", "central");
|
|
255
|
+
element.setAttribute("fill", fill);
|
|
256
|
+
element.setAttribute("font-size", fontSize);
|
|
257
|
+
element.setAttribute("font-family", "lixFont, sans-serif");
|
|
258
|
+
element.setAttribute("data-initial-font", "lixFont");
|
|
259
|
+
element.setAttribute("data-initial-color", fill);
|
|
260
|
+
element.setAttribute("data-initial-size", `${fontSize}px`);
|
|
261
|
+
element.textContent = text;
|
|
262
|
+
group.appendChild(element);
|
|
263
|
+
window.svg.appendChild(group);
|
|
264
|
+
return push(new window.TextShape(group), frame);
|
|
265
|
+
}
|
|
209
266
|
function canvasOrigin(width, height) {
|
|
210
267
|
const vb = window.currentViewBox || { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight };
|
|
211
268
|
return { x: vb.x + vb.width / 2 - width / 2, y: vb.y + vb.height / 2 - height / 2 };
|
|
@@ -223,6 +280,16 @@ function createFrame(x, y, width, height, name, type) {
|
|
|
223
280
|
push(frame);
|
|
224
281
|
return frame;
|
|
225
282
|
}
|
|
283
|
+
function selectOnlyFrame(frame) {
|
|
284
|
+
if (!frame) return;
|
|
285
|
+
if (window.multiSelection?.clearSelection) window.multiSelection.clearSelection();
|
|
286
|
+
if (window.currentShape && window.currentShape !== frame && typeof window.currentShape.removeSelection === "function") {
|
|
287
|
+
window.currentShape.removeSelection();
|
|
288
|
+
}
|
|
289
|
+
if (window.__deselectTextElement) window.__deselectTextElement();
|
|
290
|
+
window.currentShape = frame;
|
|
291
|
+
if (typeof frame.selectFrame === "function") frame.selectFrame();
|
|
292
|
+
}
|
|
226
293
|
function renderEROnCanvas(diagram) {
|
|
227
294
|
if (!diagram?.entities?.length || !window.Rectangle || !window.Arrow || !window.Frame) return false;
|
|
228
295
|
const TK = theme();
|
|
@@ -243,7 +310,7 @@ function renderEROnCanvas(diagram) {
|
|
|
243
310
|
fillStyle: "solid",
|
|
244
311
|
roughness: 1,
|
|
245
312
|
label: entity.name,
|
|
246
|
-
labelColor:
|
|
313
|
+
labelColor: contrastText(entity.color.fill),
|
|
247
314
|
labelFontSize: 15
|
|
248
315
|
}), frame);
|
|
249
316
|
if (!first) first = header;
|
|
@@ -291,7 +358,8 @@ function renderEROnCanvas(diagram) {
|
|
|
291
358
|
return true;
|
|
292
359
|
}
|
|
293
360
|
function renderChartOnCanvas(chart) {
|
|
294
|
-
if (!chart?.series?.length || !window.Rectangle || !window.Circle || !window.Line || !window.Frame) return false;
|
|
361
|
+
if (!chart?.series?.length || !window.Rectangle || !window.Circle || !window.Line || !window.FreehandStroke || !window.Frame) return false;
|
|
362
|
+
if (chart.kind === "pie") return renderPieOnCanvas(chart);
|
|
295
363
|
const TK = theme();
|
|
296
364
|
const width = 720;
|
|
297
365
|
const height = 450;
|
|
@@ -304,35 +372,40 @@ function renderChartOnCanvas(chart) {
|
|
|
304
372
|
const values = chart.series.flatMap((series) => series.values);
|
|
305
373
|
const maximum = Math.max(1, ...values.map(Math.abs));
|
|
306
374
|
const slot = plotWidth / Math.max(1, chart.categories.length);
|
|
307
|
-
let first = null;
|
|
308
375
|
push(new window.Line({ x: left, y: top }, { x: left, y: top + plotHeight }, { stroke: TK.line, strokeWidth: 1.5, roughness: 0 }), frame);
|
|
309
376
|
push(new window.Line({ x: left, y: top + plotHeight }, { x: left + plotWidth, y: top + plotHeight }, { stroke: TK.line, strokeWidth: 1.5, roughness: 0 }), frame);
|
|
310
377
|
chart.series.forEach((series, seriesIndex) => {
|
|
311
378
|
const color = PALETTE[seriesIndex % PALETTE.length];
|
|
312
379
|
if (series.kind === "line") {
|
|
313
|
-
|
|
314
|
-
series.values.forEach((value, index) => {
|
|
380
|
+
const linePoints = series.values.map((value, index) => {
|
|
315
381
|
const point = { x: left + slot * (index + 0.5), y: top + plotHeight - Math.abs(value) / maximum * plotHeight };
|
|
316
|
-
|
|
382
|
+
push(new window.Circle(point.x, point.y, 8, 8, {
|
|
317
383
|
stroke: color.stroke,
|
|
318
384
|
strokeWidth: 2,
|
|
319
385
|
fill: color.fill,
|
|
320
386
|
fillStyle: "solid",
|
|
321
387
|
roughness: 0.5,
|
|
322
388
|
label: String(value),
|
|
323
|
-
labelColor:
|
|
389
|
+
labelColor: contrastText(color.fill),
|
|
324
390
|
labelFontSize: 9
|
|
325
391
|
}), frame);
|
|
326
|
-
|
|
327
|
-
if (previous) push(new window.Line(previous, point, { stroke: color.stroke, strokeWidth: 3, roughness: 0.5 }), frame);
|
|
328
|
-
previous = point;
|
|
392
|
+
return [point.x, point.y, 0.5];
|
|
329
393
|
});
|
|
394
|
+
if (linePoints.length > 1) {
|
|
395
|
+
push(new window.FreehandStroke(linePoints, {
|
|
396
|
+
stroke: color.stroke,
|
|
397
|
+
strokeWidth: 3,
|
|
398
|
+
thinning: 0,
|
|
399
|
+
roughness: 0,
|
|
400
|
+
strokeStyle: "solid"
|
|
401
|
+
}), frame);
|
|
402
|
+
}
|
|
330
403
|
} else {
|
|
331
404
|
const barWidth = Math.max(18, slot * 0.7 / chart.series.length);
|
|
332
405
|
series.values.forEach((value, index) => {
|
|
333
406
|
const barHeight = Math.max(8, Math.abs(value) / maximum * plotHeight);
|
|
334
407
|
const x = left + slot * index + slot * 0.15 + seriesIndex * barWidth;
|
|
335
|
-
|
|
408
|
+
push(new window.Rectangle(x, top + plotHeight - barHeight, barWidth, barHeight, {
|
|
336
409
|
stroke: color.stroke,
|
|
337
410
|
strokeWidth: 1.5,
|
|
338
411
|
fill: color.fill,
|
|
@@ -340,17 +413,71 @@ function renderChartOnCanvas(chart) {
|
|
|
340
413
|
roughness: 0.7,
|
|
341
414
|
label: `${chart.categories[index] || index + 1}
|
|
342
415
|
${value}`,
|
|
343
|
-
labelColor:
|
|
416
|
+
labelColor: contrastText(color.fill),
|
|
344
417
|
labelFontSize: 11
|
|
345
418
|
}), frame);
|
|
346
|
-
if (!first) first = bar;
|
|
347
419
|
});
|
|
348
420
|
}
|
|
349
421
|
});
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
422
|
+
selectOnlyFrame(frame);
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
function renderPieOnCanvas(chart) {
|
|
426
|
+
if (!window.FreehandStroke || !window.TextShape) return false;
|
|
427
|
+
const width = 720;
|
|
428
|
+
const height = 450;
|
|
429
|
+
const origin = canvasOrigin(width, height);
|
|
430
|
+
const frame = createFrame(origin.x, origin.y, width, height, chart.title, "mermaid-pie");
|
|
431
|
+
const values = chart.series[0].values.map((value) => Math.max(0, value));
|
|
432
|
+
const total = values.reduce((sum, value) => sum + value, 0);
|
|
433
|
+
if (total <= 0) return false;
|
|
434
|
+
const cx = origin.x + 255;
|
|
435
|
+
const cy = origin.y + 235;
|
|
436
|
+
const radius = 145;
|
|
437
|
+
let startAngle = -Math.PI / 2;
|
|
438
|
+
values.forEach((value, index) => {
|
|
439
|
+
const sweep = value / total * Math.PI * 2;
|
|
440
|
+
const endAngle = startAngle + sweep;
|
|
441
|
+
const steps = Math.max(6, Math.ceil(sweep / (Math.PI / 60)));
|
|
442
|
+
const points = [[cx, cy, 0.5]];
|
|
443
|
+
for (let step = 0; step <= steps; step++) {
|
|
444
|
+
const angle = startAngle + sweep * (step / steps);
|
|
445
|
+
points.push([
|
|
446
|
+
cx + Math.cos(angle) * radius,
|
|
447
|
+
cy + Math.sin(angle) * radius,
|
|
448
|
+
0.5
|
|
449
|
+
]);
|
|
450
|
+
}
|
|
451
|
+
const color = PALETTE[index % PALETTE.length];
|
|
452
|
+
push(new window.FreehandStroke(points, {
|
|
453
|
+
stroke: color.fill,
|
|
454
|
+
strokeWidth: 3,
|
|
455
|
+
outlineStroke: theme().bg,
|
|
456
|
+
outlineWidth: 3,
|
|
457
|
+
closedFill: true,
|
|
458
|
+
roughness: 0,
|
|
459
|
+
strokeStyle: "solid"
|
|
460
|
+
}), frame);
|
|
461
|
+
const percent = Math.round(value / total * 100);
|
|
462
|
+
const legendY = origin.y + 125 + index * 42;
|
|
463
|
+
push(new window.Rectangle(origin.x + 460, legendY - 14, 18, 18, {
|
|
464
|
+
stroke: color.stroke,
|
|
465
|
+
strokeWidth: 1,
|
|
466
|
+
fill: color.fill,
|
|
467
|
+
fillStyle: "solid",
|
|
468
|
+
roughness: 0.5
|
|
469
|
+
}), frame);
|
|
470
|
+
pushText(
|
|
471
|
+
`${chart.categories[index] || index + 1} \u2014 ${value} (${percent}%)`,
|
|
472
|
+
origin.x + 488,
|
|
473
|
+
legendY,
|
|
474
|
+
12,
|
|
475
|
+
theme().text,
|
|
476
|
+
frame
|
|
477
|
+
);
|
|
478
|
+
startAngle = endAngle;
|
|
479
|
+
});
|
|
480
|
+
selectOnlyFrame(frame);
|
|
354
481
|
return true;
|
|
355
482
|
}
|
|
356
483
|
export {
|
|
@@ -362,4 +489,4 @@ export {
|
|
|
362
489
|
renderEROnCanvas,
|
|
363
490
|
renderERPreviewSVG
|
|
364
491
|
};
|
|
365
|
-
//# sourceMappingURL=MermaidStructuredRenderer-
|
|
492
|
+
//# sourceMappingURL=MermaidStructuredRenderer-26WGA6YD.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 return typeof document !== 'undefined' && document.body?.classList.contains('theme-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\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 values = chart.series.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 chart.series.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 / chart.series.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) {\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('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, frameName: name,\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: 1,\n label: entity.name, labelColor: contrastText(entity.color.fill), labelFontSize: 15,\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: .4,\n label: [attribute.type, attribute.name, attribute.key].filter(Boolean).join(' '), labelColor: TK.text, labelFontSize: 11 }\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 start = { x: from.x + from.width / 2, y: from.y + from.height / 2 };\n const end = { x: to.x + to.width / 2, y: to.y + to.height / 2 };\n const arrow = push(new window.Arrow(start, end, {\n stroke: TK.line, strokeWidth: 1.5, roughness: 1,\n label: `${relation.fromCardinality} ${relation.label} ${relation.toCardinality}`, labelColor: TK.text,\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\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 values = chart.series.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 chart.series.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, fillStyle: 'solid', roughness: .5,\n label: String(value), labelColor: contrastText(color.fill), labelFontSize: 9,\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 / chart.series.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, fillStyle: 'solid', roughness: .7,\n label: `${chart.categories[index] || index + 1}\\n${value}`, labelColor: contrastText(color.fill), labelFontSize: 11,\n }), frame);\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
|
+
"mappings": ";;;AASA,IAAM,KAAK;AACX,IAAM,UAAU;AAAA,EACZ,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EACrC,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EACrC,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EACrC,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EACrC,EAAE,MAAM,WAAW,QAAQ,UAAU;AAAA,EACrC,EAAE,MAAM,WAAW,QAAQ,UAAU;AACzC;AAEA,SAAS,UAAU,OAAO;AACtB,SAAO,OAAO,SAAS,EAAE,EACpB,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAAQ;AAC/B;AAEA,SAAS,aAAa,MAAM;AACxB,QAAM,MAAM,OAAO,QAAQ,EAAE,EAAE,QAAQ,KAAK,EAAE;AAC9C,QAAM,MAAM,IAAI,WAAW,IAAI,IAAI,MAAM,EAAE,EAAE,IAAI,UAAQ,OAAO,IAAI,EAAE,KAAK,EAAE,IAAI;AACjF,MAAI,CAAC,iBAAiB,KAAK,GAAG,EAAG,QAAO,MAAM,EAAE;AAChD,QAAM,MAAM,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE;AACxC,QAAM,QAAQ,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE;AAC1C,QAAM,OAAO,SAAS,IAAI,MAAM,GAAG,CAAC,GAAG,EAAE;AACzC,QAAM,YAAY,QAAO,MAAM,QAAO,QAAQ,QAAO;AACrD,SAAO,YAAY,MAAM,YAAY;AACzC;AAEA,SAAS,S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AAK,OAAO;AAAA,MAC9D,OAAO,IAAI;AAAA,MACX;AAAA,MACA;AAAA,MACA,MAAM,EAAE;AAAA,MACR;AAAA,IACJ;AACA,iBAAa;AAAA,EACjB,CAAC;AAED,kBAAgB,KAAK;AACrB,SAAO;AACX;",
|
|
6
|
+
"names": ["title", "values", "content"]
|
|
7
|
+
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-BU4D2WYQ.js";
|
|
14
14
|
import {
|
|
15
15
|
FreehandStroke
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ABZEV54U.js";
|
|
17
17
|
import {
|
|
18
18
|
Rectangle
|
|
19
19
|
} from "./chunk-T6ZVV5ZO.js";
|
|
@@ -736,4 +736,4 @@ export {
|
|
|
736
736
|
uploadScene,
|
|
737
737
|
validateScene
|
|
738
738
|
};
|
|
739
|
-
//# sourceMappingURL=SceneSerializer-
|
|
739
|
+
//# sourceMappingURL=SceneSerializer-3RWFYSLY.js.map
|