@diagrammo/dgmo 0.84.0 → 0.86.0
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/advanced.d.ts +74 -9
- package/dist/advanced.js +70 -52
- package/dist/block.js +9 -9
- package/dist/chart-meta.js +4 -4
- package/dist/{chunk-LRNIYQ6Y.js → chunk-33FQ6HNV.js} +1 -1
- package/dist/{chunk-REUEU5PU.js → chunk-3CQS3CIO.js} +2 -2
- package/dist/{chunk-LQSNWE3W.js → chunk-4ELXLATB.js} +1 -1
- package/dist/{chunk-QZRYCRT7.js → chunk-4YA5XW43.js} +40 -40
- package/dist/{chunk-23RWHHI5.js → chunk-5NU7NII2.js} +14 -2
- package/dist/{chunk-HMWZQ53A.js → chunk-7WGCQE2E.js} +1 -1
- package/dist/{chunk-NSS2EF5B.js → chunk-AAMCXQPP.js} +1 -1
- package/dist/{chunk-XD7XL3SF.js → chunk-AGO3PFGS.js} +1 -1
- package/dist/{chunk-ECIXBEG2.js → chunk-AQIBKTPG.js} +2 -2
- package/dist/{chunk-ITLPDLBH.js → chunk-BF7JAFJI.js} +1 -1
- package/dist/{chunk-RMAJIB6S.js → chunk-BHZE36F7.js} +3 -3
- package/dist/{chunk-6HOVLE3H.js → chunk-BT2WH2XT.js} +1 -1
- package/dist/{chunk-3MXJMZAN.js → chunk-BV6PKJUS.js} +105 -28
- package/dist/{chunk-PSH5DT26.js → chunk-C6FZZFYD.js} +2 -2
- package/dist/{chunk-7256EOAE.js → chunk-CFBY77QJ.js} +129 -10
- package/dist/{chunk-VKGQX6P2.js → chunk-D4M25W6R.js} +1 -1
- package/dist/{chunk-A4PHPKNR.js → chunk-DAX42XVH.js} +1 -1
- package/dist/{chunk-V3LJIPS4.js → chunk-E6S2K6O2.js} +1 -1
- package/dist/{chunk-BIQYWWJ2.js → chunk-ERYHC4KJ.js} +1 -1
- package/dist/{chunk-JLGN6S4B.js → chunk-EWSESGC2.js} +32 -3
- package/dist/{chunk-MIZ46MOF.js → chunk-GYORDNOM.js} +1 -1
- package/dist/{chunk-D7D5YK4J.js → chunk-H6AFNCN3.js} +14 -2
- package/dist/{chunk-PEFPTQ3Z.js → chunk-HUMQIRJK.js} +1 -1
- package/dist/{chunk-XXAZ5C4K.js → chunk-IJ27L3R4.js} +1 -1
- package/dist/{chunk-VDMG3MM4.js → chunk-JD4RHBNX.js} +1 -1
- package/dist/{chunk-J2ICADUM.js → chunk-LHBMQJC3.js} +1 -1
- package/dist/{chunk-Y7FTHOMD.js → chunk-LIYWJ6DV.js} +32 -223
- package/dist/{chunk-HATTVAWX.js → chunk-LJFXC3IP.js} +1 -1
- package/dist/{chunk-KABGWUND.js → chunk-MSXRNVHB.js} +5 -3
- package/dist/{chunk-2QIGN7KL.js → chunk-MYHPRQHR.js} +6 -2
- package/dist/{chunk-UJRMARNX.js → chunk-NJIGYGZS.js} +19 -1
- package/dist/{chunk-RYZNNXUV.js → chunk-PKXKWHDW.js} +1 -1
- package/dist/{chunk-C5FEPGSJ.js → chunk-QJFT5MAH.js} +1 -1
- package/dist/{chunk-ULCB4BLF.js → chunk-QPE646M2.js} +1 -1
- package/dist/{chunk-UNSN56OJ.js → chunk-R2K5L4UA.js} +1 -1
- package/dist/{chunk-SLMAAJPE.js → chunk-RGI64U3A.js} +1 -1
- package/dist/chunk-TW6WMZFW.js +287 -0
- package/dist/{chunk-ZUUNTOMG.js → chunk-UIUXIDBX.js} +1 -1
- package/dist/{chunk-XIYVGO24.js → chunk-UMRZPRAN.js} +3 -3
- package/dist/{chunk-67USWFFE.js → chunk-UY6TEJJH.js} +1 -1
- package/dist/{chunk-YWHGWLY6.js → chunk-VEE777MD.js} +3 -3
- package/dist/{chunk-UGYZ5Q5Y.js → chunk-VJ2KROJ5.js} +1 -1
- package/dist/{chunk-6EV2F6W7.js → chunk-VPASQOR3.js} +68 -46
- package/dist/{chunk-OGKP2XGJ.js → chunk-VPVWG2GH.js} +1 -1
- package/dist/{chunk-IIEI7VK5.js → chunk-XCKNFFKM.js} +2 -0
- package/dist/{chunk-AYA6C64M.js → chunk-XFMQSFS4.js} +84 -27
- package/dist/cloud-reference.d.ts +11 -1
- package/dist/cloud-reference.js +1 -1
- package/dist/{dgmo-router-YW4SBNYB.js → dgmo-router-F2DSURTR.js} +5 -5
- package/dist/{dimensions-F3Y5T54V.js → dimensions-6QAWEGIR.js} +2 -2
- package/dist/{flowchart-renderer-TGQL4S4L.js → flowchart-renderer-H72L7BEC.js} +2 -2
- package/dist/index.js +9 -9
- package/dist/{layout-WZCXK7DF.js → layout-5NPBHV5F.js} +2 -2
- package/dist/{layout-WXVGMSI3.js → layout-5VSMZPMG.js} +2 -2
- package/dist/{layout-K6NI4VCS.js → layout-CUFA7XJD.js} +2 -2
- package/dist/{layout-NB7TKAWN.js → layout-LUQKAGGT.js} +2 -2
- package/dist/{layout-CFTB7GKV.js → layout-QIPCNUSB.js} +2 -2
- package/dist/{layout-PT7IKVCV.js → layout-QX5T6ZNE.js} +2 -2
- package/dist/layout-T6TAB5OI.js +10 -0
- package/dist/{layout-search-GRJEBAUF.js → layout-search-AW5VBDCV.js} +13 -8
- package/dist/live-link-resolve.d.ts +21 -3
- package/dist/live-link-resolve.js +47 -17
- package/dist/{parser-6PHQJO42.js → parser-PVIWHVGY.js} +1 -1
- package/dist/{parser-6TXNMXNB.js → parser-XYY5NHP4.js} +2 -2
- package/dist/{renderer-FXX3XSNW.js → renderer-2BWRW23Z.js} +2 -2
- package/dist/{renderer-OV3GUJRR.js → renderer-36JH4OMC.js} +4 -4
- package/dist/{renderer-EU27D4S6.js → renderer-425QUIYO.js} +2 -2
- package/dist/{renderer-HV6ZYJMC.js → renderer-4NZZ5J2F.js} +2 -2
- package/dist/{renderer-UGA5DGKR.js → renderer-5JVVJBAS.js} +2 -2
- package/dist/{renderer-YSH5EX54.js → renderer-AI2MD52D.js} +1 -1
- package/dist/{renderer-HWEGM72C.js → renderer-BICLPGAH.js} +2 -2
- package/dist/{renderer-XS42HEXW.js → renderer-CZJ4AMYV.js} +2 -2
- package/dist/{renderer-WUDVV363.js → renderer-E7WF75GY.js} +2 -2
- package/dist/{renderer-3XRDFNYF.js → renderer-EWJS2RAZ.js} +3 -3
- package/dist/{renderer-5YOF2AHJ.js → renderer-JEEGPLMM.js} +2 -2
- package/dist/{renderer-OXSLLQQC.js → renderer-KVAQE7PQ.js} +2 -2
- package/dist/{renderer-TF3NTKP3.js → renderer-NX4YKWCJ.js} +2 -2
- package/dist/{renderer-P7LQBDU2.js → renderer-QM23SWAM.js} +2 -2
- package/dist/{renderer-FBAFYSIQ.js → renderer-RAATRF6W.js} +3 -3
- package/dist/{renderer-X4KFEKUK.js → renderer-RH4U3UVM.js} +3 -3
- package/dist/{renderer-G72GMBKA.js → renderer-RLSR7N6I.js} +4 -4
- package/dist/{renderer-3F4K2X57.js → renderer-RMGN3Q7D.js} +2 -2
- package/dist/{renderer-OVDVFPAI.js → renderer-RUGMKHX5.js} +3 -3
- package/dist/{renderer-GWNSV76V.js → renderer-UUWR7NGF.js} +3 -3
- package/dist/{renderer-J3O2KVTL.js → renderer-V6LLASGN.js} +2 -2
- package/dist/{renderer-FQAZ3KNU.js → renderer-VKAJ52UO.js} +2 -2
- package/dist/{renderer-WRWVFEX7.js → renderer-XRALFCIN.js} +6 -4
- package/dist/{renderer-QZW4RCZW.js → renderer-YIZ7G4HU.js} +6 -6
- package/dist/{state-renderer-B4ZF6ESS.js → state-renderer-DDVJ43HR.js} +2 -2
- package/docs/language-reference.md +24 -12
- package/gallery/fixtures/sequence-groups-nested.dgmo +50 -0
- package/package.json +2 -2
- package/dist/chunk-WTTIODDV.js +0 -9
- package/dist/layout-JQ3IPJYR.js +0 -9
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
LABEL_REACH_WIDE,
|
|
2
3
|
NODE_HEIGHT,
|
|
3
|
-
NODE_WIDTH
|
|
4
|
-
|
|
4
|
+
NODE_WIDTH,
|
|
5
|
+
placeEdgeLabels
|
|
6
|
+
} from "./chunk-TW6WMZFW.js";
|
|
5
7
|
import {
|
|
6
8
|
buildPlacedNotes
|
|
7
9
|
} from "./chunk-HBCAY3KR.js";
|
|
@@ -10,222 +12,12 @@ import {
|
|
|
10
12
|
} from "./chunk-6EK55ART.js";
|
|
11
13
|
import {
|
|
12
14
|
measureText,
|
|
13
|
-
truncateText,
|
|
14
15
|
wrapTextToWidth
|
|
15
16
|
} from "./chunk-KAO7JL4I.js";
|
|
16
17
|
import {
|
|
17
18
|
resolveNotes
|
|
18
19
|
} from "./chunk-O753JUEZ.js";
|
|
19
20
|
|
|
20
|
-
// src/boxes-and-lines/label-placement.ts
|
|
21
|
-
var EDGE_LABEL_FONT_SIZE = 11;
|
|
22
|
-
var LABEL_MAX_WIDTH = 160;
|
|
23
|
-
var MAX_LABEL_LINES = 3;
|
|
24
|
-
var LABEL_LINE_HEIGHT = 1.3;
|
|
25
|
-
var H_PAD = 6;
|
|
26
|
-
var V_PAD = 3;
|
|
27
|
-
var BOX_CLEAR_PAD = 4;
|
|
28
|
-
var PERP_STEP = 8;
|
|
29
|
-
var PERP_MAX = 40;
|
|
30
|
-
var SLIDE_SAMPLES = 9;
|
|
31
|
-
function measureEdgeLabel(label, fontSize = EDGE_LABEL_FONT_SIZE, maxWidth = LABEL_MAX_WIDTH) {
|
|
32
|
-
let lines = wrapTextToWidth(label, fontSize, maxWidth, { hardBreak: true });
|
|
33
|
-
if (lines.length > MAX_LABEL_LINES) {
|
|
34
|
-
const kept = lines.slice(0, MAX_LABEL_LINES - 1);
|
|
35
|
-
const rest = lines.slice(MAX_LABEL_LINES - 1).join(" ");
|
|
36
|
-
kept.push(truncateText(rest, fontSize, maxWidth));
|
|
37
|
-
lines = kept;
|
|
38
|
-
}
|
|
39
|
-
let textW = 0;
|
|
40
|
-
for (const ln of lines) {
|
|
41
|
-
const w = measureText(ln, fontSize);
|
|
42
|
-
if (w > textW) textW = w;
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
lines,
|
|
46
|
-
width: textW + 2 * H_PAD,
|
|
47
|
-
height: lines.length * fontSize * LABEL_LINE_HEIGHT + 2 * V_PAD
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function edgePolylineMidpoint(points) {
|
|
51
|
-
return pointAtArcFraction(points, 0.5).p;
|
|
52
|
-
}
|
|
53
|
-
function pointAtArcFraction(points, t) {
|
|
54
|
-
if (points.length === 0) return { p: { x: 0, y: 0 }, nx: 0, ny: 1 };
|
|
55
|
-
if (points.length === 1)
|
|
56
|
-
return { p: { x: points[0].x, y: points[0].y }, nx: 0, ny: 1 };
|
|
57
|
-
const segLen = [];
|
|
58
|
-
let total = 0;
|
|
59
|
-
for (let k = 1; k < points.length; k++) {
|
|
60
|
-
const len = Math.hypot(
|
|
61
|
-
points[k].x - points[k - 1].x,
|
|
62
|
-
points[k].y - points[k - 1].y
|
|
63
|
-
);
|
|
64
|
-
segLen.push(len);
|
|
65
|
-
total += len;
|
|
66
|
-
}
|
|
67
|
-
let want = total * Math.max(0, Math.min(1, t));
|
|
68
|
-
for (let k = 1; k < points.length; k++) {
|
|
69
|
-
const len = segLen[k - 1];
|
|
70
|
-
if (want <= len || k === points.length - 1) {
|
|
71
|
-
const f = len === 0 ? 0 : Math.min(1, want / len);
|
|
72
|
-
const ax = points[k - 1].x;
|
|
73
|
-
const ay = points[k - 1].y;
|
|
74
|
-
const bx = points[k].x;
|
|
75
|
-
const by = points[k].y;
|
|
76
|
-
const dx = bx - ax;
|
|
77
|
-
const dy = by - ay;
|
|
78
|
-
const dlen = Math.hypot(dx, dy) || 1;
|
|
79
|
-
return {
|
|
80
|
-
p: { x: ax + dx * f, y: ay + dy * f },
|
|
81
|
-
nx: -dy / dlen,
|
|
82
|
-
ny: dx / dlen
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
want -= len;
|
|
86
|
-
}
|
|
87
|
-
const last = points[points.length - 1];
|
|
88
|
-
return { p: { x: last.x, y: last.y }, nx: 0, ny: 1 };
|
|
89
|
-
}
|
|
90
|
-
function rectFromCenter(cx, cy, w, h) {
|
|
91
|
-
return {
|
|
92
|
-
minX: cx - w / 2,
|
|
93
|
-
minY: cy - h / 2,
|
|
94
|
-
maxX: cx + w / 2,
|
|
95
|
-
maxY: cy + h / 2
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
function overlapsAny(cx, cy, w, h, obstacles, pad) {
|
|
99
|
-
const minX = cx - w / 2 - pad;
|
|
100
|
-
const minY = cy - h / 2 - pad;
|
|
101
|
-
const maxX = cx + w / 2 + pad;
|
|
102
|
-
const maxY = cy + h / 2 + pad;
|
|
103
|
-
for (const o of obstacles) {
|
|
104
|
-
if (minX < o.maxX && maxX > o.minX && minY < o.maxY && maxY > o.minY)
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
function slideFractions() {
|
|
110
|
-
const out = [0.5];
|
|
111
|
-
for (let k = 1; k <= SLIDE_SAMPLES; k++) {
|
|
112
|
-
const off = k * 0.08;
|
|
113
|
-
if (0.5 - off >= 0.12) out.push(0.5 - off);
|
|
114
|
-
if (0.5 + off <= 0.88) out.push(0.5 + off);
|
|
115
|
-
}
|
|
116
|
-
return out;
|
|
117
|
-
}
|
|
118
|
-
function findClearPosition(w, h, points, obstacles) {
|
|
119
|
-
const ts = slideFractions();
|
|
120
|
-
for (const t of ts) {
|
|
121
|
-
const { p } = pointAtArcFraction(points, t);
|
|
122
|
-
if (!overlapsAny(p.x, p.y, w, h, obstacles, BOX_CLEAR_PAD)) return p;
|
|
123
|
-
}
|
|
124
|
-
for (let mag = PERP_STEP; mag <= PERP_MAX; mag += PERP_STEP) {
|
|
125
|
-
for (const t of ts) {
|
|
126
|
-
const { p, nx, ny } = pointAtArcFraction(points, t);
|
|
127
|
-
for (const sign of [-1, 1]) {
|
|
128
|
-
const x = p.x + nx * mag * sign;
|
|
129
|
-
const y = p.y + ny * mag * sign;
|
|
130
|
-
if (!overlapsAny(x, y, w, h, obstacles, BOX_CLEAR_PAD)) return { x, y };
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
function resolveLabelOverlaps(boxes) {
|
|
137
|
-
const MAX_PASSES = 8;
|
|
138
|
-
const PAD = 4;
|
|
139
|
-
for (let pass = 0; pass < MAX_PASSES; pass++) {
|
|
140
|
-
let moved = false;
|
|
141
|
-
for (let i = 0; i < boxes.length; i++) {
|
|
142
|
-
for (let j = i + 1; j < boxes.length; j++) {
|
|
143
|
-
const a = boxes[i];
|
|
144
|
-
const b = boxes[j];
|
|
145
|
-
const dx = Math.abs(a.cx - b.cx);
|
|
146
|
-
const dy = Math.abs(a.cy - b.cy);
|
|
147
|
-
const overlapX = (a.w + b.w) / 2 + PAD - dx;
|
|
148
|
-
const overlapY = (a.h + b.h) / 2 + PAD - dy;
|
|
149
|
-
if (overlapX > 0 && overlapY > 0) {
|
|
150
|
-
const shift = overlapY / 2 + 1;
|
|
151
|
-
if (a.cy < b.cy) {
|
|
152
|
-
a.cy -= shift;
|
|
153
|
-
b.cy += shift;
|
|
154
|
-
} else {
|
|
155
|
-
a.cy += shift;
|
|
156
|
-
b.cy -= shift;
|
|
157
|
-
}
|
|
158
|
-
moved = true;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (!moved) break;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function placeEdgeLabels(layout, opts) {
|
|
166
|
-
const fontSize = opts?.fontSize ?? EDGE_LABEL_FONT_SIZE;
|
|
167
|
-
const maxWidth = opts?.maxWidth ?? LABEL_MAX_WIDTH;
|
|
168
|
-
const obstacles = [];
|
|
169
|
-
for (const n of layout.nodes)
|
|
170
|
-
obstacles.push(rectFromCenter(n.x, n.y, n.width, n.height));
|
|
171
|
-
for (const g of layout.groups)
|
|
172
|
-
if (g.collapsed)
|
|
173
|
-
obstacles.push(rectFromCenter(g.x, g.y, g.width, g.height));
|
|
174
|
-
const boxes = [];
|
|
175
|
-
layout.edges.forEach((e, idx) => {
|
|
176
|
-
if (!e.label || e.points.length < 2) return;
|
|
177
|
-
const m = measureEdgeLabel(e.label, fontSize, maxWidth);
|
|
178
|
-
const mid = edgePolylineMidpoint(e.points);
|
|
179
|
-
let cy = mid.y;
|
|
180
|
-
if (e.parallelCount > 1 && e.yOffset !== 0)
|
|
181
|
-
cy += (e.yOffset < 0 ? -1 : 1) * (m.height / 2);
|
|
182
|
-
boxes.push({
|
|
183
|
-
edgeIdx: idx,
|
|
184
|
-
cx: mid.x,
|
|
185
|
-
cy,
|
|
186
|
-
w: m.width,
|
|
187
|
-
h: m.height,
|
|
188
|
-
lines: m.lines,
|
|
189
|
-
resolved: true
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
for (const box of boxes) {
|
|
193
|
-
if (!overlapsAny(box.cx, box.cy, box.w, box.h, obstacles, BOX_CLEAR_PAD))
|
|
194
|
-
continue;
|
|
195
|
-
const e = layout.edges[box.edgeIdx];
|
|
196
|
-
const clear = findClearPosition(box.w, box.h, e.points, obstacles);
|
|
197
|
-
if (clear) {
|
|
198
|
-
box.cx = clear.x;
|
|
199
|
-
box.cy = clear.y;
|
|
200
|
-
} else {
|
|
201
|
-
box.resolved = false;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
resolveLabelOverlaps(boxes);
|
|
205
|
-
for (const box of boxes) {
|
|
206
|
-
if (overlapsAny(box.cx, box.cy, box.w, box.h, obstacles, BOX_CLEAR_PAD))
|
|
207
|
-
box.resolved = false;
|
|
208
|
-
}
|
|
209
|
-
const boxByIdx = /* @__PURE__ */ new Map();
|
|
210
|
-
for (const b of boxes) boxByIdx.set(b.edgeIdx, b);
|
|
211
|
-
const edges = layout.edges.map((e, idx) => {
|
|
212
|
-
const b = boxByIdx.get(idx);
|
|
213
|
-
if (!b) return e;
|
|
214
|
-
return {
|
|
215
|
-
...e,
|
|
216
|
-
labelX: b.cx,
|
|
217
|
-
labelY: b.cy,
|
|
218
|
-
labelWidth: b.w,
|
|
219
|
-
labelHeight: b.h,
|
|
220
|
-
labelLines: b.lines
|
|
221
|
-
};
|
|
222
|
-
});
|
|
223
|
-
return {
|
|
224
|
-
layout: { ...layout, edges },
|
|
225
|
-
unresolved: boxes.filter((b) => !b.resolved).map((b) => b.edgeIdx)
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
|
|
229
21
|
// src/boxes-and-lines/layout.ts
|
|
230
22
|
var MARGIN = 40;
|
|
231
23
|
var MAX_PARALLEL_EDGES = 5;
|
|
@@ -236,8 +28,8 @@ var DESC_LINE_HEIGHT = 1.4;
|
|
|
236
28
|
var DESC_PADDING = 8;
|
|
237
29
|
var SEPARATOR_GAP = 4;
|
|
238
30
|
var MAX_DESC_LINES = 6;
|
|
239
|
-
var
|
|
240
|
-
var
|
|
31
|
+
var MAX_LABEL_LINES = 3;
|
|
32
|
+
var LABEL_LINE_HEIGHT = 1.3;
|
|
241
33
|
var LABEL_PAD = 12;
|
|
242
34
|
var VALUE_ROW_FONT = 11;
|
|
243
35
|
var VALUE_ROW_H = SEPARATOR_GAP + VALUE_ROW_FONT * DESC_LINE_HEIGHT + DESC_PADDING;
|
|
@@ -279,9 +71,9 @@ function estimateLabelLines(label, nodeWidth = NODE_WIDTH) {
|
|
|
279
71
|
current = word;
|
|
280
72
|
}
|
|
281
73
|
}
|
|
282
|
-
if (lines <=
|
|
74
|
+
if (lines <= MAX_LABEL_LINES) return Math.min(lines, MAX_LABEL_LINES);
|
|
283
75
|
}
|
|
284
|
-
return
|
|
76
|
+
return MAX_LABEL_LINES;
|
|
285
77
|
}
|
|
286
78
|
function computeNodeSize(node, reserveValueRow) {
|
|
287
79
|
if (!node.description || node.description.length === 0) {
|
|
@@ -289,7 +81,7 @@ function computeNodeSize(node, reserveValueRow) {
|
|
|
289
81
|
}
|
|
290
82
|
const w = DESC_NODE_WIDTH;
|
|
291
83
|
const labelLines = estimateLabelLines(node.label, w);
|
|
292
|
-
const labelHeight = labelLines * 13 *
|
|
84
|
+
const labelHeight = labelLines * 13 * LABEL_LINE_HEIGHT + LABEL_PAD;
|
|
293
85
|
const maxTextWidth = w - 24;
|
|
294
86
|
let totalRenderedLines = 0;
|
|
295
87
|
for (const line of node.description) {
|
|
@@ -312,7 +104,7 @@ function computeNodeSize(node, reserveValueRow) {
|
|
|
312
104
|
return { width: w, height: Math.max(NODE_HEIGHT, totalHeight) };
|
|
313
105
|
}
|
|
314
106
|
async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
|
|
315
|
-
const { layoutBoxesAndLinesSearch } = await import("./layout-search-
|
|
107
|
+
const { layoutBoxesAndLinesSearch } = await import("./layout-search-AW5VBDCV.js");
|
|
316
108
|
const searchOpts = {
|
|
317
109
|
...layoutOptions?.hideDescriptions !== void 0 && {
|
|
318
110
|
hideDescriptions: layoutOptions.hideDescriptions
|
|
@@ -325,6 +117,13 @@ async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
|
|
|
325
117
|
},
|
|
326
118
|
...layoutOptions?.onProgress !== void 0 && {
|
|
327
119
|
onProgress: layoutOptions.onProgress
|
|
120
|
+
},
|
|
121
|
+
// Spread into the label-reserving relayout below too, via `...searchOpts`:
|
|
122
|
+
// that second search has its OWN clock, so a caller that disabled the
|
|
123
|
+
// deadline must have it disabled for both passes or the fixture that needs
|
|
124
|
+
// two passes is exactly the one still racing.
|
|
125
|
+
...layoutOptions?.budgetMs !== void 0 && {
|
|
126
|
+
budgetMs: layoutOptions.budgetMs
|
|
328
127
|
}
|
|
329
128
|
};
|
|
330
129
|
let topConfigs;
|
|
@@ -334,7 +133,9 @@ async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
|
|
|
334
133
|
topConfigs = cfgs;
|
|
335
134
|
}
|
|
336
135
|
});
|
|
337
|
-
|
|
136
|
+
const labelOpts = { groups: parsed.groups };
|
|
137
|
+
let chosen = applyParallelEdgeOffsets(searched);
|
|
138
|
+
let placed = placeEdgeLabels(chosen, labelOpts);
|
|
338
139
|
if (placed.unresolved.length > 0) {
|
|
339
140
|
const relaid = await layoutBoxesAndLinesSearch(parsed, collapseInfo, {
|
|
340
141
|
...searchOpts,
|
|
@@ -344,9 +145,19 @@ async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
|
|
|
344
145
|
// first search surfaced no dagre candidates.
|
|
345
146
|
...topConfigs !== void 0 && topConfigs.length > 0 && { configs: topConfigs }
|
|
346
147
|
});
|
|
347
|
-
const
|
|
348
|
-
|
|
148
|
+
const relaidChosen = applyParallelEdgeOffsets(relaid);
|
|
149
|
+
const relaidPlaced = placeEdgeLabels(relaidChosen, labelOpts);
|
|
150
|
+
if (relaidPlaced.unresolved.length < placed.unresolved.length) {
|
|
349
151
|
placed = relaidPlaced;
|
|
152
|
+
chosen = relaidChosen;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (placed.unresolved.length > 0) {
|
|
156
|
+
const wide = placeEdgeLabels(chosen, {
|
|
157
|
+
...labelOpts,
|
|
158
|
+
perpMax: LABEL_REACH_WIDE
|
|
159
|
+
});
|
|
160
|
+
if (wide.unresolved.length < placed.unresolved.length) placed = wide;
|
|
350
161
|
}
|
|
351
162
|
return attachNotes(placed.layout, parsed, layoutOptions?.collapsedNotes);
|
|
352
163
|
}
|
|
@@ -517,8 +328,6 @@ function applyParallelEdgeOffsets(layout) {
|
|
|
517
328
|
}
|
|
518
329
|
|
|
519
330
|
export {
|
|
520
|
-
EDGE_LABEL_FONT_SIZE,
|
|
521
|
-
measureEdgeLabel,
|
|
522
331
|
computeNodeSize,
|
|
523
332
|
layoutBoxesAndLines
|
|
524
333
|
};
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
} from "./chunk-BAZT6CIF.js";
|
|
97
97
|
import {
|
|
98
98
|
parseDgmoChartType
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-AQIBKTPG.js";
|
|
100
100
|
import {
|
|
101
101
|
parseRaci
|
|
102
102
|
} from "./chunk-3RYBTEF5.js";
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
} from "./chunk-UNNJCSSQ.js";
|
|
107
107
|
import {
|
|
108
108
|
parseLiveLink
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-7WGCQE2E.js";
|
|
110
110
|
import {
|
|
111
111
|
makeYearContext,
|
|
112
112
|
parseDateToken,
|
|
@@ -114,8 +114,9 @@ import {
|
|
|
114
114
|
toInternal
|
|
115
115
|
} from "./chunk-DAOFNU6J.js";
|
|
116
116
|
import {
|
|
117
|
+
SEQUENCE_DIAGNOSTICS,
|
|
117
118
|
parseSequenceDgmo
|
|
118
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-VPASQOR3.js";
|
|
119
120
|
import {
|
|
120
121
|
parseFlowchart
|
|
121
122
|
} from "./chunk-JRUEIRJB.js";
|
|
@@ -1608,6 +1609,7 @@ var REGISTRY = [
|
|
|
1608
1609
|
...PERT_DIAGNOSTICS,
|
|
1609
1610
|
...GRAPH_DIAGNOSTICS,
|
|
1610
1611
|
...COLOR_DIAGNOSTICS,
|
|
1612
|
+
...SEQUENCE_DIAGNOSTICS,
|
|
1611
1613
|
...SKETCH_DIAGNOSTICS,
|
|
1612
1614
|
...FAMILY_DIAGNOSTICS,
|
|
1613
1615
|
...ALIAS_DIAGNOSTICS
|
|
@@ -25,9 +25,10 @@ import {
|
|
|
25
25
|
CARD_RADIUS,
|
|
26
26
|
CONTAINER_RADIUS,
|
|
27
27
|
EDGE_LABEL_KNOCKOUT_OPACITY,
|
|
28
|
+
EDGE_LABEL_UNRESOLVED_KNOCKOUT_OPACITY,
|
|
28
29
|
EDGE_STROKE_WIDTH,
|
|
29
30
|
NODE_STROKE_WIDTH
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-XCKNFFKM.js";
|
|
31
32
|
import {
|
|
32
33
|
layoutInlineHeader
|
|
33
34
|
} from "./chunk-3DOQOXXI.js";
|
|
@@ -741,7 +742,10 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
|
|
|
741
742
|
const lh = le.labelHeight ?? sEdgeLabelFontSize + 6;
|
|
742
743
|
const lines = le.labelLines;
|
|
743
744
|
const labelG = labelLayer.append("g").attr("class", "bl-edge-label").attr("data-line-number", String(le.lineNumber));
|
|
744
|
-
labelG.append("rect").attr("x", lx - lw / 2).attr("y", ly - lh / 2).attr("width", lw).attr("height", lh).attr("rx", 3).attr("fill", palette.bg).attr(
|
|
745
|
+
labelG.append("rect").attr("x", lx - lw / 2).attr("y", ly - lh / 2).attr("width", lw).attr("height", lh).attr("rx", 3).attr("fill", palette.bg).attr(
|
|
746
|
+
"opacity",
|
|
747
|
+
le.labelResolved === false ? EDGE_LABEL_UNRESOLVED_KNOCKOUT_OPACITY : EDGE_LABEL_KNOCKOUT_OPACITY
|
|
748
|
+
);
|
|
745
749
|
const text = labelG.append("text").attr("x", lx).attr("text-anchor", "middle").attr("font-family", FONT_FAMILY).attr("font-size", sEdgeLabelFontSize).attr("fill", palette.textMuted);
|
|
746
750
|
const firstY = ly - (lines.length - 1) / 2 * labelLineHeight + sEdgeLabelFontSize / 3;
|
|
747
751
|
lines.forEach((line2, k) => {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
mapLegendConfig,
|
|
7
7
|
mapLegendGroups,
|
|
8
8
|
parsePathRings
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BV6PKJUS.js";
|
|
10
10
|
import {
|
|
11
11
|
parseClock
|
|
12
12
|
} from "./chunk-WP2RLGDI.js";
|
|
@@ -270,6 +270,23 @@ function renderMap(container, resolved, data, palette, isDark, onClickItem, expo
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
);
|
|
273
|
+
drawMap(
|
|
274
|
+
container,
|
|
275
|
+
layout,
|
|
276
|
+
resolved,
|
|
277
|
+
palette,
|
|
278
|
+
isDark,
|
|
279
|
+
onClickItem,
|
|
280
|
+
exportDims
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
function renderMapLayout(container, layout, resolved, palette, isDark, onClickItem) {
|
|
284
|
+
d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
285
|
+
if (layout.width <= 0 || layout.height <= 0) return;
|
|
286
|
+
drawMap(container, layout, resolved, palette, isDark, onClickItem, void 0);
|
|
287
|
+
}
|
|
288
|
+
function drawMap(container, layout, resolved, palette, isDark, onClickItem, exportDims) {
|
|
289
|
+
const { width, height } = layout;
|
|
273
290
|
const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).attr("preserveAspectRatio", "xMidYMin meet").attr("xmlns", "http://www.w3.org/2000/svg").style("font-family", FONT_FAMILY).style("background", layout.background);
|
|
274
291
|
svg.append("rect").attr("width", width).attr("height", height).attr("fill", layout.background);
|
|
275
292
|
const defs = svg.append("defs");
|
|
@@ -779,5 +796,6 @@ function emitText(g, x, y, text, anchor, color, halo, withHalo, fontSize, italic
|
|
|
779
796
|
|
|
780
797
|
export {
|
|
781
798
|
renderMap,
|
|
799
|
+
renderMapLayout,
|
|
782
800
|
renderMapForExport
|
|
783
801
|
};
|