@avodado/render 0.2.3 → 0.2.4

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 CHANGED
@@ -3645,7 +3645,7 @@ function renderUml(data) {
3645
3645
  const n = g.node(c.id);
3646
3646
  if (n !== void 0) at2.set(c.id, { x: n.x - colW / 2, y: n.y - clsH(c) / 2 });
3647
3647
  }
3648
- let s = `<svg viewBox="0 0 ${width} ${height}" role="img"><title>UML class diagram</title><defs><marker id="umlTri" viewBox="0 0 14 14" refX="13" refY="7" markerWidth="15" markerHeight="15" orient="auto-start-reverse"><path d="M1,1 L13,7 L1,13 z" fill="var(--white)" stroke="var(--charcoal)" stroke-width="1.2"/></marker><marker id="umlDiaF" viewBox="0 0 20 12" refX="19" refY="6" markerWidth="20" markerHeight="12" orient="auto-start-reverse"><path d="M1,6 L10,1 L19,6 L10,11 z" fill="var(--charcoal)"/></marker><marker id="umlDiaH" viewBox="0 0 20 12" refX="19" refY="6" markerWidth="20" markerHeight="12" orient="auto-start-reverse"><path d="M1,6 L10,1 L19,6 L10,11 z" fill="var(--white)" stroke="var(--charcoal)" stroke-width="1.2"/></marker><marker id="umlOpen" viewBox="0 0 12 12" refX="10" refY="6" markerWidth="12" markerHeight="12" orient="auto-start-reverse"><path d="M1,1 L11,6 L1,11" fill="none" stroke="var(--charcoal)" stroke-width="1.3"/></marker></defs>`;
3648
+ let s = `<svg viewBox="0 0 ${width} ${height}" role="img"><title>UML class diagram</title><defs><marker id="umlTri" viewBox="0 0 14 14" refX="13" refY="7" markerWidth="11" markerHeight="11" orient="auto-start-reverse"><path d="M1,1 L13,7 L1,13 z" fill="var(--white)" stroke="var(--charcoal)" stroke-width="1.2"/></marker><marker id="umlDiaF" viewBox="0 0 20 12" refX="19" refY="6" markerWidth="13" markerHeight="8" orient="auto-start-reverse"><path d="M1,6 L10,1 L19,6 L10,11 z" fill="var(--charcoal)"/></marker><marker id="umlDiaH" viewBox="0 0 20 12" refX="19" refY="6" markerWidth="13" markerHeight="8" orient="auto-start-reverse"><path d="M1,6 L10,1 L19,6 L10,11 z" fill="var(--white)" stroke="var(--charcoal)" stroke-width="1.2"/></marker><marker id="umlOpen" viewBox="0 0 12 12" refX="10" refY="6" markerWidth="10" markerHeight="10" orient="auto-start-reverse"><path d="M1,1 L11,6 L1,11" fill="none" stroke="var(--charcoal)" stroke-width="1.3"/></marker></defs>`;
3649
3649
  const labels = [];
3650
3650
  validRels.forEach((rl, i) => {
3651
3651
  const e = g.edge(rl.from, rl.to, `e${i}`);
@@ -4028,10 +4028,10 @@ function renderGrid(data) {
4028
4028
  h: cellH
4029
4029
  });
4030
4030
  const groupRect = (g) => ({
4031
- x: xOf(g.col) - 16,
4032
- y: yOf(g.row) - 22,
4033
- w: (g.cols ?? 1) * cellW + ((g.cols ?? 1) - 1) * gapX + 32,
4034
- h: (g.rows ?? 1) * cellH + ((g.rows ?? 1) - 1) * gapY + 38
4031
+ x: xOf(g.col) - 22,
4032
+ y: yOf(g.row) - 30,
4033
+ w: (g.cols ?? 1) * cellW + ((g.cols ?? 1) - 1) * gapX + 44,
4034
+ h: (g.rows ?? 1) * cellH + ((g.rows ?? 1) - 1) * gapY + 54
4035
4035
  });
4036
4036
  const byId = new Map(nodes.map((n) => [n.id, n]));
4037
4037
  const width = padX * 2 + cols * cellW + (cols - 1) * gapX;
@@ -4062,14 +4062,11 @@ function renderGrid(data) {
4062
4062
  for (const n of nodes) {
4063
4063
  const r = rectFor2(n);
4064
4064
  const st2 = blockStyle(n.kind);
4065
- const badge = 38;
4066
- const bx = r.x + 13;
4067
- const by = r.y + (r.h - badge) / 2;
4068
- const glyph = nodeGlyph(n.kind, bx + 11, by + 11, "var(--white)");
4069
- const badgeInner = glyph.length > 0 ? glyph : `<text x="${bx + badge / 2}" y="${by + badge / 2 + 5}" text-anchor="middle" font-family="var(--font-display)" font-size="16" font-weight="700" fill="var(--white)">${escapeHtml((n.name ?? "?").slice(0, 1).toUpperCase())}</text>`;
4070
- const tx = bx + badge + 13;
4071
- const hasTech = n.tech !== void 0;
4072
- s += `<g filter="url(#gshadow)"><rect x="${r.x}" y="${r.y}" width="${r.w}" height="${r.h}" rx="12" fill="var(--white)" stroke="var(--rule)" stroke-width="1"/><rect x="${bx}" y="${by}" width="${badge}" height="${badge}" rx="10" fill="${st2.accent}"/>` + badgeInner + `<text x="${tx}" y="${r.y + r.h / 2 + (hasTech ? -3 : 5)}" class="blk-name" fill="var(--charcoal)">${escapeHtml(n.name)}</text>` + (hasTech ? `<text x="${tx}" y="${r.y + r.h / 2 + 14}" class="blk-tech" fill="${st2.accent}">${escapeHtml(n.tech)}</text>` : "") + `</g>`;
4065
+ const gl = nodeGlyph(n.kind, r.x + 16, r.y + 16, st2.accent);
4066
+ const nx = gl.length > 0 ? r.x + 42 : r.x + 16;
4067
+ const chip = gl.length === 0 && n.kind !== void 0 ? `<text x="${r.x + 16}" y="${r.y + 22}" class="blk-chip" fill="${st2.accent}">${escapeHtml(n.kind)}</text>` : "";
4068
+ const tech = n.tech !== void 0 ? `<text x="${nx}" y="${r.y + (gl.length > 0 ? 50 : 60)}" class="blk-tech" fill="${st2.accent}">${escapeHtml(n.tech)}</text>` : "";
4069
+ s += `<g filter="url(#gshadow)"><path d="${rectRoundRight(r.x, r.y, r.w, r.h, 9)}" fill="${st2.fill}" stroke="${st2.accent}" stroke-width="1.2"/><rect x="${r.x}" y="${r.y}" width="5" height="${r.h}" fill="${st2.accent}"/>` + gl + chip + `<text x="${nx}" y="${r.y + (gl.length > 0 ? 34 : 44)}" class="blk-name" fill="${st2.text}">${escapeHtml(n.name)}</text>` + tech + `</g>`;
4073
4070
  }
4074
4071
  s += labels.join("");
4075
4072
  s += `</svg>`;