@dskripchenko/diagrams 1.0.1 → 1.0.2

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.cjs CHANGED
@@ -6080,6 +6080,7 @@ function actor(a) {
6080
6080
  ry: 4
6081
6081
  }), renderLabel(a.label, a.x, a.top + a.height / 2, { className: "dg-actor-label" })]);
6082
6082
  }
6083
+ /** A block's outline and section rules: drawn under the activation bars. */
6083
6084
  function frame(f) {
6084
6085
  const parts = [el("rect", {
6085
6086
  class: "dg-block",
@@ -6088,6 +6089,21 @@ function frame(f) {
6088
6089
  width: f.right - f.left,
6089
6090
  height: f.bottom - f.top
6090
6091
  })];
6092
+ for (const section of f.sections) parts.push(el("line", {
6093
+ class: "dg-block-sep",
6094
+ x1: f.left,
6095
+ y1: section.y,
6096
+ x2: f.right,
6097
+ y2: section.y
6098
+ }));
6099
+ return el("g", { class: `dg-frame dg-frame-${f.block}` }, parts);
6100
+ }
6101
+ /**
6102
+ * A block's tab and guard texts: drawn over the activation bars, which would
6103
+ * otherwise cut through a label like "loop" that sits on a lifeline.
6104
+ */
6105
+ function frameLabels(f) {
6106
+ const parts = [];
6091
6107
  if (f.tab) {
6092
6108
  const w = f.tabWidth;
6093
6109
  const tab = [
@@ -6106,17 +6122,8 @@ function frame(f) {
6106
6122
  anchor: "start",
6107
6123
  className: "dg-block-guard"
6108
6124
  }));
6109
- for (const section of f.sections) {
6110
- parts.push(el("line", {
6111
- class: "dg-block-sep",
6112
- x1: f.left,
6113
- y1: section.y,
6114
- x2: f.right,
6115
- y2: section.y
6116
- }));
6117
- if (section.guard) parts.push(renderLabel(section.guard, (f.left + f.right) / 2, section.y + 4 + section.guard.height / 2, { className: "dg-block-guard" }));
6118
- }
6119
- return el("g", { class: `dg-frame dg-frame-${f.block}` }, parts);
6125
+ for (const section of f.sections) if (section.guard) parts.push(renderLabel(section.guard, (f.left + f.right) / 2, section.y + 4 + section.guard.height / 2, { className: "dg-block-guard" }));
6126
+ return el("g", { class: `dg-frame-labels dg-frame-${f.block}` }, parts.filter((p) => !!p));
6120
6127
  }
6121
6128
  function message(m, prefix) {
6122
6129
  const kind = markerFor(m.head);
@@ -6198,6 +6205,7 @@ function renderSequenceLayout(layout, id, title, description) {
6198
6205
  width: 10,
6199
6206
  height: a.bottom - a.top
6200
6207
  }))),
6208
+ el("g", { class: "dg-frame-label-layer" }, layout.frames.map(frameLabels)),
6201
6209
  el("g", { class: "dg-messages" }, layout.messages.map((m) => message(m, id))),
6202
6210
  el("g", { class: "dg-notes" }, layout.notes.map((n) => el("g", { class: "dg-note-group" }, [el("rect", {
6203
6211
  class: "dg-note",
package/dist/index.mjs CHANGED
@@ -6079,6 +6079,7 @@ function actor(a) {
6079
6079
  ry: 4
6080
6080
  }), renderLabel(a.label, a.x, a.top + a.height / 2, { className: "dg-actor-label" })]);
6081
6081
  }
6082
+ /** A block's outline and section rules: drawn under the activation bars. */
6082
6083
  function frame(f) {
6083
6084
  const parts = [el("rect", {
6084
6085
  class: "dg-block",
@@ -6087,6 +6088,21 @@ function frame(f) {
6087
6088
  width: f.right - f.left,
6088
6089
  height: f.bottom - f.top
6089
6090
  })];
6091
+ for (const section of f.sections) parts.push(el("line", {
6092
+ class: "dg-block-sep",
6093
+ x1: f.left,
6094
+ y1: section.y,
6095
+ x2: f.right,
6096
+ y2: section.y
6097
+ }));
6098
+ return el("g", { class: `dg-frame dg-frame-${f.block}` }, parts);
6099
+ }
6100
+ /**
6101
+ * A block's tab and guard texts: drawn over the activation bars, which would
6102
+ * otherwise cut through a label like "loop" that sits on a lifeline.
6103
+ */
6104
+ function frameLabels(f) {
6105
+ const parts = [];
6090
6106
  if (f.tab) {
6091
6107
  const w = f.tabWidth;
6092
6108
  const tab = [
@@ -6105,17 +6121,8 @@ function frame(f) {
6105
6121
  anchor: "start",
6106
6122
  className: "dg-block-guard"
6107
6123
  }));
6108
- for (const section of f.sections) {
6109
- parts.push(el("line", {
6110
- class: "dg-block-sep",
6111
- x1: f.left,
6112
- y1: section.y,
6113
- x2: f.right,
6114
- y2: section.y
6115
- }));
6116
- if (section.guard) parts.push(renderLabel(section.guard, (f.left + f.right) / 2, section.y + 4 + section.guard.height / 2, { className: "dg-block-guard" }));
6117
- }
6118
- return el("g", { class: `dg-frame dg-frame-${f.block}` }, parts);
6124
+ for (const section of f.sections) if (section.guard) parts.push(renderLabel(section.guard, (f.left + f.right) / 2, section.y + 4 + section.guard.height / 2, { className: "dg-block-guard" }));
6125
+ return el("g", { class: `dg-frame-labels dg-frame-${f.block}` }, parts.filter((p) => !!p));
6119
6126
  }
6120
6127
  function message(m, prefix) {
6121
6128
  const kind = markerFor(m.head);
@@ -6197,6 +6204,7 @@ function renderSequenceLayout(layout, id, title, description) {
6197
6204
  width: 10,
6198
6205
  height: a.bottom - a.top
6199
6206
  }))),
6207
+ el("g", { class: "dg-frame-label-layer" }, layout.frames.map(frameLabels)),
6200
6208
  el("g", { class: "dg-messages" }, layout.messages.map((m) => message(m, id))),
6201
6209
  el("g", { class: "dg-notes" }, layout.notes.map((n) => el("g", { class: "dg-note-group" }, [el("rect", {
6202
6210
  class: "dg-note",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dskripchenko/diagrams",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Mermaid-syntax diagrams rendered to SVG with zero runtime dependencies — flowchart, sequence, state, pie, gantt",
5
5
  "keywords": [
6
6
  "diagram",