@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/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diagrammo/dgmo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "DGMO diagram markup language — parser, renderer, and color system",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"dgmo": "
|
|
8
|
+
"dgmo": "dist/cli.cjs"
|
|
9
9
|
},
|
|
10
10
|
"main": "./dist/index.cjs",
|
|
11
11
|
"module": "./dist/index.js",
|
package/src/sequence/renderer.ts
CHANGED
|
@@ -29,9 +29,21 @@ const MESSAGE_START_OFFSET = 30;
|
|
|
29
29
|
const LIFELINE_TAIL = 30;
|
|
30
30
|
const ARROWHEAD_SIZE = 8;
|
|
31
31
|
|
|
32
|
+
// Mix two hex colors in sRGB: pct% of a, rest of b
|
|
33
|
+
function mix(a: string, b: string, pct: number): string {
|
|
34
|
+
const parse = (h: string) => {
|
|
35
|
+
const r = h.replace('#', '');
|
|
36
|
+
const f = r.length === 3 ? r[0]+r[0]+r[1]+r[1]+r[2]+r[2] : r;
|
|
37
|
+
return [parseInt(f.substring(0,2),16), parseInt(f.substring(2,4),16), parseInt(f.substring(4,6),16)];
|
|
38
|
+
};
|
|
39
|
+
const [ar,ag,ab] = parse(a), [br,bg,bb] = parse(b), t = pct/100;
|
|
40
|
+
const c = (x: number, y: number) => Math.round(x*t + y*(1-t)).toString(16).padStart(2,'0');
|
|
41
|
+
return `#${c(ar,br)}${c(ag,bg)}${c(ab,bb)}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
32
44
|
// Shared fill/stroke helpers
|
|
33
45
|
const fill = (palette: PaletteColors, isDark: boolean): string =>
|
|
34
|
-
|
|
46
|
+
mix(palette.primary, isDark ? palette.surface : palette.bg, isDark ? 15 : 30);
|
|
35
47
|
const stroke = (palette: PaletteColors): string => palette.textMuted;
|
|
36
48
|
const SW = 1.5;
|
|
37
49
|
const W = PARTICIPANT_BOX_WIDTH;
|
|
@@ -746,10 +758,15 @@ export function renderSequenceDiagram(
|
|
|
746
758
|
// Build render sequence with stack-based return placement
|
|
747
759
|
// Run on ALL messages first (preserves call stack correctness), then filter
|
|
748
760
|
const allRenderSteps = buildRenderSequence(messages);
|
|
749
|
-
|
|
761
|
+
let renderSteps =
|
|
750
762
|
hiddenMsgIndices.size > 0
|
|
751
763
|
? allRenderSteps.filter((s) => !hiddenMsgIndices.has(s.messageIndex))
|
|
752
764
|
: allRenderSteps;
|
|
765
|
+
// Drop unlabeled returns — they add visual noise without conveying information.
|
|
766
|
+
// Labeled returns (explicit <- value) are kept.
|
|
767
|
+
renderSteps = renderSteps.filter(
|
|
768
|
+
(s) => s.type === 'call' || s.label
|
|
769
|
+
);
|
|
753
770
|
const activations = activationsOff ? [] : computeActivations(renderSteps);
|
|
754
771
|
const stepSpacing = 35;
|
|
755
772
|
|
|
@@ -1119,7 +1136,7 @@ export function renderSequenceDiagram(
|
|
|
1119
1136
|
? resolveColor(group.color, palette)
|
|
1120
1137
|
: undefined;
|
|
1121
1138
|
const fillColor = resolvedGroupColor
|
|
1122
|
-
?
|
|
1139
|
+
? mix(resolvedGroupColor, isDark ? palette.surface : palette.bg, 10)
|
|
1123
1140
|
: isDark
|
|
1124
1141
|
? palette.surface
|
|
1125
1142
|
: palette.bg;
|
|
@@ -1352,7 +1369,7 @@ export function renderSequenceDiagram(
|
|
|
1352
1369
|
.attr('height', y2 - y1)
|
|
1353
1370
|
.attr('fill', isDark ? palette.surface : palette.bg);
|
|
1354
1371
|
|
|
1355
|
-
const actFill =
|
|
1372
|
+
const actFill = mix(palette.primary, isDark ? palette.surface : palette.bg, isDark ? 15 : 30);
|
|
1356
1373
|
svg
|
|
1357
1374
|
.append('rect')
|
|
1358
1375
|
.attr('x', x)
|