@diagrammo/dgmo 0.1.2 → 0.1.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/cli.cjs +17 -4
- package/dist/index.cjs +17 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/sequence/renderer.ts +21 -4
package/dist/index.js
CHANGED
|
@@ -1606,6 +1606,16 @@ __export(renderer_exports, {
|
|
|
1606
1606
|
renderSequenceDiagram: () => renderSequenceDiagram
|
|
1607
1607
|
});
|
|
1608
1608
|
import * as d3Selection from "d3-selection";
|
|
1609
|
+
function mix(a, b, pct) {
|
|
1610
|
+
const parse = (h) => {
|
|
1611
|
+
const r = h.replace("#", "");
|
|
1612
|
+
const f = r.length === 3 ? r[0] + r[0] + r[1] + r[1] + r[2] + r[2] : r;
|
|
1613
|
+
return [parseInt(f.substring(0, 2), 16), parseInt(f.substring(2, 4), 16), parseInt(f.substring(4, 6), 16)];
|
|
1614
|
+
};
|
|
1615
|
+
const [ar, ag, ab] = parse(a), [br, bg, bb] = parse(b), t = pct / 100;
|
|
1616
|
+
const c = (x, y) => Math.round(x * t + y * (1 - t)).toString(16).padStart(2, "0");
|
|
1617
|
+
return `#${c(ar, br)}${c(ag, bg)}${c(ab, bb)}`;
|
|
1618
|
+
}
|
|
1609
1619
|
function renderRectParticipant(g, palette, isDark) {
|
|
1610
1620
|
g.append("rect").attr("x", -W / 2).attr("y", 0).attr("width", W).attr("height", H).attr("rx", 2).attr("ry", 2).attr("fill", fill(palette, isDark)).attr("stroke", stroke(palette)).attr("stroke-width", SW);
|
|
1611
1621
|
}
|
|
@@ -1895,7 +1905,10 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
1895
1905
|
}
|
|
1896
1906
|
}
|
|
1897
1907
|
const allRenderSteps = buildRenderSequence(messages);
|
|
1898
|
-
|
|
1908
|
+
let renderSteps = hiddenMsgIndices.size > 0 ? allRenderSteps.filter((s) => !hiddenMsgIndices.has(s.messageIndex)) : allRenderSteps;
|
|
1909
|
+
renderSteps = renderSteps.filter(
|
|
1910
|
+
(s) => s.type === "call" || s.label
|
|
1911
|
+
);
|
|
1899
1912
|
const activations = activationsOff ? [] : computeActivations(renderSteps);
|
|
1900
1913
|
const stepSpacing = 35;
|
|
1901
1914
|
const BLOCK_HEADER_SPACE = 30;
|
|
@@ -2119,7 +2132,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
2119
2132
|
const boxY = participantStartY - GROUP_PADDING_TOP;
|
|
2120
2133
|
const boxH = PARTICIPANT_BOX_HEIGHT + GROUP_PADDING_TOP + GROUP_PADDING_BOTTOM;
|
|
2121
2134
|
const resolvedGroupColor = group.color ? resolveColor(group.color, palette) : void 0;
|
|
2122
|
-
const fillColor = resolvedGroupColor ?
|
|
2135
|
+
const fillColor = resolvedGroupColor ? mix(resolvedGroupColor, isDark ? palette.surface : palette.bg, 10) : isDark ? palette.surface : palette.bg;
|
|
2123
2136
|
const strokeColor = resolvedGroupColor || palette.textMuted;
|
|
2124
2137
|
svg.append("rect").attr("x", minX).attr("y", boxY).attr("width", maxX - minX).attr("height", boxH).attr("rx", 6).attr("fill", fillColor).attr("stroke", strokeColor).attr("stroke-width", 1).attr("stroke-opacity", 0.5).attr("class", "group-box").attr("data-group-line", String(group.lineNumber));
|
|
2125
2138
|
svg.append("text").attr("x", minX + 8).attr("y", boxY + GROUP_LABEL_SIZE + 4).attr("fill", strokeColor).attr("font-size", GROUP_LABEL_SIZE).attr("font-weight", "bold").attr("opacity", 0.7).attr("class", "group-label").attr("data-group-line", String(group.lineNumber)).text(group.name);
|
|
@@ -2242,7 +2255,7 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
2242
2255
|
if (msg) coveredLines.push(msg.lineNumber);
|
|
2243
2256
|
}
|
|
2244
2257
|
svg.append("rect").attr("x", x).attr("y", y1).attr("width", ACTIVATION_WIDTH).attr("height", y2 - y1).attr("fill", isDark ? palette.surface : palette.bg);
|
|
2245
|
-
const actFill =
|
|
2258
|
+
const actFill = mix(palette.primary, isDark ? palette.surface : palette.bg, isDark ? 15 : 30);
|
|
2246
2259
|
svg.append("rect").attr("x", x).attr("y", y1).attr("width", ACTIVATION_WIDTH).attr("height", y2 - y1).attr("fill", actFill).attr("stroke", palette.primary).attr("stroke-width", 1).attr("stroke-opacity", 0.5).attr("data-participant-id", act.participantId).attr("data-msg-lines", coveredLines.join(",")).attr("class", "activation");
|
|
2247
2260
|
});
|
|
2248
2261
|
for (const ln of deferredLines) {
|
|
@@ -2425,7 +2438,7 @@ var init_renderer = __esm({
|
|
|
2425
2438
|
MESSAGE_START_OFFSET = 30;
|
|
2426
2439
|
LIFELINE_TAIL = 30;
|
|
2427
2440
|
ARROWHEAD_SIZE = 8;
|
|
2428
|
-
fill = (palette, isDark) =>
|
|
2441
|
+
fill = (palette, isDark) => mix(palette.primary, isDark ? palette.surface : palette.bg, isDark ? 15 : 30);
|
|
2429
2442
|
stroke = (palette) => palette.textMuted;
|
|
2430
2443
|
SW = 1.5;
|
|
2431
2444
|
W = PARTICIPANT_BOX_WIDTH;
|