@avodado/render 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4006,11 +4006,11 @@ function renderGrid(data) {
|
|
|
4006
4006
|
const edges = data.edges ?? [];
|
|
4007
4007
|
const cellW = 178;
|
|
4008
4008
|
const cellH = 80;
|
|
4009
|
-
const gapX =
|
|
4010
|
-
const gapY =
|
|
4011
|
-
const padX =
|
|
4012
|
-
const padTop =
|
|
4013
|
-
const padBot =
|
|
4009
|
+
const gapX = 64;
|
|
4010
|
+
const gapY = 68;
|
|
4011
|
+
const padX = 38;
|
|
4012
|
+
const padTop = 52;
|
|
4013
|
+
const padBot = 36;
|
|
4014
4014
|
const cols = Math.max(
|
|
4015
4015
|
1,
|
|
4016
4016
|
...nodes.map((n) => (n.col ?? 1) + ((n.w ?? 1) - 1)),
|
|
@@ -4030,10 +4030,10 @@ function renderGrid(data) {
|
|
|
4030
4030
|
h: cellH
|
|
4031
4031
|
});
|
|
4032
4032
|
const groupRect = (g) => ({
|
|
4033
|
-
x: xOf(g.col) -
|
|
4034
|
-
y: yOf(g.row) -
|
|
4035
|
-
w: (g.cols ?? 1) * cellW + ((g.cols ?? 1) - 1) * gapX +
|
|
4036
|
-
h: (g.rows ?? 1) * cellH + ((g.rows ?? 1) - 1) * gapY +
|
|
4033
|
+
x: xOf(g.col) - 28,
|
|
4034
|
+
y: yOf(g.row) - 38,
|
|
4035
|
+
w: (g.cols ?? 1) * cellW + ((g.cols ?? 1) - 1) * gapX + 56,
|
|
4036
|
+
h: (g.rows ?? 1) * cellH + ((g.rows ?? 1) - 1) * gapY + 66
|
|
4037
4037
|
});
|
|
4038
4038
|
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
4039
4039
|
const width = padX * 2 + cols * cellW + (cols - 1) * gapX;
|
|
@@ -4044,12 +4044,8 @@ function renderGrid(data) {
|
|
|
4044
4044
|
let s = `<svg viewBox="0 0 ${width} ${height}" role="img"><title>Block diagram</title>`;
|
|
4045
4045
|
for (const g of sortedGroups) {
|
|
4046
4046
|
const r = groupRect(g);
|
|
4047
|
-
const col = safeColor(g.color, "#
|
|
4048
|
-
|
|
4049
|
-
const isContainer = (g.cols ?? 1) >= 2 && (g.rows ?? 1) >= 2;
|
|
4050
|
-
const zone = `<rect x="${r.x}" y="${r.y}" width="${r.w}" height="${r.h}" rx="10" fill="${col}" fill-opacity="0.06" stroke="${col}" stroke-opacity="0.55" stroke-width="1.3" stroke-dasharray="7 5"/>`;
|
|
4051
|
-
const label = isContainer ? `<rect x="${r.x + (r.w - badgeW) / 2}" y="${r.y - 1}" width="${badgeW}" height="20" rx="10" fill="${col}"/><text x="${r.x + r.w / 2}" y="${r.y + 13}" class="grp-label" fill="#fff" text-anchor="middle">${escapeHtml(g.label)}</text>` : `<path d="M${r.x} ${r.y + 20} L${r.x} ${r.y + 10} a10 10 0 0 1 10 -10 h${badgeW - 10} v20 z" fill="${col}"/><text x="${r.x + badgeW / 2}" y="${r.y + 14}" class="grp-label" fill="#fff" text-anchor="middle">${escapeHtml(g.label)}</text>`;
|
|
4052
|
-
s += `<g>${zone}${label}</g>`;
|
|
4047
|
+
const col = safeColor(g.color, "#475569");
|
|
4048
|
+
s += `<g><rect x="${r.x}" y="${r.y}" width="${r.w}" height="${r.h}" rx="12" fill="none" stroke="${col}" stroke-opacity="0.6" stroke-width="1.3" stroke-dasharray="7 5"/><text x="${r.x + 16}" y="${r.y + 19}" class="grp-label" fill="${col}">${escapeHtml(g.label)}</text></g>`;
|
|
4053
4049
|
}
|
|
4054
4050
|
const labels = [];
|
|
4055
4051
|
for (const e of edges) {
|