@diagrammo/dgmo 0.8.10 → 0.8.11
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 +245 -672
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.d.cts +2 -3
- package/dist/editor.d.ts +2 -3
- package/dist/editor.js.map +1 -1
- package/dist/index.cjs +306 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +304 -77
- package/dist/index.js.map +1 -1
- package/package.json +14 -17
- package/src/boxes-and-lines/renderer.ts +1 -1
- package/src/c4/layout.ts +31 -10
- package/src/d3.ts +80 -31
- package/src/echarts.ts +56 -57
- package/src/editor/index.ts +1 -2
- package/src/gantt/resolver.ts +19 -14
- package/src/index.ts +2 -0
- package/src/kanban/renderer.ts +10 -7
- package/src/label-layout.ts +286 -0
- package/src/sequence/parser.ts +4 -0
- package/src/sequence/renderer.ts +16 -3
- package/src/utils/arrows.ts +1 -1
- package/src/utils/legend-layout.ts +1 -5
- package/src/utils/legend-svg.ts +2 -2
- package/src/utils/legend-types.ts +0 -3
- package/src/utils/parsing.ts +1 -1
- package/src/utils/tag-groups.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -144,6 +144,183 @@ var init_branding = __esm({
|
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
+
// src/label-layout.ts
|
|
148
|
+
function rectsOverlap(a, b) {
|
|
149
|
+
return a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y;
|
|
150
|
+
}
|
|
151
|
+
function rectCircleOverlap(rect, circle) {
|
|
152
|
+
const nearestX = Math.max(rect.x, Math.min(circle.cx, rect.x + rect.w));
|
|
153
|
+
const nearestY = Math.max(rect.y, Math.min(circle.cy, rect.y + rect.h));
|
|
154
|
+
const dx = nearestX - circle.cx;
|
|
155
|
+
const dy = nearestY - circle.cy;
|
|
156
|
+
return dx * dx + dy * dy < circle.r * circle.r;
|
|
157
|
+
}
|
|
158
|
+
function computeQuadrantPointLabels(points, chartBounds, obstacles, pointRadius, fontSize) {
|
|
159
|
+
const labelHeight = fontSize + 4;
|
|
160
|
+
const stepSize = labelHeight + 2;
|
|
161
|
+
const minGap = pointRadius + 4;
|
|
162
|
+
const pointCircles = points.map((p) => ({
|
|
163
|
+
cx: p.cx,
|
|
164
|
+
cy: p.cy,
|
|
165
|
+
r: pointRadius
|
|
166
|
+
}));
|
|
167
|
+
const placedLabels = [];
|
|
168
|
+
const results = [];
|
|
169
|
+
for (let i = 0; i < points.length; i++) {
|
|
170
|
+
const pt = points[i];
|
|
171
|
+
const labelWidth = pt.label.length * fontSize * CHAR_WIDTH_RATIO + 8;
|
|
172
|
+
let best = null;
|
|
173
|
+
const directions = [
|
|
174
|
+
{
|
|
175
|
+
// Above
|
|
176
|
+
gen: (offset) => {
|
|
177
|
+
const lx = pt.cx - labelWidth / 2;
|
|
178
|
+
const ly = pt.cy - offset - labelHeight;
|
|
179
|
+
if (ly < chartBounds.top || lx < chartBounds.left || lx + labelWidth > chartBounds.right)
|
|
180
|
+
return null;
|
|
181
|
+
return {
|
|
182
|
+
rect: { x: lx, y: ly, w: labelWidth, h: labelHeight },
|
|
183
|
+
textX: pt.cx,
|
|
184
|
+
textY: ly + labelHeight / 2,
|
|
185
|
+
anchor: "middle"
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
// Below
|
|
191
|
+
gen: (offset) => {
|
|
192
|
+
const lx = pt.cx - labelWidth / 2;
|
|
193
|
+
const ly = pt.cy + offset;
|
|
194
|
+
if (ly + labelHeight > chartBounds.bottom || lx < chartBounds.left || lx + labelWidth > chartBounds.right)
|
|
195
|
+
return null;
|
|
196
|
+
return {
|
|
197
|
+
rect: { x: lx, y: ly, w: labelWidth, h: labelHeight },
|
|
198
|
+
textX: pt.cx,
|
|
199
|
+
textY: ly + labelHeight / 2,
|
|
200
|
+
anchor: "middle"
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
// Right
|
|
206
|
+
gen: (offset) => {
|
|
207
|
+
const lx = pt.cx + offset;
|
|
208
|
+
const ly = pt.cy - labelHeight / 2;
|
|
209
|
+
if (lx + labelWidth > chartBounds.right || ly < chartBounds.top || ly + labelHeight > chartBounds.bottom)
|
|
210
|
+
return null;
|
|
211
|
+
return {
|
|
212
|
+
rect: { x: lx, y: ly, w: labelWidth, h: labelHeight },
|
|
213
|
+
textX: lx,
|
|
214
|
+
textY: pt.cy,
|
|
215
|
+
anchor: "start"
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
// Left
|
|
221
|
+
gen: (offset) => {
|
|
222
|
+
const lx = pt.cx - offset - labelWidth;
|
|
223
|
+
const ly = pt.cy - labelHeight / 2;
|
|
224
|
+
if (lx < chartBounds.left || ly < chartBounds.top || ly + labelHeight > chartBounds.bottom)
|
|
225
|
+
return null;
|
|
226
|
+
return {
|
|
227
|
+
rect: { x: lx, y: ly, w: labelWidth, h: labelHeight },
|
|
228
|
+
textX: lx + labelWidth,
|
|
229
|
+
textY: pt.cy,
|
|
230
|
+
anchor: "end"
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
];
|
|
235
|
+
for (const { gen } of directions) {
|
|
236
|
+
for (let offset = minGap; ; offset += stepSize) {
|
|
237
|
+
const cand = gen(offset);
|
|
238
|
+
if (!cand) break;
|
|
239
|
+
let collision = false;
|
|
240
|
+
for (const pl of placedLabels) {
|
|
241
|
+
if (rectsOverlap(cand.rect, pl)) {
|
|
242
|
+
collision = true;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (!collision) {
|
|
247
|
+
for (const circle of pointCircles) {
|
|
248
|
+
if (rectCircleOverlap(cand.rect, circle)) {
|
|
249
|
+
collision = true;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (!collision) {
|
|
255
|
+
for (const obs of obstacles) {
|
|
256
|
+
if (rectsOverlap(cand.rect, obs)) {
|
|
257
|
+
collision = true;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (!collision) {
|
|
263
|
+
const dist = offset;
|
|
264
|
+
if (!best || dist < best.dist) {
|
|
265
|
+
best = {
|
|
266
|
+
rect: cand.rect,
|
|
267
|
+
textX: cand.textX,
|
|
268
|
+
textY: cand.textY,
|
|
269
|
+
anchor: cand.anchor,
|
|
270
|
+
dist
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (!best) {
|
|
278
|
+
const lx = pt.cx - labelWidth / 2;
|
|
279
|
+
const ly = pt.cy - minGap - labelHeight;
|
|
280
|
+
best = {
|
|
281
|
+
rect: { x: lx, y: ly, w: labelWidth, h: labelHeight },
|
|
282
|
+
textX: pt.cx,
|
|
283
|
+
textY: ly + labelHeight / 2,
|
|
284
|
+
anchor: "middle",
|
|
285
|
+
dist: minGap
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
placedLabels.push(best.rect);
|
|
289
|
+
let connectorLine;
|
|
290
|
+
if (best.dist > minGap + stepSize) {
|
|
291
|
+
const dx = best.textX - pt.cx;
|
|
292
|
+
const dy = best.textY - pt.cy;
|
|
293
|
+
const angle = Math.atan2(dy, dx);
|
|
294
|
+
const x1 = pt.cx + Math.cos(angle) * pointRadius;
|
|
295
|
+
const y1 = pt.cy + Math.sin(angle) * pointRadius;
|
|
296
|
+
const x2 = Math.max(
|
|
297
|
+
best.rect.x,
|
|
298
|
+
Math.min(pt.cx, best.rect.x + best.rect.w)
|
|
299
|
+
);
|
|
300
|
+
const y2 = Math.max(
|
|
301
|
+
best.rect.y,
|
|
302
|
+
Math.min(pt.cy, best.rect.y + best.rect.h)
|
|
303
|
+
);
|
|
304
|
+
connectorLine = { x1, y1, x2, y2 };
|
|
305
|
+
}
|
|
306
|
+
results.push({
|
|
307
|
+
label: pt.label,
|
|
308
|
+
x: best.textX,
|
|
309
|
+
y: best.textY,
|
|
310
|
+
anchor: best.anchor,
|
|
311
|
+
connectorLine
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
return results;
|
|
315
|
+
}
|
|
316
|
+
var CHAR_WIDTH_RATIO;
|
|
317
|
+
var init_label_layout = __esm({
|
|
318
|
+
"src/label-layout.ts"() {
|
|
319
|
+
"use strict";
|
|
320
|
+
CHAR_WIDTH_RATIO = 0.6;
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
|
|
147
324
|
// src/colors.ts
|
|
148
325
|
function resolveColor(color, palette) {
|
|
149
326
|
if (color.startsWith("#")) return null;
|
|
@@ -1814,7 +1991,7 @@ function measureLegendText(text, fontSize) {
|
|
|
1814
1991
|
}
|
|
1815
1992
|
return w;
|
|
1816
1993
|
}
|
|
1817
|
-
var LEGEND_HEIGHT, LEGEND_PILL_PAD, LEGEND_PILL_FONT_SIZE, LEGEND_CAPSULE_PAD, LEGEND_DOT_R, LEGEND_ENTRY_FONT_SIZE, LEGEND_ENTRY_DOT_GAP, LEGEND_ENTRY_TRAIL, LEGEND_GROUP_GAP, LEGEND_EYE_SIZE, LEGEND_EYE_GAP, LEGEND_ICON_W, CHAR_W, DEFAULT_W, EYE_OPEN_PATH, EYE_CLOSED_PATH;
|
|
1994
|
+
var LEGEND_HEIGHT, LEGEND_PILL_PAD, LEGEND_PILL_FONT_SIZE, LEGEND_CAPSULE_PAD, LEGEND_DOT_R, LEGEND_ENTRY_FONT_SIZE, LEGEND_ENTRY_DOT_GAP, LEGEND_ENTRY_TRAIL, LEGEND_GROUP_GAP, LEGEND_EYE_SIZE, LEGEND_EYE_GAP, LEGEND_ICON_W, LEGEND_MAX_ENTRY_ROWS, CHAR_W, DEFAULT_W, EYE_OPEN_PATH, EYE_CLOSED_PATH;
|
|
1818
1995
|
var init_legend_constants = __esm({
|
|
1819
1996
|
"src/utils/legend-constants.ts"() {
|
|
1820
1997
|
"use strict";
|
|
@@ -1830,6 +2007,7 @@ var init_legend_constants = __esm({
|
|
|
1830
2007
|
LEGEND_EYE_SIZE = 14;
|
|
1831
2008
|
LEGEND_EYE_GAP = 6;
|
|
1832
2009
|
LEGEND_ICON_W = 20;
|
|
2010
|
+
LEGEND_MAX_ENTRY_ROWS = 3;
|
|
1833
2011
|
CHAR_W = {
|
|
1834
2012
|
" ": 0.28,
|
|
1835
2013
|
"!": 0.28,
|
|
@@ -2239,12 +2417,11 @@ function getLegendReservedHeight(config, state, containerWidth) {
|
|
|
2239
2417
|
const layout = computeLegendLayout(config, state, containerWidth);
|
|
2240
2418
|
return layout.height;
|
|
2241
2419
|
}
|
|
2242
|
-
var
|
|
2420
|
+
var CONTROL_PILL_PAD, CONTROL_FONT_SIZE, CONTROL_ICON_GAP, CONTROL_GAP;
|
|
2243
2421
|
var init_legend_layout = __esm({
|
|
2244
2422
|
"src/utils/legend-layout.ts"() {
|
|
2245
2423
|
"use strict";
|
|
2246
2424
|
init_legend_constants();
|
|
2247
|
-
LEGEND_MAX_ENTRY_ROWS = 3;
|
|
2248
2425
|
CONTROL_PILL_PAD = 16;
|
|
2249
2426
|
CONTROL_FONT_SIZE = 11;
|
|
2250
2427
|
CONTROL_ICON_GAP = 4;
|
|
@@ -3455,7 +3632,8 @@ function parseSequenceDgmo(content) {
|
|
|
3455
3632
|
if (top.block.type === "if") {
|
|
3456
3633
|
const branch = {
|
|
3457
3634
|
label: elseIfMatch[1].trim(),
|
|
3458
|
-
children: []
|
|
3635
|
+
children: [],
|
|
3636
|
+
lineNumber
|
|
3459
3637
|
};
|
|
3460
3638
|
if (!top.block.elseIfBranches) top.block.elseIfBranches = [];
|
|
3461
3639
|
top.block.elseIfBranches.push(branch);
|
|
@@ -3478,6 +3656,7 @@ function parseSequenceDgmo(content) {
|
|
|
3478
3656
|
if (top.block.type === "if") {
|
|
3479
3657
|
top.inElse = true;
|
|
3480
3658
|
top.activeElseIfBranch = void 0;
|
|
3659
|
+
top.block.elseLineNumber = lineNumber;
|
|
3481
3660
|
}
|
|
3482
3661
|
}
|
|
3483
3662
|
continue;
|
|
@@ -5870,7 +6049,8 @@ function buildExtendedChartOption(parsed, palette, isDark) {
|
|
|
5870
6049
|
}
|
|
5871
6050
|
const { textColor, axisLineColor, gridOpacity, colors, titleConfig } = buildChartCommons(parsed, palette, isDark);
|
|
5872
6051
|
if (parsed.type === "sankey") {
|
|
5873
|
-
|
|
6052
|
+
const bg = isDark ? palette.surface : palette.bg;
|
|
6053
|
+
return buildSankeyOption(parsed, textColor, colors, bg, titleConfig);
|
|
5874
6054
|
}
|
|
5875
6055
|
if (parsed.type === "chord") {
|
|
5876
6056
|
const bg = isDark ? palette.surface : palette.bg;
|
|
@@ -5913,7 +6093,7 @@ function buildExtendedChartOption(parsed, palette, isDark) {
|
|
|
5913
6093
|
titleConfig
|
|
5914
6094
|
);
|
|
5915
6095
|
}
|
|
5916
|
-
function buildSankeyOption(parsed, textColor, colors, titleConfig) {
|
|
6096
|
+
function buildSankeyOption(parsed, textColor, colors, bg, titleConfig) {
|
|
5917
6097
|
const nodeSet = /* @__PURE__ */ new Set();
|
|
5918
6098
|
if (parsed.links) {
|
|
5919
6099
|
for (const link of parsed.links) {
|
|
@@ -5921,12 +6101,15 @@ function buildSankeyOption(parsed, textColor, colors, titleConfig) {
|
|
|
5921
6101
|
nodeSet.add(link.target);
|
|
5922
6102
|
}
|
|
5923
6103
|
}
|
|
5924
|
-
const
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
6104
|
+
const tintNode = (c) => mix(c, bg, 75);
|
|
6105
|
+
const tintLink = (c) => mix(c, bg, 45);
|
|
6106
|
+
const nodeColorMap = /* @__PURE__ */ new Map();
|
|
6107
|
+
const nodes = Array.from(nodeSet).map((name, index) => {
|
|
6108
|
+
const raw = parsed.nodeColors?.[name] ?? colors[index % colors.length];
|
|
6109
|
+
const tinted = tintNode(raw);
|
|
6110
|
+
nodeColorMap.set(name, tintLink(raw));
|
|
6111
|
+
return { name, itemStyle: { color: tinted } };
|
|
6112
|
+
});
|
|
5930
6113
|
return {
|
|
5931
6114
|
...CHART_BASE,
|
|
5932
6115
|
title: titleConfig,
|
|
@@ -5949,11 +6132,13 @@ function buildSankeyOption(parsed, textColor, colors, titleConfig) {
|
|
|
5949
6132
|
source: link.source,
|
|
5950
6133
|
target: link.target,
|
|
5951
6134
|
value: link.value,
|
|
5952
|
-
|
|
6135
|
+
lineStyle: {
|
|
6136
|
+
color: link.color ? tintLink(link.color) : nodeColorMap.get(link.source)
|
|
6137
|
+
}
|
|
5953
6138
|
})),
|
|
5954
6139
|
lineStyle: {
|
|
5955
|
-
|
|
5956
|
-
|
|
6140
|
+
curveness: 0.5,
|
|
6141
|
+
opacity: 0.6
|
|
5957
6142
|
},
|
|
5958
6143
|
label: {
|
|
5959
6144
|
color: textColor,
|
|
@@ -6210,16 +6395,6 @@ function getExtendedChartLegendGroups(parsed, colors) {
|
|
|
6210
6395
|
}
|
|
6211
6396
|
return [];
|
|
6212
6397
|
}
|
|
6213
|
-
function rectsOverlap(a, b) {
|
|
6214
|
-
return a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y;
|
|
6215
|
-
}
|
|
6216
|
-
function rectCircleOverlap(rect, circle) {
|
|
6217
|
-
const nearestX = Math.max(rect.x, Math.min(circle.cx, rect.x + rect.w));
|
|
6218
|
-
const nearestY = Math.max(rect.y, Math.min(circle.cy, rect.y + rect.h));
|
|
6219
|
-
const dx = nearestX - circle.cx;
|
|
6220
|
-
const dy = nearestY - circle.cy;
|
|
6221
|
-
return dx * dx + dy * dy < circle.r * circle.r;
|
|
6222
|
-
}
|
|
6223
6398
|
function computeScatterLabelGraphics(points, chartBounds, fontSize, symbolSize, bg) {
|
|
6224
6399
|
const labelHeight = fontSize + 4;
|
|
6225
6400
|
const stepSize = labelHeight + 2;
|
|
@@ -6596,12 +6771,17 @@ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, t
|
|
|
6596
6771
|
maxValue = Math.max(maxValue, value);
|
|
6597
6772
|
});
|
|
6598
6773
|
});
|
|
6774
|
+
const CHAR_WIDTH7 = 7;
|
|
6775
|
+
const ESTIMATED_CHART_WIDTH = 900;
|
|
6776
|
+
const longestCol = Math.max(...columns.map((c) => c.length), 0);
|
|
6777
|
+
const slotWidth = columns.length > 0 ? ESTIMATED_CHART_WIDTH / columns.length : Infinity;
|
|
6778
|
+
const needsRotation = longestCol * CHAR_WIDTH7 > slotWidth * 0.85;
|
|
6599
6779
|
return {
|
|
6600
6780
|
...CHART_BASE,
|
|
6601
6781
|
title: titleConfig,
|
|
6602
6782
|
grid: {
|
|
6603
6783
|
left: "3%",
|
|
6604
|
-
right: "
|
|
6784
|
+
right: "3%",
|
|
6605
6785
|
bottom: "3%",
|
|
6606
6786
|
top: parsed.title ? "15%" : "5%",
|
|
6607
6787
|
containLabel: true
|
|
@@ -6609,6 +6789,7 @@ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, t
|
|
|
6609
6789
|
xAxis: {
|
|
6610
6790
|
type: "category",
|
|
6611
6791
|
data: columns,
|
|
6792
|
+
position: "top",
|
|
6612
6793
|
splitArea: {
|
|
6613
6794
|
show: true
|
|
6614
6795
|
},
|
|
@@ -6617,12 +6798,19 @@ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, t
|
|
|
6617
6798
|
},
|
|
6618
6799
|
axisLabel: {
|
|
6619
6800
|
color: textColor,
|
|
6620
|
-
fontSize:
|
|
6801
|
+
fontSize: 12,
|
|
6802
|
+
interval: 0,
|
|
6803
|
+
...needsRotation && {
|
|
6804
|
+
rotate: -45,
|
|
6805
|
+
width: 200,
|
|
6806
|
+
overflow: "none"
|
|
6807
|
+
}
|
|
6621
6808
|
}
|
|
6622
6809
|
},
|
|
6623
6810
|
yAxis: {
|
|
6624
6811
|
type: "category",
|
|
6625
6812
|
data: rowLabels,
|
|
6813
|
+
inverse: true,
|
|
6626
6814
|
splitArea: {
|
|
6627
6815
|
show: true
|
|
6628
6816
|
},
|
|
@@ -6631,16 +6819,14 @@ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, t
|
|
|
6631
6819
|
},
|
|
6632
6820
|
axisLabel: {
|
|
6633
6821
|
color: textColor,
|
|
6634
|
-
fontSize:
|
|
6822
|
+
fontSize: 12,
|
|
6823
|
+
interval: 0
|
|
6635
6824
|
}
|
|
6636
6825
|
},
|
|
6637
6826
|
visualMap: {
|
|
6827
|
+
show: false,
|
|
6638
6828
|
min: minValue,
|
|
6639
6829
|
max: maxValue,
|
|
6640
|
-
calculable: true,
|
|
6641
|
-
orient: "vertical",
|
|
6642
|
-
right: "2%",
|
|
6643
|
-
top: "center",
|
|
6644
6830
|
inRange: {
|
|
6645
6831
|
color: [
|
|
6646
6832
|
mix(palette.primary, bg, 30),
|
|
@@ -6648,9 +6834,6 @@ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, t
|
|
|
6648
6834
|
mix(palette.colors.yellow, bg, 30),
|
|
6649
6835
|
mix(palette.colors.orange, bg, 30)
|
|
6650
6836
|
]
|
|
6651
|
-
},
|
|
6652
|
-
textStyle: {
|
|
6653
|
-
color: textColor
|
|
6654
6837
|
}
|
|
6655
6838
|
},
|
|
6656
6839
|
series: [
|
|
@@ -6668,9 +6851,8 @@ function buildHeatmapOption(parsed, palette, isDark, textColor, axisLineColor, t
|
|
|
6668
6851
|
fontWeight: "bold"
|
|
6669
6852
|
},
|
|
6670
6853
|
emphasis: {
|
|
6671
|
-
|
|
6672
|
-
}
|
|
6673
|
-
blur: BLUR_DIM
|
|
6854
|
+
disabled: true
|
|
6855
|
+
}
|
|
6674
6856
|
}
|
|
6675
6857
|
]
|
|
6676
6858
|
};
|
|
@@ -7525,6 +7707,7 @@ var init_echarts = __esm({
|
|
|
7525
7707
|
init_fonts();
|
|
7526
7708
|
init_branding();
|
|
7527
7709
|
init_legend_svg();
|
|
7710
|
+
init_label_layout();
|
|
7528
7711
|
init_palettes();
|
|
7529
7712
|
init_color_utils();
|
|
7530
7713
|
init_chart();
|
|
@@ -14092,8 +14275,7 @@ function computeLayout(parsed, _palette) {
|
|
|
14092
14275
|
currentX += cl.width + COLUMN_GAP;
|
|
14093
14276
|
}
|
|
14094
14277
|
const totalWidth = currentX - COLUMN_GAP + DIAGRAM_PADDING3;
|
|
14095
|
-
const
|
|
14096
|
-
const totalHeight = startY + maxColumnHeight + DIAGRAM_PADDING3 + legendSpace;
|
|
14278
|
+
const totalHeight = startY + maxColumnHeight + DIAGRAM_PADDING3;
|
|
14097
14279
|
return { columns: columnLayouts, totalWidth, totalHeight };
|
|
14098
14280
|
}
|
|
14099
14281
|
function renderKanban(container, parsed, palette, isDark, _onNavigateToLine, exportDims, activeTagGroup) {
|
|
@@ -14106,14 +14288,16 @@ function renderKanban(container, parsed, palette, isDark, _onNavigateToLine, exp
|
|
|
14106
14288
|
svg.append("text").attr("class", "chart-title").attr("data-line-number", parsed.titleLineNumber ?? 0).attr("x", DIAGRAM_PADDING3).attr("y", DIAGRAM_PADDING3 + TITLE_FONT_SIZE).attr("font-size", TITLE_FONT_SIZE).attr("font-weight", TITLE_FONT_WEIGHT).attr("fill", palette.text).text(parsed.title);
|
|
14107
14289
|
}
|
|
14108
14290
|
if (parsed.tagGroups.length > 0) {
|
|
14109
|
-
const
|
|
14291
|
+
const titleTextWidth = parsed.title ? measureLegendText(parsed.title, TITLE_FONT_SIZE) + 16 : 0;
|
|
14292
|
+
const legendX = DIAGRAM_PADDING3 + titleTextWidth;
|
|
14293
|
+
const legendY = DIAGRAM_PADDING3 + (TITLE_FONT_SIZE - LEGEND_HEIGHT) / 2;
|
|
14110
14294
|
const legendConfig = {
|
|
14111
14295
|
groups: parsed.tagGroups,
|
|
14112
14296
|
position: { placement: "top-center", titleRelation: "below-title" },
|
|
14113
14297
|
mode: exportDims ? "inline" : "fixed"
|
|
14114
14298
|
};
|
|
14115
14299
|
const legendState = { activeGroup: activeTagGroup ?? null };
|
|
14116
|
-
const legendG = svg.append("g").attr("class", "kanban-legend").attr("transform", `translate(${
|
|
14300
|
+
const legendG = svg.append("g").attr("class", "kanban-legend").attr("transform", `translate(${legendX},${legendY})`);
|
|
14117
14301
|
renderLegendD3(
|
|
14118
14302
|
legendG,
|
|
14119
14303
|
legendConfig,
|
|
@@ -14121,7 +14305,7 @@ function renderKanban(container, parsed, palette, isDark, _onNavigateToLine, exp
|
|
|
14121
14305
|
palette,
|
|
14122
14306
|
isDark,
|
|
14123
14307
|
void 0,
|
|
14124
|
-
width -
|
|
14308
|
+
width - legendX - DIAGRAM_PADDING3
|
|
14125
14309
|
);
|
|
14126
14310
|
}
|
|
14127
14311
|
const defaultColBg = isDark ? mix(palette.surface, palette.bg, 50) : mix(palette.surface, palette.bg, 30);
|
|
@@ -15662,7 +15846,7 @@ function fitTextToNode(label, nodeWidth, nodeHeight) {
|
|
|
15662
15846
|
const maxTextWidth = nodeWidth - NODE_TEXT_PADDING * 2;
|
|
15663
15847
|
const lineHeight = 1.3;
|
|
15664
15848
|
for (let fontSize = NODE_FONT_SIZE; fontSize >= MIN_NODE_FONT_SIZE; fontSize--) {
|
|
15665
|
-
const charWidth2 = fontSize *
|
|
15849
|
+
const charWidth2 = fontSize * CHAR_WIDTH_RATIO2;
|
|
15666
15850
|
const maxCharsPerLine = Math.floor(maxTextWidth / charWidth2);
|
|
15667
15851
|
const maxLines = Math.floor((nodeHeight - 8) / (fontSize * lineHeight));
|
|
15668
15852
|
if (maxCharsPerLine < 2 || maxLines < 1) continue;
|
|
@@ -15714,7 +15898,7 @@ function fitTextToNode(label, nodeWidth, nodeHeight) {
|
|
|
15714
15898
|
}
|
|
15715
15899
|
if (hardLines.length <= maxLines) return { lines: hardLines, fontSize };
|
|
15716
15900
|
}
|
|
15717
|
-
const charWidth = MIN_NODE_FONT_SIZE *
|
|
15901
|
+
const charWidth = MIN_NODE_FONT_SIZE * CHAR_WIDTH_RATIO2;
|
|
15718
15902
|
const maxChars = Math.floor((nodeWidth - NODE_TEXT_PADDING * 2) / charWidth);
|
|
15719
15903
|
const truncated = label.length > maxChars ? label.slice(0, maxChars - 1) + "\u2026" : label;
|
|
15720
15904
|
return { lines: [truncated], fontSize: MIN_NODE_FONT_SIZE };
|
|
@@ -15873,7 +16057,7 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
|
|
|
15873
16057
|
path.attr("marker-start", `url(#${revId})`);
|
|
15874
16058
|
}
|
|
15875
16059
|
if (le.label && le.labelX != null && le.labelY != null) {
|
|
15876
|
-
const lw = le.label.length * EDGE_LABEL_FONT_SIZE4 *
|
|
16060
|
+
const lw = le.label.length * EDGE_LABEL_FONT_SIZE4 * CHAR_WIDTH_RATIO2;
|
|
15877
16061
|
labelPositions.push({
|
|
15878
16062
|
x: le.labelX,
|
|
15879
16063
|
y: le.labelY + le.yOffset,
|
|
@@ -15931,7 +16115,7 @@ function renderBoxesAndLines(container, parsed, layout, palette, isDark, options
|
|
|
15931
16115
|
const descY = labelY + lineH / 2 + gap + META_FONT_SIZE3 / 2;
|
|
15932
16116
|
nodeG.append("text").attr("x", 0).attr("y", labelY).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", NODE_FONT_SIZE).attr("font-weight", "600").attr("fill", colors.text).text(node.label);
|
|
15933
16117
|
const maxChars = Math.floor(
|
|
15934
|
-
(ln.width - NODE_TEXT_PADDING * 2) / (META_FONT_SIZE3 *
|
|
16118
|
+
(ln.width - NODE_TEXT_PADDING * 2) / (META_FONT_SIZE3 * CHAR_WIDTH_RATIO2)
|
|
15935
16119
|
);
|
|
15936
16120
|
const desc = node.description.length > maxChars ? node.description.slice(0, maxChars - 1) + "\u2026" : node.description;
|
|
15937
16121
|
const descEl = nodeG.append("text").attr("x", 0).attr("y", descY).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", META_FONT_SIZE3).attr("fill", palette.textMuted).text(desc);
|
|
@@ -15972,7 +16156,7 @@ function renderBoxesAndLinesForExport(container, parsed, layout, palette, isDark
|
|
|
15972
16156
|
exportDims: options?.exportDims
|
|
15973
16157
|
});
|
|
15974
16158
|
}
|
|
15975
|
-
var d3Selection6, d3Shape4, DIAGRAM_PADDING6, NODE_FONT_SIZE, MIN_NODE_FONT_SIZE, META_FONT_SIZE3, EDGE_LABEL_FONT_SIZE4, EDGE_STROKE_WIDTH5, NODE_STROKE_WIDTH5, NODE_RX, COLLAPSE_BAR_HEIGHT3, ARROWHEAD_W2, ARROWHEAD_H2,
|
|
16159
|
+
var d3Selection6, d3Shape4, DIAGRAM_PADDING6, NODE_FONT_SIZE, MIN_NODE_FONT_SIZE, META_FONT_SIZE3, EDGE_LABEL_FONT_SIZE4, EDGE_STROKE_WIDTH5, NODE_STROKE_WIDTH5, NODE_RX, COLLAPSE_BAR_HEIGHT3, ARROWHEAD_W2, ARROWHEAD_H2, CHAR_WIDTH_RATIO2, NODE_TEXT_PADDING, GROUP_RX, GROUP_LABEL_FONT_SIZE, lineGeneratorLR, lineGeneratorTB, lineGeneratorLinear2;
|
|
15976
16160
|
var init_renderer6 = __esm({
|
|
15977
16161
|
"src/boxes-and-lines/renderer.ts"() {
|
|
15978
16162
|
"use strict";
|
|
@@ -15995,7 +16179,7 @@ var init_renderer6 = __esm({
|
|
|
15995
16179
|
COLLAPSE_BAR_HEIGHT3 = 4;
|
|
15996
16180
|
ARROWHEAD_W2 = 5;
|
|
15997
16181
|
ARROWHEAD_H2 = 4;
|
|
15998
|
-
|
|
16182
|
+
CHAR_WIDTH_RATIO2 = 0.6;
|
|
15999
16183
|
NODE_TEXT_PADDING = 12;
|
|
16000
16184
|
GROUP_RX = 8;
|
|
16001
16185
|
GROUP_LABEL_FONT_SIZE = 14;
|
|
@@ -16066,7 +16250,7 @@ function reduceCrossings(g, edgeList, nodeGroupMap) {
|
|
|
16066
16250
|
}
|
|
16067
16251
|
const nodeGeometry = /* @__PURE__ */ new Map();
|
|
16068
16252
|
for (const name of g.nodes()) {
|
|
16069
|
-
const pos = g
|
|
16253
|
+
const pos = gNode(g, name);
|
|
16070
16254
|
if (pos)
|
|
16071
16255
|
nodeGeometry.set(name, {
|
|
16072
16256
|
y: pos.y,
|
|
@@ -16076,14 +16260,14 @@ function reduceCrossings(g, edgeList, nodeGroupMap) {
|
|
|
16076
16260
|
}
|
|
16077
16261
|
const rankMap = /* @__PURE__ */ new Map();
|
|
16078
16262
|
for (const name of g.nodes()) {
|
|
16079
|
-
const pos = g
|
|
16263
|
+
const pos = gNode(g, name);
|
|
16080
16264
|
if (!pos) continue;
|
|
16081
16265
|
const rankY = Math.round(pos.y);
|
|
16082
16266
|
if (!rankMap.has(rankY)) rankMap.set(rankY, []);
|
|
16083
16267
|
rankMap.get(rankY).push(name);
|
|
16084
16268
|
}
|
|
16085
16269
|
for (const [, rankNodes] of rankMap) {
|
|
16086
|
-
rankNodes.sort((a, b) => g
|
|
16270
|
+
rankNodes.sort((a, b) => gNode(g, a).x - gNode(g, b).x);
|
|
16087
16271
|
}
|
|
16088
16272
|
let anyMoved = false;
|
|
16089
16273
|
for (const [, rankNodes] of rankMap) {
|
|
@@ -16110,10 +16294,10 @@ function reduceCrossings(g, edgeList, nodeGroupMap) {
|
|
|
16110
16294
|
}
|
|
16111
16295
|
for (const partition of partitions) {
|
|
16112
16296
|
if (partition.length < 2) continue;
|
|
16113
|
-
const xSlots = partition.map((name) => g
|
|
16297
|
+
const xSlots = partition.map((name) => gNode(g, name).x).sort((a, b) => a - b);
|
|
16114
16298
|
const basePositions = /* @__PURE__ */ new Map();
|
|
16115
16299
|
for (const name of g.nodes()) {
|
|
16116
|
-
const pos = g
|
|
16300
|
+
const pos = gNode(g, name);
|
|
16117
16301
|
if (pos) basePositions.set(name, pos.x);
|
|
16118
16302
|
}
|
|
16119
16303
|
const currentPenalty = computeEdgePenalty(
|
|
@@ -16191,7 +16375,7 @@ function reduceCrossings(g, edgeList, nodeGroupMap) {
|
|
|
16191
16375
|
}
|
|
16192
16376
|
if (bestPerm.some((name, i) => name !== partition[i])) {
|
|
16193
16377
|
for (let i = 0; i < bestPerm.length; i++) {
|
|
16194
|
-
g
|
|
16378
|
+
gNode(g, bestPerm[i]).x = xSlots[i];
|
|
16195
16379
|
const rankIdx = rankNodes.indexOf(partition[i]);
|
|
16196
16380
|
if (rankIdx >= 0) rankNodes[rankIdx] = bestPerm[i];
|
|
16197
16381
|
}
|
|
@@ -16201,10 +16385,10 @@ function reduceCrossings(g, edgeList, nodeGroupMap) {
|
|
|
16201
16385
|
}
|
|
16202
16386
|
if (anyMoved) {
|
|
16203
16387
|
for (const edge of edgeList) {
|
|
16204
|
-
const edgeData = g
|
|
16388
|
+
const edgeData = gEdge(g, edge.source, edge.target);
|
|
16205
16389
|
if (!edgeData) continue;
|
|
16206
|
-
const srcPos = g
|
|
16207
|
-
const tgtPos = g
|
|
16390
|
+
const srcPos = gNode(g, edge.source);
|
|
16391
|
+
const tgtPos = gNode(g, edge.target);
|
|
16208
16392
|
if (!srcPos || !tgtPos) continue;
|
|
16209
16393
|
const srcBottom = { x: srcPos.x, y: srcPos.y + srcPos.height / 2 };
|
|
16210
16394
|
const tgtTop = { x: tgtPos.x, y: tgtPos.y - tgtPos.height / 2 };
|
|
@@ -17648,12 +17832,14 @@ function layoutC4Deployment(parsed, activeTagGroup) {
|
|
|
17648
17832
|
height: totalHeight
|
|
17649
17833
|
};
|
|
17650
17834
|
}
|
|
17651
|
-
var import_dagre5, CHAR_WIDTH5, MIN_NODE_WIDTH, MAX_NODE_WIDTH, TYPE_LABEL_HEIGHT, DIVIDER_GAP, NAME_HEIGHT, DESC_LINE_HEIGHT, DESC_CHAR_WIDTH, CARD_V_PAD3, CARD_H_PAD3, META_LINE_HEIGHT5, META_CHAR_WIDTH, MARGIN4, BOUNDARY_PAD, GROUP_BOUNDARY_PAD, LEGEND_HEIGHT4, LEGEND_PILL_PAD4, LEGEND_DOT_R4, LEGEND_ENTRY_DOT_GAP4, LEGEND_ENTRY_TRAIL4, LEGEND_CAPSULE_PAD4, EDGE_NODE_COLLISION_WEIGHT, META_EXCLUDE_KEYS;
|
|
17835
|
+
var import_dagre5, gNode, gEdge, CHAR_WIDTH5, MIN_NODE_WIDTH, MAX_NODE_WIDTH, TYPE_LABEL_HEIGHT, DIVIDER_GAP, NAME_HEIGHT, DESC_LINE_HEIGHT, DESC_CHAR_WIDTH, CARD_V_PAD3, CARD_H_PAD3, META_LINE_HEIGHT5, META_CHAR_WIDTH, MARGIN4, BOUNDARY_PAD, GROUP_BOUNDARY_PAD, LEGEND_HEIGHT4, LEGEND_PILL_PAD4, LEGEND_DOT_R4, LEGEND_ENTRY_DOT_GAP4, LEGEND_ENTRY_TRAIL4, LEGEND_CAPSULE_PAD4, EDGE_NODE_COLLISION_WEIGHT, META_EXCLUDE_KEYS;
|
|
17652
17836
|
var init_layout6 = __esm({
|
|
17653
17837
|
"src/c4/layout.ts"() {
|
|
17654
17838
|
"use strict";
|
|
17655
17839
|
import_dagre5 = __toESM(require("@dagrejs/dagre"), 1);
|
|
17656
17840
|
init_legend_constants();
|
|
17841
|
+
gNode = (g, name) => g.node(name);
|
|
17842
|
+
gEdge = (g, v, w) => g.edge(v, w);
|
|
17657
17843
|
CHAR_WIDTH5 = 8;
|
|
17658
17844
|
MIN_NODE_WIDTH = 160;
|
|
17659
17845
|
MAX_NODE_WIDTH = 260;
|
|
@@ -25456,7 +25642,8 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
25456
25642
|
for (const branch of el.elseIfBranches) {
|
|
25457
25643
|
elseIfBranchData.push({
|
|
25458
25644
|
label: branch.label,
|
|
25459
|
-
indices: collectMsgIndices(branch.children)
|
|
25645
|
+
indices: collectMsgIndices(branch.children),
|
|
25646
|
+
lineNumber: branch.lineNumber
|
|
25460
25647
|
});
|
|
25461
25648
|
}
|
|
25462
25649
|
}
|
|
@@ -25517,14 +25704,16 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
25517
25704
|
x1: frameX,
|
|
25518
25705
|
y1: dividerY,
|
|
25519
25706
|
x2: frameX + frameW,
|
|
25520
|
-
y2: dividerY
|
|
25707
|
+
y2: dividerY,
|
|
25708
|
+
blockLine: branchData.lineNumber
|
|
25521
25709
|
});
|
|
25522
25710
|
deferredLabels.push({
|
|
25523
25711
|
x: frameX + 6,
|
|
25524
25712
|
y: dividerY + 14,
|
|
25525
25713
|
text: `else if ${branchData.label}`,
|
|
25526
25714
|
bold: false,
|
|
25527
|
-
italic: true
|
|
25715
|
+
italic: true,
|
|
25716
|
+
blockLine: branchData.lineNumber
|
|
25528
25717
|
});
|
|
25529
25718
|
}
|
|
25530
25719
|
}
|
|
@@ -25542,14 +25731,16 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
25542
25731
|
x1: frameX,
|
|
25543
25732
|
y1: dividerY,
|
|
25544
25733
|
x2: frameX + frameW,
|
|
25545
|
-
y2: dividerY
|
|
25734
|
+
y2: dividerY,
|
|
25735
|
+
blockLine: el.elseLineNumber
|
|
25546
25736
|
});
|
|
25547
25737
|
deferredLabels.push({
|
|
25548
25738
|
x: frameX + 6,
|
|
25549
25739
|
y: dividerY + 14,
|
|
25550
25740
|
text: "else",
|
|
25551
25741
|
bold: false,
|
|
25552
|
-
italic: true
|
|
25742
|
+
italic: true,
|
|
25743
|
+
blockLine: el.elseLineNumber
|
|
25553
25744
|
});
|
|
25554
25745
|
}
|
|
25555
25746
|
}
|
|
@@ -25595,7 +25786,9 @@ function renderSequenceDiagram(container, parsed, palette, isDark, _onNavigateTo
|
|
|
25595
25786
|
}
|
|
25596
25787
|
});
|
|
25597
25788
|
for (const ln of deferredLines) {
|
|
25598
|
-
svg.append("line").attr("x1", ln.x1).attr("y1", ln.y1).attr("x2", ln.x2).attr("y2", ln.y2).attr("stroke", palette.textMuted).attr("stroke-width", 1).attr("stroke-dasharray", "2 3");
|
|
25789
|
+
const line10 = svg.append("line").attr("x1", ln.x1).attr("y1", ln.y1).attr("x2", ln.x2).attr("y2", ln.y2).attr("stroke", palette.textMuted).attr("stroke-width", 1).attr("stroke-dasharray", "2 3").attr("class", "block-divider");
|
|
25790
|
+
if (ln.blockLine !== void 0)
|
|
25791
|
+
line10.attr("data-block-line", String(ln.blockLine));
|
|
25599
25792
|
}
|
|
25600
25793
|
for (const lbl of deferredLabels) {
|
|
25601
25794
|
const t = svg.append("text").attr("x", lbl.x).attr("y", lbl.y).attr("fill", palette.text).attr("font-size", 11).attr("class", "block-label").text(lbl.text);
|
|
@@ -28415,7 +28608,7 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
28415
28608
|
}
|
|
28416
28609
|
evG.append("rect").attr("x", x).attr("y", y - BAR_H2 / 2).attr("width", rectW).attr("height", BAR_H2).attr("rx", 4).attr("fill", fill2).attr("stroke", stroke2).attr("stroke-width", 2);
|
|
28417
28610
|
if (labelFitsInside) {
|
|
28418
|
-
evG.append("text").attr("x", x + 8).attr("y", y).attr("dy", "0.35em").attr("text-anchor", "start").attr("fill", textColor).attr("font-size", "
|
|
28611
|
+
evG.append("text").attr("x", x + 8).attr("y", y).attr("dy", "0.35em").attr("text-anchor", "start").attr("fill", textColor).attr("font-size", "13px").text(ev.label);
|
|
28419
28612
|
} else {
|
|
28420
28613
|
const wouldFlipLeft = x + rectW > innerWidth * 0.6;
|
|
28421
28614
|
const labelFitsLeft = x - 6 - estLabelWidth > 0;
|
|
@@ -28569,7 +28762,7 @@ function renderTimeline(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
28569
28762
|
}
|
|
28570
28763
|
evG.append("rect").attr("x", x).attr("y", y - BAR_H2 / 2).attr("width", rectW).attr("height", BAR_H2).attr("rx", 4).attr("fill", fill2).attr("stroke", stroke2).attr("stroke-width", 2);
|
|
28571
28764
|
if (labelFitsInside) {
|
|
28572
|
-
evG.append("text").attr("x", x + 8).attr("y", y).attr("dy", "0.35em").attr("text-anchor", "start").attr("fill", textColor).attr("font-size", "
|
|
28765
|
+
evG.append("text").attr("x", x + 8).attr("y", y).attr("dy", "0.35em").attr("text-anchor", "start").attr("fill", textColor).attr("font-size", "13px").text(ev.label);
|
|
28573
28766
|
} else {
|
|
28574
28767
|
const wouldFlipLeft = x + rectW > innerWidth * 0.6;
|
|
28575
28768
|
const labelFitsLeft = x - 6 - estLabelWidth > 0;
|
|
@@ -28937,7 +29130,7 @@ function regionCentroid(circles, inside) {
|
|
|
28937
29130
|
}
|
|
28938
29131
|
function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims) {
|
|
28939
29132
|
const { vennSets, vennOverlaps, title } = parsed;
|
|
28940
|
-
if (vennSets.length < 2) return;
|
|
29133
|
+
if (vennSets.length < 2 || vennSets.length > 3) return;
|
|
28941
29134
|
const init2 = initD3Chart(container, palette, exportDims);
|
|
28942
29135
|
if (!init2) return;
|
|
28943
29136
|
const { svg, width, height, textColor, colors } = init2;
|
|
@@ -28993,7 +29186,9 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
|
|
|
28993
29186
|
marginBottom
|
|
28994
29187
|
).map((c) => ({ ...c, y: c.y + titleHeight }));
|
|
28995
29188
|
const scaledR = circles[0].r;
|
|
28996
|
-
svg.append("style").text(
|
|
29189
|
+
svg.append("style").text(
|
|
29190
|
+
"circle:focus, circle:focus-visible { outline-solid: none !important; }"
|
|
29191
|
+
);
|
|
28997
29192
|
renderChartTitle(
|
|
28998
29193
|
svg,
|
|
28999
29194
|
title,
|
|
@@ -29175,7 +29370,7 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
|
|
|
29175
29370
|
}
|
|
29176
29371
|
const hoverGroup = svg.append("g");
|
|
29177
29372
|
circles.forEach((c, i) => {
|
|
29178
|
-
hoverGroup.append("circle").attr("cx", c.x).attr("cy", c.y).attr("r", c.r).attr("fill", "transparent").attr("stroke", "none").attr("class", "venn-hit-target").attr("data-line-number", String(vennSets[i].lineNumber)).style("cursor", onClickItem ? "pointer" : "default").style("outline", "none").on("mouseenter", () => {
|
|
29373
|
+
hoverGroup.append("circle").attr("cx", c.x).attr("cy", c.y).attr("r", c.r).attr("fill", "transparent").attr("stroke", "none").attr("class", "venn-hit-target").attr("data-line-number", String(vennSets[i].lineNumber)).style("cursor", onClickItem ? "pointer" : "default").style("outline-solid", "none").on("mouseenter", () => {
|
|
29179
29374
|
showRegionOverlay([i]);
|
|
29180
29375
|
}).on("mouseleave", () => {
|
|
29181
29376
|
hideAllOverlays();
|
|
@@ -29213,7 +29408,7 @@ function renderVenn(container, parsed, palette, isDark, onClickItem, exportDims)
|
|
|
29213
29408
|
const declaredOv = vennOverlaps.find(
|
|
29214
29409
|
(ov) => ov.sets.length === sets.length && ov.sets.every((s, k) => s === sets[k])
|
|
29215
29410
|
);
|
|
29216
|
-
hoverGroup.append("circle").attr("cx", centroid.x).attr("cy", centroid.y).attr("r", overlayR).attr("fill", "transparent").attr("stroke", "none").attr("class", "venn-hit-target").attr("data-line-number", declaredOv ? String(declaredOv.lineNumber) : "").style("cursor", onClickItem && declaredOv ? "pointer" : "default").style("outline", "none").on("mouseenter", () => {
|
|
29411
|
+
hoverGroup.append("circle").attr("cx", centroid.x).attr("cy", centroid.y).attr("r", overlayR).attr("fill", "transparent").attr("stroke", "none").attr("class", "venn-hit-target").attr("data-line-number", declaredOv ? String(declaredOv.lineNumber) : "").style("cursor", onClickItem && declaredOv ? "pointer" : "default").style("outline-solid", "none").on("mouseenter", () => {
|
|
29217
29412
|
showRegionOverlay(idxs);
|
|
29218
29413
|
}).on("mouseleave", () => {
|
|
29219
29414
|
hideAllOverlays();
|
|
@@ -29347,8 +29542,8 @@ function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
29347
29542
|
const LABEL_MAX_FONT = 48;
|
|
29348
29543
|
const LABEL_MIN_FONT = 14;
|
|
29349
29544
|
const LABEL_PAD2 = 40;
|
|
29350
|
-
const
|
|
29351
|
-
const estTextWidth = (text, fontSize) => text.length * fontSize *
|
|
29545
|
+
const CHAR_WIDTH_RATIO3 = 0.6;
|
|
29546
|
+
const estTextWidth = (text, fontSize) => text.length * fontSize * CHAR_WIDTH_RATIO3;
|
|
29352
29547
|
const quadrantLabelLayout = (text, qw2, qh2) => {
|
|
29353
29548
|
const availW = qw2 - LABEL_PAD2;
|
|
29354
29549
|
const availH = qh2 - LABEL_PAD2;
|
|
@@ -29492,16 +29687,45 @@ function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
29492
29687
|
if (x < 0.5 && y < 0.5) return "bottom-left";
|
|
29493
29688
|
return "bottom-right";
|
|
29494
29689
|
};
|
|
29690
|
+
const POINT_RADIUS = 6;
|
|
29691
|
+
const POINT_LABEL_FONT_SIZE = 12;
|
|
29692
|
+
const quadrantLabelObstacles = quadrantDefsWithLabel.map((d) => {
|
|
29693
|
+
const layout = labelLayouts.get(d.label.text);
|
|
29694
|
+
const totalW = Math.max(...layout.lines.map((l) => l.length)) * layout.fontSize * CHAR_WIDTH_RATIO3;
|
|
29695
|
+
const totalH = layout.lines.length * layout.fontSize * 1.2;
|
|
29696
|
+
return {
|
|
29697
|
+
x: d.labelX - totalW / 2,
|
|
29698
|
+
y: d.labelY - totalH / 2,
|
|
29699
|
+
w: totalW,
|
|
29700
|
+
h: totalH
|
|
29701
|
+
};
|
|
29702
|
+
});
|
|
29703
|
+
const pointPixels = quadrantPoints.map((point) => ({
|
|
29704
|
+
label: point.label,
|
|
29705
|
+
cx: xScale(point.x),
|
|
29706
|
+
cy: yScale(point.y)
|
|
29707
|
+
}));
|
|
29708
|
+
const placedPointLabels = computeQuadrantPointLabels(
|
|
29709
|
+
pointPixels,
|
|
29710
|
+
{ left: 0, top: 0, right: chartWidth, bottom: chartHeight },
|
|
29711
|
+
quadrantLabelObstacles,
|
|
29712
|
+
POINT_RADIUS,
|
|
29713
|
+
POINT_LABEL_FONT_SIZE
|
|
29714
|
+
);
|
|
29495
29715
|
const pointsG = chartG.append("g").attr("class", "points");
|
|
29496
|
-
quadrantPoints.forEach((point) => {
|
|
29716
|
+
quadrantPoints.forEach((point, i) => {
|
|
29497
29717
|
const cx = xScale(point.x);
|
|
29498
29718
|
const cy = yScale(point.y);
|
|
29499
29719
|
const quadrant = getPointQuadrant(point.x, point.y);
|
|
29500
29720
|
const quadDef = quadrantDefs.find((d) => d.position === quadrant);
|
|
29501
29721
|
const pointColor = quadDef?.label?.color ?? defaultColors[quadDef?.colorIdx ?? 0];
|
|
29722
|
+
const placed = placedPointLabels[i];
|
|
29502
29723
|
const pointG = pointsG.append("g").attr("class", "point-group").attr("data-line-number", String(point.lineNumber));
|
|
29503
|
-
|
|
29504
|
-
|
|
29724
|
+
if (placed.connectorLine) {
|
|
29725
|
+
pointG.append("line").attr("x1", placed.connectorLine.x1).attr("y1", placed.connectorLine.y1).attr("x2", placed.connectorLine.x2).attr("y2", placed.connectorLine.y2).attr("stroke", pointColor).attr("stroke-width", 1).attr("opacity", 0.5);
|
|
29726
|
+
}
|
|
29727
|
+
pointG.append("circle").attr("cx", cx).attr("cy", cy).attr("r", POINT_RADIUS).attr("fill", "#ffffff").attr("stroke", pointColor).attr("stroke-width", 2);
|
|
29728
|
+
pointG.append("text").attr("x", placed.x).attr("y", placed.y).attr("text-anchor", placed.anchor).attr("dominant-baseline", "central").attr("fill", textColor).attr("font-size", `${POINT_LABEL_FONT_SIZE}px`).attr("font-weight", "700").style("text-shadow", `0 1px 2px ${shadowColor}`).text(point.label);
|
|
29505
29729
|
const tipHtml = `<strong>${point.label}</strong><br>x: ${point.x.toFixed(2)}, y: ${point.y.toFixed(2)}`;
|
|
29506
29730
|
pointG.style("cursor", onClickItem ? "pointer" : "default").on("mouseenter", (event) => {
|
|
29507
29731
|
showTooltip(tooltip, tipHtml, event);
|
|
@@ -29510,7 +29734,7 @@ function renderQuadrant(container, parsed, palette, isDark, onClickItem, exportD
|
|
|
29510
29734
|
showTooltip(tooltip, tipHtml, event);
|
|
29511
29735
|
}).on("mouseleave", () => {
|
|
29512
29736
|
hideTooltip(tooltip);
|
|
29513
|
-
pointG.select("circle").attr("r",
|
|
29737
|
+
pointG.select("circle").attr("r", POINT_RADIUS);
|
|
29514
29738
|
}).on("click", () => {
|
|
29515
29739
|
if (onClickItem && point.lineNumber) onClickItem(point.lineNumber);
|
|
29516
29740
|
});
|
|
@@ -29982,6 +30206,7 @@ var init_d3 = __esm({
|
|
|
29982
30206
|
import_d3_cloud = __toESM(require("d3-cloud"), 1);
|
|
29983
30207
|
init_fonts();
|
|
29984
30208
|
init_branding();
|
|
30209
|
+
init_label_layout();
|
|
29985
30210
|
init_colors();
|
|
29986
30211
|
init_palettes();
|
|
29987
30212
|
init_color_utils();
|
|
@@ -30173,6 +30398,7 @@ __export(index_exports, {
|
|
|
30173
30398
|
computeTimeTicks: () => computeTimeTicks,
|
|
30174
30399
|
contrastText: () => contrastText,
|
|
30175
30400
|
decodeDiagramUrl: () => decodeDiagramUrl,
|
|
30401
|
+
draculaPalette: () => draculaPalette,
|
|
30176
30402
|
encodeDiagramUrl: () => encodeDiagramUrl,
|
|
30177
30403
|
extractDiagramSymbols: () => extractDiagramSymbols,
|
|
30178
30404
|
extractTagDeclarations: () => extractTagDeclarations,
|
|
@@ -30216,6 +30442,7 @@ __export(index_exports, {
|
|
|
30216
30442
|
looksLikeSitemap: () => looksLikeSitemap,
|
|
30217
30443
|
looksLikeState: () => looksLikeState,
|
|
30218
30444
|
makeDgmoError: () => makeDgmoError,
|
|
30445
|
+
monokaiPalette: () => monokaiPalette,
|
|
30219
30446
|
mute: () => mute,
|
|
30220
30447
|
nord: () => nord,
|
|
30221
30448
|
nordPalette: () => nordPalette,
|
|
@@ -31923,6 +32150,7 @@ init_branding();
|
|
|
31923
32150
|
computeTimeTicks,
|
|
31924
32151
|
contrastText,
|
|
31925
32152
|
decodeDiagramUrl,
|
|
32153
|
+
draculaPalette,
|
|
31926
32154
|
encodeDiagramUrl,
|
|
31927
32155
|
extractDiagramSymbols,
|
|
31928
32156
|
extractTagDeclarations,
|
|
@@ -31966,6 +32194,7 @@ init_branding();
|
|
|
31966
32194
|
looksLikeSitemap,
|
|
31967
32195
|
looksLikeState,
|
|
31968
32196
|
makeDgmoError,
|
|
32197
|
+
monokaiPalette,
|
|
31969
32198
|
mute,
|
|
31970
32199
|
nord,
|
|
31971
32200
|
nordPalette,
|