@diagrammo/dgmo 0.2.19 → 0.2.21

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.
@@ -275,6 +275,7 @@ function renderDatabaseParticipant(
275
275
 
276
276
  // Filled body (no stroke) to hide the top arc of the bottom ellipse
277
277
  g.append('rect')
278
+ .attr('class', 'participant-body')
278
279
  .attr('x', -W / 2)
279
280
  .attr('y', topY)
280
281
  .attr('width', W)
@@ -333,6 +334,7 @@ function renderQueueParticipant(
333
334
 
334
335
  // Body rect (no stroke) to hide left arc of right ellipse
335
336
  g.append('rect')
337
+ .attr('class', 'participant-body')
336
338
  .attr('x', leftX)
337
339
  .attr('y', 0)
338
340
  .attr('width', bodyW)
@@ -380,6 +382,7 @@ function renderCacheParticipant(
380
382
  const s = stroke(palette);
381
383
  const dash = '4 3';
382
384
 
385
+ // Bottom ellipse (back face)
383
386
  g.append('ellipse')
384
387
  .attr('cx', 0)
385
388
  .attr('cy', topY + bodyH)
@@ -391,6 +394,7 @@ function renderCacheParticipant(
391
394
  .attr('stroke-dasharray', dash);
392
395
 
393
396
  g.append('rect')
397
+ .attr('class', 'participant-body')
394
398
  .attr('x', -W / 2)
395
399
  .attr('y', topY)
396
400
  .attr('width', W)
@@ -415,6 +419,7 @@ function renderCacheParticipant(
415
419
  .attr('stroke-width', SW)
416
420
  .attr('stroke-dasharray', dash);
417
421
 
422
+ // Top ellipse cap
418
423
  g.append('ellipse')
419
424
  .attr('cx', 0)
420
425
  .attr('cy', topY)
@@ -906,11 +911,13 @@ export function renderSequenceDiagram(
906
911
  msgToLastStep.set(step.messageIndex, si);
907
912
  });
908
913
 
909
- // Map a note to the first render-step index of its preceding message
910
- // (the forward/call arrow, not the return arrow).
914
+ // Map a note to the last render-step index of its preceding message
915
+ // (the return arrow if present, otherwise the call arrow).
916
+ // This ensures notes are positioned below the return arrow so they
917
+ // don't overlap it.
911
918
  // If the note's closest preceding message is hidden (collapsed section), return -1
912
919
  // so the note is hidden along with its section.
913
- const findAssociatedFirstStep = (note: SequenceNote): number => {
920
+ const findAssociatedLastStep = (note: SequenceNote): number => {
914
921
  // First find the closest preceding message (ignoring hidden filter)
915
922
  let closestMsgIndex = -1;
916
923
  let closestLine = -1;
@@ -928,7 +935,7 @@ export function renderSequenceDiagram(
928
935
  return -1;
929
936
  }
930
937
  if (closestMsgIndex < 0) return -1;
931
- return msgToFirstStep.get(closestMsgIndex) ?? -1;
938
+ return msgToLastStep.get(closestMsgIndex) ?? -1;
932
939
  };
933
940
 
934
941
  // Find the first visible message index in an element subtree
@@ -1254,7 +1261,7 @@ export function renderSequenceDiagram(
1254
1261
  for (let i = 0; i < els.length; i++) {
1255
1262
  const el = els[i];
1256
1263
  if (isSequenceNote(el)) {
1257
- const si = findAssociatedFirstStep(el);
1264
+ const si = findAssociatedLastStep(el);
1258
1265
  if (si < 0) continue;
1259
1266
  // Check if there's a preceding note that we should stack below
1260
1267
  const prevNote = i > 0 && isSequenceNote(els[i - 1]) ? (els[i - 1] as SequenceNote) : null;
@@ -1728,6 +1735,7 @@ export function renderSequenceDiagram(
1728
1735
  .attr('stroke-opacity', 0.5)
1729
1736
  .attr('data-participant-id', act.participantId)
1730
1737
  .attr('data-msg-lines', coveredLines.join(','))
1738
+ .attr('data-line-number', coveredLines[0] ?? '')
1731
1739
  .attr('class', 'activation');
1732
1740
  });
1733
1741