sad-mcp 2.3.4 → 2.3.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sad-mcp",
3
- "version": "2.3.4",
3
+ "version": "2.3.5",
4
4
  "description": "MCP server for Software Analysis and Design course materials at BGU",
5
5
  "type": "module",
6
6
  "bin": {
@@ -207,10 +207,10 @@ Font: 'IBM Plex Mono', monospace (Google Fonts import)
207
207
 
208
208
  ## 7. Legend Bar
209
209
 
210
- Include at the bottom of every SVG:
210
+ Include at the bottom of every SVG (no dependency entry — dependencies are not used, §3):
211
211
  ```
212
- ── Association ◇── Aggregation ◆── Composition ──▷ Generalization --→ Dependency
213
- Multiplicity at both ends | italic = operations
212
+ ── Association ◇── Aggregation ◆── Composition ──▷ Generalization
213
+ Multiplicity at both ends (rendered outside both boxes) | italic = operations
214
214
  ```
215
215
 
216
216
  ---
@@ -385,13 +385,18 @@ function svgRel(rel) {
385
385
  // 'assoc': no markers — plain line
386
386
 
387
387
  let s = `<polyline points="${pts}" fill="none" stroke="#334155" stroke-width="1.8" ${dash} ${mS} ${mE}/>`;
388
- if (rel.fromMult) {
389
- const [fx, fy] = rel.points[0];
390
- s += `<text x="${fx + 4}" y="${fy - 4}" fill="#64748b" font-size="9.5" ${FM}>${escXml(rel.fromMult)}</text>`;
391
- }
388
+ // Multiplicity labels — placed just OUTSIDE each box, offset along the line
389
+ // (away from the box) and beside it, so BOTH ends are always legible.
390
+ const multLabel = (end, adj, txt) => {
391
+ const dx = adj[0] - end[0], dy = adj[1] - end[1];
392
+ const L = Math.hypot(dx, dy) || 1, ux = dx / L, uy = dy / L;
393
+ const x = end[0] + ux * 16 - uy * 9, y = end[1] + uy * 16 + ux * 9 + 3;
394
+ return `<text x="${x}" y="${y}" text-anchor="middle" fill="#64748b" font-size="9.5" ${FM}>${escXml(txt)}</text>`;
395
+ };
396
+ if (rel.fromMult) s += multLabel(rel.points[0], rel.points[1], rel.fromMult);
392
397
  if (rel.toMult) {
393
- const [tx, ty] = rel.points[rel.points.length - 1];
394
- s += `<text x="${tx + 4}" y="${ty - 4}" fill="#64748b" font-size="9.5" ${FM}>${escXml(rel.toMult)}</text>`;
398
+ const n = rel.points.length;
399
+ s += multLabel(rel.points[n - 1], rel.points[n - 2], rel.toMult);
395
400
  }
396
401
  if (rel.label) {
397
402
  const mid = rel.points[Math.floor(rel.points.length / 2)];
@@ -435,7 +440,7 @@ function render() {
435
440
  const rels = RELS.map(svgRel).join('');
436
441
  const boxes = CLASSES.map(svgBox).join('');
437
442
  // Legend is placed at totalHeight - 60 so it always lands inside the viewBox.
438
- const legend = `<text x="16" y="${totalHeight - 60}" fill="#64748b" font-size="9" ${FM}>── Association ◇── Aggregation ◆── Composition ──▷ Generalization --→ Dependency (enum only)</text>`;
443
+ const legend = `<text x="16" y="${totalHeight - 60}" fill="#64748b" font-size="9" ${FM}>── Association ◇── Aggregation ◆── Composition ──▷ Generalization | קרדינליות בשני קצות הקשר</text>`;
439
444
 
440
445
  const svg = document.getElementById('diagram-svg');
441
446
  svg.setAttribute('width', totalWidth);