@likec4/diagram 1.59.0 → 1.59.1

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.
@@ -156,6 +156,27 @@ var labelText = css.raw({
156
156
  textOverflow: "ellipsis"
157
157
  });
158
158
  var LabelSpan = styled("span", { base: labelText });
159
+ /**
160
+ * Height of the leading step badge; also the line-height of the first label line
161
+ * so that a multiline label keeps its first line aligned with the badge/arrow.
162
+ */
163
+ var rowLeadingHeight = "18px";
164
+ /** Groups the step badge and arrow so they stay centered against the first label line. */
165
+ var leadingIcons = css.raw({
166
+ flex: "none",
167
+ display: "flex",
168
+ alignItems: "center",
169
+ gap: "2",
170
+ height: rowLeadingHeight
171
+ });
172
+ var MultilineLabelSpan = styled("span", { base: css.raw({
173
+ flex: "1",
174
+ minWidth: "0",
175
+ fontSize: "xs",
176
+ lineHeight: rowLeadingHeight,
177
+ whiteSpace: "pre-line",
178
+ overflowWrap: "anywhere"
179
+ }) });
159
180
  var selectFlow = selectDiagramContext((s) => {
160
181
  const title = extractViewTitleFromPath(s.view.title ?? "Untitled");
161
182
  const description = s.view.description;
@@ -425,41 +446,41 @@ var StepRow = ({ node, elementProps, selected }) => {
425
446
  const { stepnum, source, target, label, notes } = node.nodeProps;
426
447
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box$1, {
427
448
  ...elementProps,
428
- className: cx(elementProps.className, css(rowBase)),
429
- children: [
430
- /* @__PURE__ */ jsx(StepNum, { children: stepnum }),
431
- /* @__PURE__ */ jsx(IconArrowRight, {
449
+ className: cx(elementProps.className, css(rowBase, { alignItems: "flex-start" })),
450
+ children: [/* @__PURE__ */ jsxs(Box$1, {
451
+ className: css(leadingIcons),
452
+ children: [/* @__PURE__ */ jsx(StepNum, { children: stepnum }), /* @__PURE__ */ jsx(IconArrowRight, {
432
453
  size: 13,
433
454
  className: css({
434
455
  flex: "none",
435
456
  color: "text.dimmed"
436
457
  })
437
- }),
438
- label ? /* @__PURE__ */ jsx(LabelSpan, { children: label }) : /* @__PURE__ */ jsxs(HStack, {
439
- css: {
440
- gap: "1",
441
- minWidth: "0",
442
- flex: "1"
443
- },
444
- children: [
445
- /* @__PURE__ */ jsx(LabelSpan, {
446
- css: {
447
- flex: "none",
448
- color: "text.dimmed"
449
- },
450
- children: source
451
- }),
452
- /* @__PURE__ */ jsx(IconArrowRight, {
453
- size: 11,
454
- className: css({
455
- flex: "none",
456
- color: "text.dimmed"
457
- })
458
- }),
459
- /* @__PURE__ */ jsx(LabelSpan, { children: target })
460
- ]
461
- })
462
- ]
458
+ })]
459
+ }), label ? /* @__PURE__ */ jsx(MultilineLabelSpan, { children: label }) : /* @__PURE__ */ jsxs(HStack, {
460
+ css: {
461
+ gap: "1",
462
+ minWidth: "0",
463
+ flex: "1",
464
+ minHeight: rowLeadingHeight
465
+ },
466
+ children: [
467
+ /* @__PURE__ */ jsx(LabelSpan, {
468
+ css: {
469
+ flex: "none",
470
+ color: "text.dimmed"
471
+ },
472
+ children: source
473
+ }),
474
+ /* @__PURE__ */ jsx(IconArrowRight, {
475
+ size: 11,
476
+ className: css({
477
+ flex: "none",
478
+ color: "text.dimmed"
479
+ })
480
+ }),
481
+ /* @__PURE__ */ jsx(LabelSpan, { children: target })
482
+ ]
483
+ })]
463
484
  }), notes && /* @__PURE__ */ jsx(Markdown, {
464
485
  value: RichText.from(notes),
465
486
  fontSize: "sm",
@@ -112,6 +112,11 @@ var SequenceViewLayouter = class {
112
112
  const { column, row } = type === "source" ? step.from : step.to;
113
113
  const x = this.actorBox(column).centerX;
114
114
  const { rowTop } = nonNullable(this.#rows[row]);
115
+ if (step.isSelfLoop && type === "target") return {
116
+ cx: x.value(),
117
+ cy: rowTop.value(),
118
+ height: 24
119
+ };
115
120
  return {
116
121
  cx: x.value(),
117
122
  cy: rowTop.value() + 40 + step.offset,
@@ -198,7 +203,7 @@ var SequenceViewLayouter = class {
198
203
  let height = step.label?.height ? step.label.height + 50 + 24 : 100;
199
204
  height = Math.max(height, 100) + step.offset;
200
205
  this.ensureRow(step.from.row, height);
201
- if (step.isSelfLoop) this.ensureRow(step.to.row, 0);
206
+ if (step.to.row !== step.from.row) this.ensureRow(step.to.row, 24);
202
207
  return this;
203
208
  }
204
209
  /**