@diagrammo/dgmo 0.46.0 → 0.47.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.cts +3 -855
- package/dist/advanced.d.ts +3 -855
- package/dist/advanced.js +541 -70107
- package/dist/analyzer-UYKBXAKR.js +15 -0
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/auto.mjs +1 -1
- package/dist/block.js +83 -69417
- package/dist/calculator-LDYQCDDY.js +11 -0
- package/dist/charts-d3-QOZHKTCT.js +25 -0
- package/dist/chunk-2DXMZRWJ.js +800 -0
- package/dist/chunk-2LACINWN.js +786 -0
- package/dist/chunk-33LCUH4H.js +893 -0
- package/dist/chunk-3CIOJ5YJ.js +35 -0
- package/dist/chunk-3HDBAXF5.js +86 -0
- package/dist/chunk-3JLKYGBQ.js +290 -0
- package/dist/chunk-3MQQNXPD.js +415 -0
- package/dist/chunk-3R5POCTZ.js +967 -0
- package/dist/chunk-3SMGIJDD.js +112 -0
- package/dist/chunk-44CM72SQ.js +409 -0
- package/dist/chunk-4GRI7MEB.js +1604 -0
- package/dist/chunk-4OHACBGX.js +606 -0
- package/dist/chunk-5DH3KYFH.js +21 -0
- package/dist/chunk-5MLYVTYM.js +76 -0
- package/dist/chunk-5QXL4NYS.js +553 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6EK55ART.js +117 -0
- package/dist/chunk-6FZYCKXB.js +2065 -0
- package/dist/chunk-6HO5ZTXK.js +277 -0
- package/dist/chunk-6KFWC4CO.js +7 -0
- package/dist/chunk-6MTWIQVO.js +121 -0
- package/dist/chunk-6NYWYNBI.js +329 -0
- package/dist/chunk-6SM5NJQH.js +620 -0
- package/dist/chunk-725LDASD.js +422 -0
- package/dist/chunk-76OWZ3BA.js +130 -0
- package/dist/chunk-7JEGTRLD.js +338 -0
- package/dist/chunk-A44USUV7.js +923 -0
- package/dist/chunk-A4GOY3PE.js +25 -0
- package/dist/chunk-A4VFQH5G.js +251 -0
- package/dist/chunk-AELOBFW5.js +375 -0
- package/dist/chunk-AN2MOO5T.js +522 -0
- package/dist/chunk-BMR4CIEO.js +41 -0
- package/dist/chunk-BS7SV7C3.js +51 -0
- package/dist/chunk-BUPDIHML.js +613 -0
- package/dist/chunk-BUVJFRPY.js +887 -0
- package/dist/chunk-C3Z4DX3V.js +112 -0
- package/dist/chunk-CI2G3OEB.js +1818 -0
- package/dist/chunk-CKNVO24D.js +54 -0
- package/dist/chunk-CUVHQHZ7.js +391 -0
- package/dist/chunk-CXK4DZH3.js +114 -0
- package/dist/chunk-DKEPS5LH.js +315 -0
- package/dist/chunk-DU7W62N5.js +487 -0
- package/dist/chunk-DZAQBW35.js +751 -0
- package/dist/chunk-EB6FPQUP.js +316 -0
- package/dist/chunk-EMS2SK26.js +376 -0
- package/dist/chunk-ERLBPDGU.js +510 -0
- package/dist/chunk-EVCVDTXE.js +732 -0
- package/dist/chunk-FCIIHT24.js +384 -0
- package/dist/chunk-FFUN5D66.js +97 -0
- package/dist/chunk-FITOLXSX.js +714 -0
- package/dist/chunk-FMDSF3OV.js +68 -0
- package/dist/chunk-FNB3PNGF.js +410 -0
- package/dist/chunk-G2H74XJZ.js +2104 -0
- package/dist/chunk-GMR5MFHJ.js +339 -0
- package/dist/chunk-H6PI3KJT.js +305 -0
- package/dist/chunk-I46X5VUA.js +59 -0
- package/dist/chunk-I5IGB56C.js +255 -0
- package/dist/chunk-IH6ZMVQ5.js +3950 -0
- package/dist/chunk-IJZFN3HM.js +463 -0
- package/dist/chunk-IPWPWM6R.js +3079 -0
- package/dist/chunk-IYULMRBE.js +23 -0
- package/dist/chunk-IZMRON6C.js +167 -0
- package/dist/chunk-J5FIXQRT.js +813 -0
- package/dist/chunk-JED6ZDEE.js +73 -0
- package/dist/chunk-JEUJOX5X.js +136 -0
- package/dist/chunk-JM4LEPY3.js +436 -0
- package/dist/chunk-L3UHP6TD.js +101 -0
- package/dist/chunk-L66GEFB6.js +524 -0
- package/dist/chunk-LIOHW36Z.js +469 -0
- package/dist/chunk-LP7EC4MI.js +16 -0
- package/dist/chunk-MITI6NOL.js +548 -0
- package/dist/chunk-MO5YHHMQ.js +168 -0
- package/dist/chunk-MZSBFAPJ.js +885 -0
- package/dist/chunk-NNAAJVBU.js +9 -0
- package/dist/chunk-NOTA6TEI.js +47 -0
- package/dist/chunk-NURGB5Z4.js +335 -0
- package/dist/chunk-NX4EQS3U.js +1062 -0
- package/dist/chunk-NXMESY4J.js +1 -0
- package/dist/chunk-OJR3MQYV.js +1458 -0
- package/dist/chunk-OURHMODR.js +454 -0
- package/dist/chunk-P235SVAH.js +1057 -0
- package/dist/chunk-P4RH4OSP.js +1038 -0
- package/dist/chunk-P6T66CCZ.js +226 -0
- package/dist/chunk-PBAHEPLQ.js +223 -0
- package/dist/chunk-PBHE5UG6.js +1530 -0
- package/dist/chunk-PDKUANDZ.js +35 -0
- package/dist/chunk-PWIHZ6NJ.js +296 -0
- package/dist/chunk-QEBUY5NY.js +1685 -0
- package/dist/chunk-QLCCJEJI.js +253 -0
- package/dist/chunk-QOOUC2J5.js +52 -0
- package/dist/chunk-QYTPPDAO.js +402 -0
- package/dist/chunk-R3XI2VC7.js +801 -0
- package/dist/chunk-RCERWOJR.js +154 -0
- package/dist/chunk-RJE5JTVK.js +362 -0
- package/dist/chunk-RTLBSQ3G.js +1155 -0
- package/dist/chunk-RUNNI6VE.js +448 -0
- package/dist/chunk-RVMRZAPB.js +354 -0
- package/dist/chunk-RYEGFMUO.js +955 -0
- package/dist/chunk-RZCF2VVM.js +528 -0
- package/dist/chunk-SML67VPV.js +1025 -0
- package/dist/chunk-SQ7IY53Q.js +44 -0
- package/dist/chunk-SQAG3UXH.js +161 -0
- package/dist/chunk-SRTU6HMQ.js +1851 -0
- package/dist/chunk-T2OE3YQB.js +550 -0
- package/dist/chunk-T3UBLACL.js +299 -0
- package/dist/chunk-TLVIHFRO.js +296 -0
- package/dist/chunk-TYS6CSS5.js +52 -0
- package/dist/chunk-U6EQI3U6.js +130 -0
- package/dist/chunk-UJ4FJLBF.js +86 -0
- package/dist/chunk-ULOEATBZ.js +347 -0
- package/dist/chunk-UNCCZ3NU.js +127 -0
- package/dist/chunk-USZW2HHU.js +197 -0
- package/dist/chunk-UWN33VNX.js +1610 -0
- package/dist/chunk-UZ7EZW3B.js +40 -0
- package/dist/chunk-VOKGH627.js +37 -0
- package/dist/chunk-WBRZJOEC.js +204 -0
- package/dist/chunk-WCSOJFU3.js +380 -0
- package/dist/chunk-WCT3NYCV.js +160 -0
- package/dist/chunk-WVAJFAIA.js +529 -0
- package/dist/chunk-X5LCYCL5.js +394 -0
- package/dist/chunk-XAKEUMEJ.js +1256 -0
- package/dist/chunk-Y2ZE3MSG.js +590 -0
- package/dist/chunk-Y3J7VR52.js +646 -0
- package/dist/chunk-Y5QGVTVC.js +33 -0
- package/dist/chunk-YAA6IID3.js +548 -0
- package/dist/chunk-YGJTDXVR.js +692 -0
- package/dist/chunk-YRYKTYMQ.js +186 -0
- package/dist/chunk-YYVTBZZC.js +61 -0
- package/dist/chunk-Z5CGSFJB.js +647 -0
- package/dist/chunk-Z72XRXD4.js +787 -0
- package/dist/chunk-ZGR7ULFJ.js +978 -0
- package/dist/chunk-ZJEL4H2R.js +851 -0
- package/dist/chunk-ZO27FGJS.js +554 -0
- package/dist/collapse-CLPJD2RL.js +11 -0
- package/dist/collapse-SLINJQW6.js +9 -0
- package/dist/collapse-ZWUFFCK2.js +9 -0
- package/dist/compute-G55RG53N.js +8 -0
- package/dist/dgmo-router-DZCIDUO5.js +73 -0
- package/dist/dimensions-J3FHIMJ6.js +22 -0
- package/dist/element.cjs +1 -1
- package/dist/element.js +1 -1
- package/dist/element.mjs +1 -1
- package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
- package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -469
- package/dist/index.d.ts +3 -469
- package/dist/index.js +137 -69685
- package/dist/layout-46N4JJYK.js +17 -0
- package/dist/layout-5RA6QWR6.js +26 -0
- package/dist/layout-5T6RH5M6.js +14 -0
- package/dist/layout-7QXCNOVS.js +13 -0
- package/dist/layout-EE6GE46Y.js +17 -0
- package/dist/layout-G23F7LDH.js +9 -0
- package/dist/layout-HRBZPFCN.js +23 -0
- package/dist/layout-HWDSRX5E.js +20 -0
- package/dist/layout-HYZPWAK5.js +18 -0
- package/dist/layout-N76NR4ZO.js +19 -0
- package/dist/layout-OB3RI63S.js +14 -0
- package/dist/layout-S2QBYSK2.js +15 -0
- package/dist/layout-UM5F4DJB.js +15 -0
- package/dist/layout-search-OYV77HHS.js +1655 -0
- package/dist/load-data-EHDDZ5ZS.js +8 -0
- package/dist/palettes-PRJ2RI6D.js +56 -0
- package/dist/parser-2MFP2H2E.js +11 -0
- package/dist/parser-3STE62GB.js +21 -0
- package/dist/parser-4FL2CMDG.js +18 -0
- package/dist/parser-4OGOBJJ4.js +13 -0
- package/dist/parser-6BTRLKRZ.js +15 -0
- package/dist/parser-AQETEVRW.js +21 -0
- package/dist/parser-CFZD5IBL.js +12 -0
- package/dist/parser-FUSKFGZN.js +16 -0
- package/dist/parser-I6KXEYFK.js +13 -0
- package/dist/parser-IXSZZQHY.js +18 -0
- package/dist/parser-JAL2HD4I.js +13 -0
- package/dist/parser-KNSQSKQO.js +20 -0
- package/dist/parser-N5O4IHUN.js +13 -0
- package/dist/parser-NGU3ETO6.js +16 -0
- package/dist/parser-NRAI6O25.js +19 -0
- package/dist/parser-O5J4VBII.js +11 -0
- package/dist/parser-OV7NOBW6.js +21 -0
- package/dist/parser-PQ3POX45.js +23 -0
- package/dist/parser-TFZFBVWN.js +11 -0
- package/dist/parser-TRTHDFPP.js +18 -0
- package/dist/parser-VQP2UJ6W.js +11 -0
- package/dist/parser-XDVELHRK.js +13 -0
- package/dist/parser-XKRP7QKP.js +11 -0
- package/dist/parser-Y6WTBU76.js +14 -0
- package/dist/parser-ZSDPZYQP.js +12 -0
- package/dist/renderer-2XQQQ6QR.js +28 -0
- package/dist/renderer-5NDVNDAZ.js +26 -0
- package/dist/renderer-6EEZHMH4.js +26 -0
- package/dist/renderer-6W5462RB.js +43 -0
- package/dist/renderer-7MVLWWQD.js +22 -0
- package/dist/renderer-AWWAF6XD.js +33 -0
- package/dist/renderer-BYCNMBF7.js +34 -0
- package/dist/renderer-CLJHQPBJ.js +29 -0
- package/dist/renderer-GHPZMFU2.js +15 -0
- package/dist/renderer-JGBKUCZD.js +16 -0
- package/dist/renderer-KQB7UGDS.js +19 -0
- package/dist/renderer-PGX2TKVS.js +24 -0
- package/dist/renderer-QIWVHWZO.js +15 -0
- package/dist/renderer-RPOA5YPZ.js +35 -0
- package/dist/renderer-SMIBCRVB.js +24 -0
- package/dist/renderer-T7YKC5VP.js +28 -0
- package/dist/renderer-TOCOVLHS.js +37 -0
- package/dist/renderer-UWA5XS74.js +39 -0
- package/dist/renderer-VACVQYML.js +25 -0
- package/dist/renderer-W4M6QLIJ.js +37 -0
- package/dist/renderer-WZRREQ2P.js +23 -0
- package/dist/renderer-YY2OSF6E.js +27 -0
- package/dist/renderer-Z7I3W2PP.js +24 -0
- package/dist/renderer-ZGNTUWC4.js +22 -0
- package/dist/renderer-ZTR3DER3.js +19 -0
- package/dist/renderer-radial-C32GPJQ7.js +21 -0
- package/dist/resolver-NOAA7ID7.js +13 -0
- package/dist/state-collapse-HCGD6IVJ.js +8 -0
- package/dist/state-parser-Z2V23ATR.js +18 -0
- package/dist/state-renderer-RFYHSP4K.js +34 -0
- package/dist/themes-1-CuKpeH.d.cts +908 -0
- package/dist/themes-1-CuKpeH.d.ts +908 -0
- package/package.json +1 -1
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TITLE_FONT_SIZE,
|
|
3
|
+
TITLE_FONT_WEIGHT,
|
|
4
|
+
TITLE_Y
|
|
5
|
+
} from "./chunk-A4GOY3PE.js";
|
|
6
|
+
import {
|
|
7
|
+
FONT_FAMILY
|
|
8
|
+
} from "./chunk-6KFWC4CO.js";
|
|
9
|
+
import {
|
|
10
|
+
getSeriesColors
|
|
11
|
+
} from "./chunk-P6T66CCZ.js";
|
|
12
|
+
import {
|
|
13
|
+
resolveColor
|
|
14
|
+
} from "./chunk-TLVIHFRO.js";
|
|
15
|
+
|
|
16
|
+
// src/version-control/renderer.ts
|
|
17
|
+
import * as d3Selection from "d3-selection";
|
|
18
|
+
var LINE = 5.5;
|
|
19
|
+
var DOT = 8;
|
|
20
|
+
var CORNER = 13;
|
|
21
|
+
var ANG = 32;
|
|
22
|
+
var STACK = 19;
|
|
23
|
+
var CIRCLED = "\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468";
|
|
24
|
+
var TITLE_AREA = 40;
|
|
25
|
+
function clip(s, max) {
|
|
26
|
+
return s.length > max ? s.slice(0, max - 1) + "\u2026" : s;
|
|
27
|
+
}
|
|
28
|
+
function roundedL(sx, sy, cx, cy, ex, ey, r) {
|
|
29
|
+
const l1 = Math.hypot(cx - sx, cy - sy);
|
|
30
|
+
const l2 = Math.hypot(ex - cx, ey - cy);
|
|
31
|
+
const rr = Math.max(2, Math.min(r, l1 - 1, l2 - 1));
|
|
32
|
+
const u1x = (cx - sx) / (l1 || 1), u1y = (cy - sy) / (l1 || 1);
|
|
33
|
+
const u2x = (ex - cx) / (l2 || 1), u2y = (ey - cy) / (l2 || 1);
|
|
34
|
+
return `M${sx},${sy} L${cx - u1x * rr},${cy - u1y * rr} Q${cx},${cy} ${cx + u2x * rr},${cy + u2y * rr} L${ex},${ey}`;
|
|
35
|
+
}
|
|
36
|
+
function renderVersionControl(container, parsed, palette, isDark, onClickItem, exportDims) {
|
|
37
|
+
void isDark;
|
|
38
|
+
if (parsed.nodes.length === 0) return;
|
|
39
|
+
d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
40
|
+
const nodes = parsed.nodes;
|
|
41
|
+
const TB = parsed.options.direction !== "LR";
|
|
42
|
+
const branchByName = new Map(
|
|
43
|
+
parsed.branches.map((b) => [b.name, b])
|
|
44
|
+
);
|
|
45
|
+
const series = getSeriesColors(palette);
|
|
46
|
+
const laneColor = (b) => b.colorToken ? resolveColor(b.colorToken, palette) ?? series[b.lane % series.length] : series[b.lane % series.length];
|
|
47
|
+
const colorOf = (n) => laneColor(branchByName.get(n.branch));
|
|
48
|
+
const byKey = (k) => nodes[k];
|
|
49
|
+
const pfx = (n) => n.kind === "cherry" ? "\u21E0 " : n.kind === "merge" ? "\u21F2 " : "";
|
|
50
|
+
const label = /* @__PURE__ */ new Map();
|
|
51
|
+
for (const n of nodes) {
|
|
52
|
+
const sha = n.id;
|
|
53
|
+
const msg = pfx(n) + clip(n.message || "(empty)", 26);
|
|
54
|
+
const lw = (sha ? sha.length * 6.6 + 8 : 0) + msg.length * 6.9 + 8;
|
|
55
|
+
label.set(n.key, { sha, msg, lw });
|
|
56
|
+
}
|
|
57
|
+
const maxLW = Math.max(0, ...[...label.values()].map((l) => l.lw));
|
|
58
|
+
const above = /* @__PURE__ */ new Map();
|
|
59
|
+
const pushBadge = (k, b) => {
|
|
60
|
+
if (!above.has(k)) above.set(k, []);
|
|
61
|
+
above.get(k).push(b);
|
|
62
|
+
};
|
|
63
|
+
if (!parsed.options.noLabels) {
|
|
64
|
+
for (const n of nodes)
|
|
65
|
+
if (n.tag)
|
|
66
|
+
pushBadge(n.key, {
|
|
67
|
+
kind: "tag",
|
|
68
|
+
label: n.tag,
|
|
69
|
+
w: n.tag.length * 6.6 + 16
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
for (const r of parsed.refs) {
|
|
73
|
+
if (r.atKey == null) continue;
|
|
74
|
+
if (r.head) pushBadge(r.atKey, { kind: "head", label: "HEAD", w: 46 });
|
|
75
|
+
else
|
|
76
|
+
pushBadge(r.atKey, {
|
|
77
|
+
kind: "ref",
|
|
78
|
+
label: r.name,
|
|
79
|
+
remote: r.remote,
|
|
80
|
+
w: r.name.length * 6.2 + 18
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
for (const nt of parsed.notes) {
|
|
84
|
+
if (nt.anchorKey == null) continue;
|
|
85
|
+
pushBadge(nt.anchorKey, {
|
|
86
|
+
kind: "note",
|
|
87
|
+
label: CIRCLED[nt.num - 1] ?? `#${nt.num}`,
|
|
88
|
+
w: 19
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const maxStack = Math.max(0, ...[...above.values()].map((a) => a.length));
|
|
92
|
+
const laneCount = parsed.branches.length;
|
|
93
|
+
const K = nodes.length;
|
|
94
|
+
const pos = /* @__PURE__ */ new Map();
|
|
95
|
+
const placements = [];
|
|
96
|
+
let contentW, contentH, gutter, cross0, captionY = 0;
|
|
97
|
+
const cos = Math.cos(ANG * Math.PI / 180);
|
|
98
|
+
const sin = Math.sin(ANG * Math.PI / 180);
|
|
99
|
+
if (!TB) {
|
|
100
|
+
const maxName = Math.max(4, ...parsed.branches.map((b) => b.name.length));
|
|
101
|
+
gutter = maxName * 7.5 + 18;
|
|
102
|
+
const along0 = gutter + 34, step = 86, laneGap = 54;
|
|
103
|
+
cross0 = 16 + maxStack * STACK + 14;
|
|
104
|
+
for (const n of nodes)
|
|
105
|
+
pos.set(n.key, {
|
|
106
|
+
x: along0 + n.seq * step,
|
|
107
|
+
y: cross0 + n.lane * laneGap
|
|
108
|
+
});
|
|
109
|
+
const lanesBottom = cross0 + (laneCount - 1) * laneGap;
|
|
110
|
+
const bandY = lanesBottom + 26;
|
|
111
|
+
for (const n of nodes) {
|
|
112
|
+
const p = pos.get(n.key);
|
|
113
|
+
placements.push({
|
|
114
|
+
node: n,
|
|
115
|
+
kind: "msg",
|
|
116
|
+
diag: true,
|
|
117
|
+
x: p.x,
|
|
118
|
+
y: bandY,
|
|
119
|
+
anchor: "start",
|
|
120
|
+
leader: { x1: p.x, y1: p.y + DOT, x2: p.x, y2: bandY - 3 }
|
|
121
|
+
});
|
|
122
|
+
const stack = above.get(n.key) ?? [];
|
|
123
|
+
stack.forEach(
|
|
124
|
+
(it, j) => placements.push({
|
|
125
|
+
node: n,
|
|
126
|
+
kind: it.kind,
|
|
127
|
+
label: it.label,
|
|
128
|
+
remote: it.remote,
|
|
129
|
+
w: it.w,
|
|
130
|
+
x: p.x,
|
|
131
|
+
y: p.y - DOT - 12 - j * STACK,
|
|
132
|
+
anchor: "middle"
|
|
133
|
+
})
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
for (const b of parsed.branches) {
|
|
137
|
+
if (!b.ab || b.ab.ahead + b.ab.behind === 0 || b.tip == null) continue;
|
|
138
|
+
const tip = pos.get(b.tip);
|
|
139
|
+
placements.push({
|
|
140
|
+
node: byKey(b.tip),
|
|
141
|
+
kind: "ab",
|
|
142
|
+
label: abText(b.ab),
|
|
143
|
+
x: tip.x + DOT + 10,
|
|
144
|
+
y: tip.y,
|
|
145
|
+
anchor: "start"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
contentW = Math.max(
|
|
149
|
+
along0 + (K - 1) * step + DOT + 70,
|
|
150
|
+
...[...pos.entries()].map(([k, p]) => p.x + label.get(k).lw * cos)
|
|
151
|
+
) + 18;
|
|
152
|
+
contentH = bandY + maxLW * sin + 12 * cos + 16;
|
|
153
|
+
if (parsed.notes.length) {
|
|
154
|
+
captionY = contentH + 4;
|
|
155
|
+
contentH += 8 + parsed.notes.length * 16 + 8;
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
gutter = 24;
|
|
159
|
+
const along0 = gutter + 32, step = 52, laneGap = 96;
|
|
160
|
+
cross0 = 78;
|
|
161
|
+
for (const n of nodes)
|
|
162
|
+
pos.set(n.key, {
|
|
163
|
+
x: cross0 + n.lane * laneGap,
|
|
164
|
+
y: along0 + n.seq * step
|
|
165
|
+
});
|
|
166
|
+
const bandX = cross0 + (laneCount - 1) * laneGap + 28;
|
|
167
|
+
for (const n of nodes) {
|
|
168
|
+
const p = pos.get(n.key);
|
|
169
|
+
placements.push({
|
|
170
|
+
node: n,
|
|
171
|
+
kind: "msg",
|
|
172
|
+
diag: false,
|
|
173
|
+
x: bandX,
|
|
174
|
+
y: p.y,
|
|
175
|
+
anchor: "start",
|
|
176
|
+
leader: { x1: p.x + DOT + 2, y1: p.y, x2: bandX - 6, y2: p.y }
|
|
177
|
+
});
|
|
178
|
+
const stack = above.get(n.key) ?? [];
|
|
179
|
+
stack.forEach(
|
|
180
|
+
(it, j) => placements.push({
|
|
181
|
+
node: n,
|
|
182
|
+
kind: it.kind,
|
|
183
|
+
label: it.label,
|
|
184
|
+
remote: it.remote,
|
|
185
|
+
w: it.w,
|
|
186
|
+
x: p.x - DOT - 12 - it.w / 2 - j * 4,
|
|
187
|
+
y: p.y,
|
|
188
|
+
anchor: "middle"
|
|
189
|
+
})
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
contentW = bandX + maxLW + 16;
|
|
193
|
+
contentH = along0 + (K - 1) * step + 22;
|
|
194
|
+
}
|
|
195
|
+
const showTitle = !!parsed.title;
|
|
196
|
+
const titleH = showTitle ? TITLE_AREA : 0;
|
|
197
|
+
const W = Math.round(contentW);
|
|
198
|
+
const H = Math.round(contentH + titleH);
|
|
199
|
+
const exportMode = !!exportDims;
|
|
200
|
+
const svg = d3Selection.select(container).append("svg").attr("width", W).attr("height", H).attr("viewBox", `0 0 ${W} ${H}`).attr("preserveAspectRatio", "xMidYMin meet").attr("xmlns", "http://www.w3.org/2000/svg").style("font-family", FONT_FAMILY);
|
|
201
|
+
svg.append("rect").attr("width", W).attr("height", H).attr("fill", palette.bg);
|
|
202
|
+
if (showTitle) {
|
|
203
|
+
const t = svg.append("text").attr("class", "chart-title").attr("x", W / 2).attr("y", TITLE_Y).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-family", FONT_FAMILY).attr("font-size", TITLE_FONT_SIZE).attr("font-weight", TITLE_FONT_WEIGHT).attr("data-line-number", parsed.titleLineNumber ?? 1).text(parsed.title);
|
|
204
|
+
if (onClickItem && parsed.titleLineNumber && !exportMode) {
|
|
205
|
+
const ln = parsed.titleLineNumber;
|
|
206
|
+
t.style("cursor", "pointer").on("click", () => onClickItem(ln));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const g = svg.append("g").attr("transform", `translate(0, ${titleH})`);
|
|
210
|
+
drawGraph(
|
|
211
|
+
g,
|
|
212
|
+
parsed,
|
|
213
|
+
palette,
|
|
214
|
+
TB,
|
|
215
|
+
pos,
|
|
216
|
+
placements,
|
|
217
|
+
label,
|
|
218
|
+
colorOf,
|
|
219
|
+
byKey,
|
|
220
|
+
gutter,
|
|
221
|
+
cross0,
|
|
222
|
+
captionY,
|
|
223
|
+
onClickItem && !exportMode ? onClickItem : void 0
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
function abText(ab) {
|
|
227
|
+
const a = [];
|
|
228
|
+
if (ab.ahead) a.push("\u2191" + ab.ahead);
|
|
229
|
+
if (ab.behind) a.push("\u2193" + ab.behind);
|
|
230
|
+
return a.join(" ");
|
|
231
|
+
}
|
|
232
|
+
function drawGraph(g, parsed, palette, TB, pos, placements, label, colorOf, byKey, gutter, cross0, captionY, onClickItem) {
|
|
233
|
+
const nodes = parsed.nodes;
|
|
234
|
+
const P = (k) => pos.get(k);
|
|
235
|
+
const branchCorner = (par, n) => TB ? { x: P(n.key).x, y: P(par.key).y } : { x: P(par.key).x, y: P(n.key).y };
|
|
236
|
+
const mergeCorner = (src, n) => TB ? { x: P(src.key).x, y: P(n.key).y } : { x: P(n.key).x, y: P(src.key).y };
|
|
237
|
+
const gop = (n) => n.ghost ? 0.32 : 1;
|
|
238
|
+
const dlink = (a, b, color, arrow) => {
|
|
239
|
+
const A = P(a.key), B = P(b.key), c = mergeCorner(a, b);
|
|
240
|
+
g.append("path").attr("d", roundedL(A.x, A.y, c.x, c.y, B.x, B.y, CORNER)).attr("fill", "none").attr("stroke", color).attr("stroke-width", 2).attr("stroke-dasharray", "2 4").attr("opacity", 0.8);
|
|
241
|
+
if (arrow) {
|
|
242
|
+
const dx = B.x - c.x, dy = B.y - c.y, l = Math.hypot(dx, dy) || 1;
|
|
243
|
+
const ux = dx / l, uy = dy / l, px = -uy, py = ux, s = 4;
|
|
244
|
+
g.append("path").attr(
|
|
245
|
+
"d",
|
|
246
|
+
`M${B.x},${B.y} L${B.x - ux * s * 2 + px * s},${B.y - uy * s * 2 + py * s} L${B.x - ux * s * 2 - px * s},${B.y - uy * s * 2 - py * s} Z`
|
|
247
|
+
).attr("fill", color).attr("opacity", 0.8);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
for (const n of nodes) {
|
|
251
|
+
const c = colorOf(n);
|
|
252
|
+
const o = gop(n);
|
|
253
|
+
const N = P(n.key);
|
|
254
|
+
if (n.prev != null) {
|
|
255
|
+
const a = P(n.prev);
|
|
256
|
+
const e = g.append("line").attr("x1", a.x).attr("y1", a.y).attr("x2", N.x).attr("y2", N.y).attr("stroke", c).attr("stroke-width", LINE).attr("stroke-linecap", "round").attr("opacity", o);
|
|
257
|
+
if (n.ghost) e.attr("stroke-dasharray", "5 5");
|
|
258
|
+
}
|
|
259
|
+
if (n.parent != null) {
|
|
260
|
+
const par = byKey(n.parent), cc = branchCorner(par, n), pp = P(par.key);
|
|
261
|
+
const e = g.append("path").attr("d", roundedL(pp.x, pp.y, cc.x, cc.y, N.x, N.y, CORNER)).attr("fill", "none").attr("stroke", c).attr("stroke-width", LINE).attr("stroke-linecap", "round").attr("opacity", o);
|
|
262
|
+
if (n.ghost) e.attr("stroke-dasharray", "5 5");
|
|
263
|
+
}
|
|
264
|
+
if (n.mergeFrom != null) {
|
|
265
|
+
const s = byKey(n.mergeFrom), cc = mergeCorner(s, n), sp = P(s.key);
|
|
266
|
+
g.append("path").attr("d", roundedL(sp.x, sp.y, cc.x, cc.y, N.x, N.y, CORNER)).attr("fill", "none").attr("stroke", colorOf(s)).attr("stroke-width", LINE).attr("stroke-linecap", "round").attr("opacity", 0.92 * o);
|
|
267
|
+
}
|
|
268
|
+
if (n.cherryFrom != null)
|
|
269
|
+
dlink(byKey(n.cherryFrom), n, colorOf(byKey(n.cherryFrom)), false);
|
|
270
|
+
if (n.revertFrom != null) dlink(byKey(n.revertFrom), n, c, false);
|
|
271
|
+
if (n.squashFrom != null)
|
|
272
|
+
dlink(byKey(n.squashFrom), n, palette.textMuted, true);
|
|
273
|
+
if (n.movedTo != null) dlink(n, byKey(n.movedTo), palette.textMuted, true);
|
|
274
|
+
}
|
|
275
|
+
if (!parsed.options.noLanes) {
|
|
276
|
+
for (const b of parsed.branches) {
|
|
277
|
+
let first = null;
|
|
278
|
+
for (const n of nodes)
|
|
279
|
+
if (n.branch === b.name && (first === null || n.seq < first.seq))
|
|
280
|
+
first = n;
|
|
281
|
+
if (!first) continue;
|
|
282
|
+
const fp = P(first.key);
|
|
283
|
+
const col = colorOf(first);
|
|
284
|
+
if (TB) {
|
|
285
|
+
g.append("text").attr("x", fp.x).attr("y", 14).attr("text-anchor", "middle").attr("font-size", 12.5).attr("font-weight", 800).attr("fill", col).text(b.name);
|
|
286
|
+
} else {
|
|
287
|
+
g.append("text").attr("x", gutter).attr("y", fp.y + 4).attr("text-anchor", "end").attr("font-size", 12.5).attr("font-weight", 800).attr("fill", col).text(b.name);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
void cross0;
|
|
292
|
+
for (const n of nodes) {
|
|
293
|
+
const c = colorOf(n);
|
|
294
|
+
const N = P(n.key);
|
|
295
|
+
const sel = (el) => {
|
|
296
|
+
el.attr("data-line-number", n.lineNumber);
|
|
297
|
+
el.attr("data-branch", n.branch);
|
|
298
|
+
if (onClickItem)
|
|
299
|
+
el.style("cursor", "pointer").on(
|
|
300
|
+
"click",
|
|
301
|
+
() => onClickItem(n.lineNumber)
|
|
302
|
+
);
|
|
303
|
+
};
|
|
304
|
+
if (n.ghost) {
|
|
305
|
+
sel(
|
|
306
|
+
g.append("circle").attr("cx", N.x).attr("cy", N.y).attr("r", DOT - 1).attr("fill", palette.bg).attr("stroke", c).attr("stroke-width", 2).attr("opacity", 0.4)
|
|
307
|
+
);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (n.type === "highlight") {
|
|
311
|
+
sel(
|
|
312
|
+
g.append("rect").attr("x", N.x - DOT).attr("y", N.y - DOT).attr("width", DOT * 2).attr("height", DOT * 2).attr("rx", 3.5).attr("fill", c).attr("stroke", palette.bg).attr("stroke-width", 3)
|
|
313
|
+
);
|
|
314
|
+
} else if (n.type === "reverse") {
|
|
315
|
+
g.append("circle").attr("cx", N.x).attr("cy", N.y).attr("r", DOT).attr("fill", palette.bg).attr("stroke", c).attr("stroke-width", 3);
|
|
316
|
+
sel(
|
|
317
|
+
g.append("path").attr(
|
|
318
|
+
"d",
|
|
319
|
+
`M${N.x - 3.6},${N.y - 3.6} L${N.x + 3.6},${N.y + 3.6} M${N.x + 3.6},${N.y - 3.6} L${N.x - 3.6},${N.y + 3.6}`
|
|
320
|
+
).attr("stroke", c).attr("stroke-width", 2).attr("stroke-linecap", "round").attr("fill", "none")
|
|
321
|
+
);
|
|
322
|
+
} else if (n.kind === "merge") {
|
|
323
|
+
g.append("circle").attr("cx", N.x).attr("cy", N.y).attr("r", DOT).attr("fill", palette.bg).attr("stroke", c).attr("stroke-width", 3);
|
|
324
|
+
sel(
|
|
325
|
+
g.append("circle").attr("cx", N.x).attr("cy", N.y).attr("r", 3).attr("fill", c)
|
|
326
|
+
);
|
|
327
|
+
} else {
|
|
328
|
+
sel(
|
|
329
|
+
g.append("circle").attr("cx", N.x).attr("cy", N.y).attr("r", DOT).attr("fill", c).attr("stroke", palette.bg).attr("stroke-width", 3)
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const pill = (cx, cy, w, text, fill, textColor, border, dash, weight = 700) => {
|
|
334
|
+
const r = g.append("rect").attr("x", cx - w / 2).attr("y", cy - 8.5).attr("width", w).attr("height", 17).attr("rx", 8.5).attr("fill", fill);
|
|
335
|
+
if (border) {
|
|
336
|
+
r.attr("stroke", border).attr("stroke-width", 1.3);
|
|
337
|
+
if (dash) r.attr("stroke-dasharray", "3 2");
|
|
338
|
+
}
|
|
339
|
+
g.append("text").attr("x", cx).attr("y", cy + 4).attr("text-anchor", "middle").attr("font-size", 10.5).attr("font-weight", weight).attr("fill", textColor).text(text);
|
|
340
|
+
};
|
|
341
|
+
for (const pl of placements) {
|
|
342
|
+
const n = pl.node;
|
|
343
|
+
const c = colorOf(n);
|
|
344
|
+
if (pl.leader) {
|
|
345
|
+
g.append("line").attr("x1", pl.leader.x1).attr("y1", pl.leader.y1).attr("x2", pl.leader.x2).attr("y2", pl.leader.y2).attr("stroke", c).attr("stroke-width", 1).attr("opacity", 0.34 * gop(n));
|
|
346
|
+
}
|
|
347
|
+
if (pl.kind === "tag") pill(pl.x, pl.y, pl.w, pl.label, c, palette.bg);
|
|
348
|
+
else if (pl.kind === "head")
|
|
349
|
+
pill(
|
|
350
|
+
pl.x,
|
|
351
|
+
pl.y,
|
|
352
|
+
pl.w,
|
|
353
|
+
"HEAD",
|
|
354
|
+
palette.text,
|
|
355
|
+
palette.bg,
|
|
356
|
+
void 0,
|
|
357
|
+
false,
|
|
358
|
+
800
|
|
359
|
+
);
|
|
360
|
+
else if (pl.kind === "ref")
|
|
361
|
+
pill(pl.x, pl.y, pl.w, pl.label, palette.bg, c, c, pl.remote);
|
|
362
|
+
else if (pl.kind === "note") {
|
|
363
|
+
g.append("circle").attr("cx", pl.x).attr("cy", pl.y).attr("r", 8.5).attr("fill", c);
|
|
364
|
+
g.append("text").attr("x", pl.x).attr("y", pl.y + 4).attr("text-anchor", "middle").attr("font-size", 11).attr("fill", palette.bg).text(pl.label);
|
|
365
|
+
} else if (pl.kind === "ab") {
|
|
366
|
+
g.append("text").attr("x", pl.x).attr("y", pl.y + 4).attr("text-anchor", "start").attr("font-size", 11).attr("font-weight", 700).attr("fill", c).text(pl.label);
|
|
367
|
+
} else {
|
|
368
|
+
const L = label.get(n.key);
|
|
369
|
+
const gh = n.ghost;
|
|
370
|
+
const mfill = gh ? palette.textMuted : c;
|
|
371
|
+
const t = pl.diag ? g.append("text").attr("transform", `translate(${pl.x},${pl.y}) rotate(${ANG})`).attr("font-size", 12).attr("opacity", gh ? 0.55 : 1) : g.append("text").attr("x", pl.x).attr("y", pl.y + 4).attr("text-anchor", pl.anchor).attr("font-size", 12).attr("opacity", gh ? 0.55 : 1);
|
|
372
|
+
if (L.sha)
|
|
373
|
+
t.append("tspan").attr("font-family", "ui-monospace, monospace").attr("font-size", 11).attr("fill", palette.textMuted).text(L.sha + " ");
|
|
374
|
+
t.append("tspan").attr("fill", mfill).attr("font-weight", n.kind === "cherry" ? 400 : 700).attr("font-style", n.kind === "cherry" ? "italic" : "normal").text(L.msg);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (captionY && parsed.notes.length) {
|
|
378
|
+
let y = captionY + 14;
|
|
379
|
+
for (const nt of parsed.notes) {
|
|
380
|
+
const t = g.append("text").attr("x", 12).attr("y", y).attr("font-size", 11.5);
|
|
381
|
+
t.append("tspan").attr("fill", palette.text).attr("font-weight", 800).text((CIRCLED[nt.num - 1] ?? `#${nt.num}`) + " ");
|
|
382
|
+
t.append("tspan").attr("fill", palette.textMuted).text(nt.text);
|
|
383
|
+
y += 16;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function renderVersionControlForExport(container, parsed, palette, isDark, exportDims) {
|
|
388
|
+
renderVersionControl(
|
|
389
|
+
container,
|
|
390
|
+
parsed,
|
|
391
|
+
palette,
|
|
392
|
+
isDark,
|
|
393
|
+
void 0,
|
|
394
|
+
exportDims
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export {
|
|
399
|
+
renderVersionControl,
|
|
400
|
+
renderVersionControlForExport
|
|
401
|
+
};
|
|
402
|
+
//# sourceMappingURL=chunk-QYTPPDAO.js.map
|