@elmethis/core 1.0.0-alpha.135 → 1.0.0-alpha.136
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/{Bash-5KqPZETT.js → Bash-BGUPOZp7.js} +1 -1
- package/dist/{Css-Br7IeFYI.js → Css-BCZOJ9TO.js} +1 -1
- package/dist/{Rust-TE1r2SD6.js → Rust-BwvKtYCc.js} +1 -1
- package/dist/_basePickBy-BjVOtBbf.js +152 -0
- package/dist/_baseUniq-DBXEmOed.js +583 -0
- package/dist/arc-CpOtc53l.js +83 -0
- package/dist/architecture-I3QFYML2-B3piHlUx.js +5 -0
- package/dist/architectureDiagram-UYN6MBPD-CIvqBNYd.js +4595 -0
- package/dist/blockDiagram-ZHA2E4KO-BJHIBwi6.js +2247 -0
- package/dist/c4Diagram-6F5ED5ID-DxXqw6e0.js +1581 -0
- package/dist/channel-BgZSmjvA.js +5 -0
- package/dist/chunk-5HRBRIJM-CvhBPtHu.js +24 -0
- package/dist/chunk-7U56Z5CX-CaWvnXle.js +1215 -0
- package/dist/chunk-ASOPGD6M-CQjrO8hd.js +64 -0
- package/dist/chunk-KFBOBJHC-DWru5GNu.js +15 -0
- package/dist/chunk-T2TOU4HS-DqpYO7rW.js +1303 -0
- package/dist/chunk-TMUBEWPD-LmMMNIqt.js +9 -0
- package/dist/classDiagram-LNE6IOMH-D5GoOZTJ.js +14 -0
- package/dist/classDiagram-v2-MQ7JQ4JX-D5GoOZTJ.js +14 -0
- package/dist/clone-DMQ2a__4.js +8 -0
- package/dist/{cobol-DZ3yq6J9.js → cobol-DMssKNmC.js} +1 -1
- package/dist/components/code/ElmMermaid.stories.d.ts +7 -0
- package/dist/components/code/ElmMermaid.vue.d.ts +8 -0
- package/dist/cytoscape.esm-CsRvAgYT.js +17639 -0
- package/dist/dagre-4EVJKHTY-C7YsHY3S.js +447 -0
- package/dist/diagram-QW4FP2JN-iDbrW_yI.js +126 -0
- package/dist/elmethis.js +36 -35
- package/dist/elmethis.umd.cjs +2272 -41
- package/dist/erDiagram-6RL3IURR-LYq0WEw3.js +937 -0
- package/dist/flowDiagram-7ASYPVHJ-DRPtjs2_.js +1484 -0
- package/dist/ganttDiagram-NTVNEXSI-C-hO_7Lp.js +2494 -0
- package/dist/gitGraph-YCYPL57B-BaVhg8eu.js +5 -0
- package/dist/gitGraphDiagram-NRZ2UAAF-u52k9qsq.js +712 -0
- package/dist/graph-CKV5wesZ.js +247 -0
- package/dist/{index-0D7NEPxZ.js → index-DQdUr-_f.js} +3548 -3436
- package/dist/index.d.ts +3 -2
- package/dist/info-46DW6VJ7-D5JUpHK_.js +5 -0
- package/dist/infoDiagram-A4XQUW5V-D5IcjWQu.js +22 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/journeyDiagram-G5WM74LC-XHcEaxXL.js +810 -0
- package/dist/kanban-definition-QRCXZQQD-BFgu8zXi.js +718 -0
- package/dist/layout-Cycesmdu.js +1324 -0
- package/dist/linear-CjRkwbhR.js +423 -0
- package/dist/mermaid-parser.core-CL_REaxY.js +12479 -0
- package/dist/mermaid.core-gtllNrzr.js +14852 -0
- package/dist/mindmap-definition-GWI6TPTV-yPOhYeCo.js +3220 -0
- package/dist/ordinal-DfAQgscy.js +61 -0
- package/dist/packet-W2GHVCYJ-D1drjM5q.js +5 -0
- package/dist/pie-BEWT4RHE-B2xFs62T.js +5 -0
- package/dist/pieDiagram-YF2LJOPJ-Cnvx0DvF.js +162 -0
- package/dist/quadrantDiagram-OS5C2QUG-DBWy6UVd.js +1024 -0
- package/dist/{razor-Dl6rcHmj.js → razor-CeqqNtyB.js} +1 -1
- package/dist/requirementDiagram-MIRIMTAZ-CfHcsBsO.js +768 -0
- package/dist/sankeyDiagram-Y46BX6SQ-C_60tCtv.js +805 -0
- package/dist/sass-eCUyDs9S.js +6 -0
- package/dist/scala-Cly-fENF.js +6 -0
- package/dist/sequenceDiagram-G6AWOVSC-XvgYpHvJ.js +2274 -0
- package/dist/stateDiagram-MAYHULR4-Bx48BKG3.js +268 -0
- package/dist/stateDiagram-v2-4JROLMXI-pDuBzVSZ.js +14 -0
- package/dist/swift-BAWqNR8A.js +6 -0
- package/dist/timeline-definition-U7ZMHBDA-EGhtku4S.js +804 -0
- package/dist/xychartDiagram-6QU3TZC5-B_OmutYz.js +1304 -0
- package/package.json +11 -10
- package/dist/sass-iCyS6eP9.js +0 -6
- package/dist/scala-BQHTnvwx.js +0 -6
- package/dist/swift-OL4r9IGP.js +0 -6
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
import { p as Z } from "./chunk-TMUBEWPD-LmMMNIqt.js";
|
|
2
|
+
import { I as F } from "./chunk-KFBOBJHC-DWru5GNu.js";
|
|
3
|
+
import { D as U, _ as h, d as ee, E as re, F as te, G as ae, l as w, s as ne, g as se, b as ce, c as oe, q as ie, r as de, e as B, x as he, j as le, v as $e, H as fe } from "./mermaid.core-gtllNrzr.js";
|
|
4
|
+
import { p as ge } from "./mermaid-parser.core-CL_REaxY.js";
|
|
5
|
+
var x = {
|
|
6
|
+
NORMAL: 0,
|
|
7
|
+
REVERSE: 1,
|
|
8
|
+
HIGHLIGHT: 2,
|
|
9
|
+
MERGE: 3,
|
|
10
|
+
CHERRY_PICK: 4
|
|
11
|
+
}, ye = U.gitGraph, z = /* @__PURE__ */ h(() => re({
|
|
12
|
+
...ye,
|
|
13
|
+
...te().gitGraph
|
|
14
|
+
}), "getConfig"), i = new F(() => {
|
|
15
|
+
const t = z(), e = t.mainBranchName, a = t.mainBranchOrder;
|
|
16
|
+
return {
|
|
17
|
+
mainBranchName: e,
|
|
18
|
+
commits: /* @__PURE__ */ new Map(),
|
|
19
|
+
head: null,
|
|
20
|
+
branchConfig: /* @__PURE__ */ new Map([[e, { name: e, order: a }]]),
|
|
21
|
+
branches: /* @__PURE__ */ new Map([[e, null]]),
|
|
22
|
+
currBranch: e,
|
|
23
|
+
direction: "LR",
|
|
24
|
+
seq: 0,
|
|
25
|
+
options: {}
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
function j() {
|
|
29
|
+
return ae({ length: 7 });
|
|
30
|
+
}
|
|
31
|
+
h(j, "getID");
|
|
32
|
+
function N(t, e) {
|
|
33
|
+
const a = /* @__PURE__ */ Object.create(null);
|
|
34
|
+
return t.reduce((s, r) => {
|
|
35
|
+
const n = e(r);
|
|
36
|
+
return a[n] || (a[n] = !0, s.push(r)), s;
|
|
37
|
+
}, []);
|
|
38
|
+
}
|
|
39
|
+
h(N, "uniqBy");
|
|
40
|
+
var ue = /* @__PURE__ */ h(function(t) {
|
|
41
|
+
i.records.direction = t;
|
|
42
|
+
}, "setDirection"), xe = /* @__PURE__ */ h(function(t) {
|
|
43
|
+
w.debug("options str", t), t = t == null ? void 0 : t.trim(), t = t || "{}";
|
|
44
|
+
try {
|
|
45
|
+
i.records.options = JSON.parse(t);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
w.error("error while parsing gitGraph options", e.message);
|
|
48
|
+
}
|
|
49
|
+
}, "setOptions"), pe = /* @__PURE__ */ h(function() {
|
|
50
|
+
return i.records.options;
|
|
51
|
+
}, "getOptions"), be = /* @__PURE__ */ h(function(t) {
|
|
52
|
+
let e = t.msg, a = t.id;
|
|
53
|
+
const s = t.type;
|
|
54
|
+
let r = t.tags;
|
|
55
|
+
w.info("commit", e, a, s, r), w.debug("Entering commit:", e, a, s, r);
|
|
56
|
+
const n = z();
|
|
57
|
+
a = B.sanitizeText(a, n), e = B.sanitizeText(e, n), r = r == null ? void 0 : r.map((c) => B.sanitizeText(c, n));
|
|
58
|
+
const o = {
|
|
59
|
+
id: a || i.records.seq + "-" + j(),
|
|
60
|
+
message: e,
|
|
61
|
+
seq: i.records.seq++,
|
|
62
|
+
type: s ?? x.NORMAL,
|
|
63
|
+
tags: r ?? [],
|
|
64
|
+
parents: i.records.head == null ? [] : [i.records.head.id],
|
|
65
|
+
branch: i.records.currBranch
|
|
66
|
+
};
|
|
67
|
+
i.records.head = o, w.info("main branch", n.mainBranchName), i.records.commits.set(o.id, o), i.records.branches.set(i.records.currBranch, o.id), w.debug("in pushCommit " + o.id);
|
|
68
|
+
}, "commit"), me = /* @__PURE__ */ h(function(t) {
|
|
69
|
+
let e = t.name;
|
|
70
|
+
const a = t.order;
|
|
71
|
+
if (e = B.sanitizeText(e, z()), i.records.branches.has(e))
|
|
72
|
+
throw new Error(
|
|
73
|
+
`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${e}")`
|
|
74
|
+
);
|
|
75
|
+
i.records.branches.set(e, i.records.head != null ? i.records.head.id : null), i.records.branchConfig.set(e, { name: e, order: a }), _(e), w.debug("in createBranch");
|
|
76
|
+
}, "branch"), we = /* @__PURE__ */ h((t) => {
|
|
77
|
+
let e = t.branch, a = t.id;
|
|
78
|
+
const s = t.type, r = t.tags, n = z();
|
|
79
|
+
e = B.sanitizeText(e, n), a && (a = B.sanitizeText(a, n));
|
|
80
|
+
const o = i.records.branches.get(i.records.currBranch), c = i.records.branches.get(e), $ = o ? i.records.commits.get(o) : void 0, l = c ? i.records.commits.get(c) : void 0;
|
|
81
|
+
if ($ && l && $.branch === e)
|
|
82
|
+
throw new Error(`Cannot merge branch '${e}' into itself.`);
|
|
83
|
+
if (i.records.currBranch === e) {
|
|
84
|
+
const d = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
|
|
85
|
+
throw d.hash = {
|
|
86
|
+
text: `merge ${e}`,
|
|
87
|
+
token: `merge ${e}`,
|
|
88
|
+
expected: ["branch abc"]
|
|
89
|
+
}, d;
|
|
90
|
+
}
|
|
91
|
+
if ($ === void 0 || !$) {
|
|
92
|
+
const d = new Error(
|
|
93
|
+
`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`
|
|
94
|
+
);
|
|
95
|
+
throw d.hash = {
|
|
96
|
+
text: `merge ${e}`,
|
|
97
|
+
token: `merge ${e}`,
|
|
98
|
+
expected: ["commit"]
|
|
99
|
+
}, d;
|
|
100
|
+
}
|
|
101
|
+
if (!i.records.branches.has(e)) {
|
|
102
|
+
const d = new Error(
|
|
103
|
+
'Incorrect usage of "merge". Branch to be merged (' + e + ") does not exist"
|
|
104
|
+
);
|
|
105
|
+
throw d.hash = {
|
|
106
|
+
text: `merge ${e}`,
|
|
107
|
+
token: `merge ${e}`,
|
|
108
|
+
expected: [`branch ${e}`]
|
|
109
|
+
}, d;
|
|
110
|
+
}
|
|
111
|
+
if (l === void 0 || !l) {
|
|
112
|
+
const d = new Error(
|
|
113
|
+
'Incorrect usage of "merge". Branch to be merged (' + e + ") has no commits"
|
|
114
|
+
);
|
|
115
|
+
throw d.hash = {
|
|
116
|
+
text: `merge ${e}`,
|
|
117
|
+
token: `merge ${e}`,
|
|
118
|
+
expected: ['"commit"']
|
|
119
|
+
}, d;
|
|
120
|
+
}
|
|
121
|
+
if ($ === l) {
|
|
122
|
+
const d = new Error('Incorrect usage of "merge". Both branches have same head');
|
|
123
|
+
throw d.hash = {
|
|
124
|
+
text: `merge ${e}`,
|
|
125
|
+
token: `merge ${e}`,
|
|
126
|
+
expected: ["branch abc"]
|
|
127
|
+
}, d;
|
|
128
|
+
}
|
|
129
|
+
if (a && i.records.commits.has(a)) {
|
|
130
|
+
const d = new Error(
|
|
131
|
+
'Incorrect usage of "merge". Commit with id:' + a + " already exists, use different custom Id"
|
|
132
|
+
);
|
|
133
|
+
throw d.hash = {
|
|
134
|
+
text: `merge ${e} ${a} ${s} ${r == null ? void 0 : r.join(" ")}`,
|
|
135
|
+
token: `merge ${e} ${a} ${s} ${r == null ? void 0 : r.join(" ")}`,
|
|
136
|
+
expected: [
|
|
137
|
+
`merge ${e} ${a}_UNIQUE ${s} ${r == null ? void 0 : r.join(" ")}`
|
|
138
|
+
]
|
|
139
|
+
}, d;
|
|
140
|
+
}
|
|
141
|
+
const f = c || "", g = {
|
|
142
|
+
id: a || `${i.records.seq}-${j()}`,
|
|
143
|
+
message: `merged branch ${e} into ${i.records.currBranch}`,
|
|
144
|
+
seq: i.records.seq++,
|
|
145
|
+
parents: i.records.head == null ? [] : [i.records.head.id, f],
|
|
146
|
+
branch: i.records.currBranch,
|
|
147
|
+
type: x.MERGE,
|
|
148
|
+
customType: s,
|
|
149
|
+
customId: !!a,
|
|
150
|
+
tags: r ?? []
|
|
151
|
+
};
|
|
152
|
+
i.records.head = g, i.records.commits.set(g.id, g), i.records.branches.set(i.records.currBranch, g.id), w.debug(i.records.branches), w.debug("in mergeBranch");
|
|
153
|
+
}, "merge"), Ce = /* @__PURE__ */ h(function(t) {
|
|
154
|
+
let e = t.id, a = t.targetId, s = t.tags, r = t.parent;
|
|
155
|
+
w.debug("Entering cherryPick:", e, a, s);
|
|
156
|
+
const n = z();
|
|
157
|
+
if (e = B.sanitizeText(e, n), a = B.sanitizeText(a, n), s = s == null ? void 0 : s.map(($) => B.sanitizeText($, n)), r = B.sanitizeText(r, n), !e || !i.records.commits.has(e)) {
|
|
158
|
+
const $ = new Error(
|
|
159
|
+
'Incorrect usage of "cherryPick". Source commit id should exist and provided'
|
|
160
|
+
);
|
|
161
|
+
throw $.hash = {
|
|
162
|
+
text: `cherryPick ${e} ${a}`,
|
|
163
|
+
token: `cherryPick ${e} ${a}`,
|
|
164
|
+
expected: ["cherry-pick abc"]
|
|
165
|
+
}, $;
|
|
166
|
+
}
|
|
167
|
+
const o = i.records.commits.get(e);
|
|
168
|
+
if (o === void 0 || !o)
|
|
169
|
+
throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
|
|
170
|
+
if (r && !(Array.isArray(o.parents) && o.parents.includes(r)))
|
|
171
|
+
throw new Error(
|
|
172
|
+
"Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
|
|
173
|
+
);
|
|
174
|
+
const c = o.branch;
|
|
175
|
+
if (o.type === x.MERGE && !r)
|
|
176
|
+
throw new Error(
|
|
177
|
+
"Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
|
|
178
|
+
);
|
|
179
|
+
if (!a || !i.records.commits.has(a)) {
|
|
180
|
+
if (c === i.records.currBranch) {
|
|
181
|
+
const g = new Error(
|
|
182
|
+
'Incorrect usage of "cherryPick". Source commit is already on current branch'
|
|
183
|
+
);
|
|
184
|
+
throw g.hash = {
|
|
185
|
+
text: `cherryPick ${e} ${a}`,
|
|
186
|
+
token: `cherryPick ${e} ${a}`,
|
|
187
|
+
expected: ["cherry-pick abc"]
|
|
188
|
+
}, g;
|
|
189
|
+
}
|
|
190
|
+
const $ = i.records.branches.get(i.records.currBranch);
|
|
191
|
+
if ($ === void 0 || !$) {
|
|
192
|
+
const g = new Error(
|
|
193
|
+
`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`
|
|
194
|
+
);
|
|
195
|
+
throw g.hash = {
|
|
196
|
+
text: `cherryPick ${e} ${a}`,
|
|
197
|
+
token: `cherryPick ${e} ${a}`,
|
|
198
|
+
expected: ["cherry-pick abc"]
|
|
199
|
+
}, g;
|
|
200
|
+
}
|
|
201
|
+
const l = i.records.commits.get($);
|
|
202
|
+
if (l === void 0 || !l) {
|
|
203
|
+
const g = new Error(
|
|
204
|
+
`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`
|
|
205
|
+
);
|
|
206
|
+
throw g.hash = {
|
|
207
|
+
text: `cherryPick ${e} ${a}`,
|
|
208
|
+
token: `cherryPick ${e} ${a}`,
|
|
209
|
+
expected: ["cherry-pick abc"]
|
|
210
|
+
}, g;
|
|
211
|
+
}
|
|
212
|
+
const f = {
|
|
213
|
+
id: i.records.seq + "-" + j(),
|
|
214
|
+
message: `cherry-picked ${o == null ? void 0 : o.message} into ${i.records.currBranch}`,
|
|
215
|
+
seq: i.records.seq++,
|
|
216
|
+
parents: i.records.head == null ? [] : [i.records.head.id, o.id],
|
|
217
|
+
branch: i.records.currBranch,
|
|
218
|
+
type: x.CHERRY_PICK,
|
|
219
|
+
tags: s ? s.filter(Boolean) : [
|
|
220
|
+
`cherry-pick:${o.id}${o.type === x.MERGE ? `|parent:${r}` : ""}`
|
|
221
|
+
]
|
|
222
|
+
};
|
|
223
|
+
i.records.head = f, i.records.commits.set(f.id, f), i.records.branches.set(i.records.currBranch, f.id), w.debug(i.records.branches), w.debug("in cherryPick");
|
|
224
|
+
}
|
|
225
|
+
}, "cherryPick"), _ = /* @__PURE__ */ h(function(t) {
|
|
226
|
+
if (t = B.sanitizeText(t, z()), i.records.branches.has(t)) {
|
|
227
|
+
i.records.currBranch = t;
|
|
228
|
+
const e = i.records.branches.get(i.records.currBranch);
|
|
229
|
+
e === void 0 || !e ? i.records.head = null : i.records.head = i.records.commits.get(e) ?? null;
|
|
230
|
+
} else {
|
|
231
|
+
const e = new Error(
|
|
232
|
+
`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`
|
|
233
|
+
);
|
|
234
|
+
throw e.hash = {
|
|
235
|
+
text: `checkout ${t}`,
|
|
236
|
+
token: `checkout ${t}`,
|
|
237
|
+
expected: [`branch ${t}`]
|
|
238
|
+
}, e;
|
|
239
|
+
}
|
|
240
|
+
}, "checkout");
|
|
241
|
+
function A(t, e, a) {
|
|
242
|
+
const s = t.indexOf(e);
|
|
243
|
+
s === -1 ? t.push(a) : t.splice(s, 1, a);
|
|
244
|
+
}
|
|
245
|
+
h(A, "upsert");
|
|
246
|
+
function D(t) {
|
|
247
|
+
const e = t.reduce((r, n) => r.seq > n.seq ? r : n, t[0]);
|
|
248
|
+
let a = "";
|
|
249
|
+
t.forEach(function(r) {
|
|
250
|
+
r === e ? a += " *" : a += " |";
|
|
251
|
+
});
|
|
252
|
+
const s = [a, e.id, e.seq];
|
|
253
|
+
for (const r in i.records.branches)
|
|
254
|
+
i.records.branches.get(r) === e.id && s.push(r);
|
|
255
|
+
if (w.debug(s.join(" ")), e.parents && e.parents.length == 2 && e.parents[0] && e.parents[1]) {
|
|
256
|
+
const r = i.records.commits.get(e.parents[0]);
|
|
257
|
+
A(t, e, r), e.parents[1] && t.push(i.records.commits.get(e.parents[1]));
|
|
258
|
+
} else {
|
|
259
|
+
if (e.parents.length == 0)
|
|
260
|
+
return;
|
|
261
|
+
if (e.parents[0]) {
|
|
262
|
+
const r = i.records.commits.get(e.parents[0]);
|
|
263
|
+
A(t, e, r);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
t = N(t, (r) => r.id), D(t);
|
|
267
|
+
}
|
|
268
|
+
h(D, "prettyPrintCommitHistory");
|
|
269
|
+
var ve = /* @__PURE__ */ h(function() {
|
|
270
|
+
w.debug(i.records.commits);
|
|
271
|
+
const t = V()[0];
|
|
272
|
+
D([t]);
|
|
273
|
+
}, "prettyPrint"), Ee = /* @__PURE__ */ h(function() {
|
|
274
|
+
i.reset(), he();
|
|
275
|
+
}, "clear"), Be = /* @__PURE__ */ h(function() {
|
|
276
|
+
return [...i.records.branchConfig.values()].map((e, a) => e.order !== null && e.order !== void 0 ? e : {
|
|
277
|
+
...e,
|
|
278
|
+
order: parseFloat(`0.${a}`)
|
|
279
|
+
}).sort((e, a) => (e.order ?? 0) - (a.order ?? 0)).map(({ name: e }) => ({ name: e }));
|
|
280
|
+
}, "getBranchesAsObjArray"), ke = /* @__PURE__ */ h(function() {
|
|
281
|
+
return i.records.branches;
|
|
282
|
+
}, "getBranches"), Le = /* @__PURE__ */ h(function() {
|
|
283
|
+
return i.records.commits;
|
|
284
|
+
}, "getCommits"), V = /* @__PURE__ */ h(function() {
|
|
285
|
+
const t = [...i.records.commits.values()];
|
|
286
|
+
return t.forEach(function(e) {
|
|
287
|
+
w.debug(e.id);
|
|
288
|
+
}), t.sort((e, a) => e.seq - a.seq), t;
|
|
289
|
+
}, "getCommitsArray"), Te = /* @__PURE__ */ h(function() {
|
|
290
|
+
return i.records.currBranch;
|
|
291
|
+
}, "getCurrentBranch"), Me = /* @__PURE__ */ h(function() {
|
|
292
|
+
return i.records.direction;
|
|
293
|
+
}, "getDirection"), Re = /* @__PURE__ */ h(function() {
|
|
294
|
+
return i.records.head;
|
|
295
|
+
}, "getHead"), X = {
|
|
296
|
+
commitType: x,
|
|
297
|
+
getConfig: z,
|
|
298
|
+
setDirection: ue,
|
|
299
|
+
setOptions: xe,
|
|
300
|
+
getOptions: pe,
|
|
301
|
+
commit: be,
|
|
302
|
+
branch: me,
|
|
303
|
+
merge: we,
|
|
304
|
+
cherryPick: Ce,
|
|
305
|
+
checkout: _,
|
|
306
|
+
//reset,
|
|
307
|
+
prettyPrint: ve,
|
|
308
|
+
clear: Ee,
|
|
309
|
+
getBranchesAsObjArray: Be,
|
|
310
|
+
getBranches: ke,
|
|
311
|
+
getCommits: Le,
|
|
312
|
+
getCommitsArray: V,
|
|
313
|
+
getCurrentBranch: Te,
|
|
314
|
+
getDirection: Me,
|
|
315
|
+
getHead: Re,
|
|
316
|
+
setAccTitle: ne,
|
|
317
|
+
getAccTitle: se,
|
|
318
|
+
getAccDescription: ce,
|
|
319
|
+
setAccDescription: oe,
|
|
320
|
+
setDiagramTitle: ie,
|
|
321
|
+
getDiagramTitle: de
|
|
322
|
+
}, Ie = /* @__PURE__ */ h((t, e) => {
|
|
323
|
+
Z(t, e), t.dir && e.setDirection(t.dir);
|
|
324
|
+
for (const a of t.statements)
|
|
325
|
+
qe(a, e);
|
|
326
|
+
}, "populate"), qe = /* @__PURE__ */ h((t, e) => {
|
|
327
|
+
const s = {
|
|
328
|
+
Commit: /* @__PURE__ */ h((r) => e.commit(Oe(r)), "Commit"),
|
|
329
|
+
Branch: /* @__PURE__ */ h((r) => e.branch(ze(r)), "Branch"),
|
|
330
|
+
Merge: /* @__PURE__ */ h((r) => e.merge(Ge(r)), "Merge"),
|
|
331
|
+
Checkout: /* @__PURE__ */ h((r) => e.checkout(He(r)), "Checkout"),
|
|
332
|
+
CherryPicking: /* @__PURE__ */ h((r) => e.cherryPick(Pe(r)), "CherryPicking")
|
|
333
|
+
}[t.$type];
|
|
334
|
+
s ? s(t) : w.error(`Unknown statement type: ${t.$type}`);
|
|
335
|
+
}, "parseStatement"), Oe = /* @__PURE__ */ h((t) => ({
|
|
336
|
+
id: t.id,
|
|
337
|
+
msg: t.message ?? "",
|
|
338
|
+
type: t.type !== void 0 ? x[t.type] : x.NORMAL,
|
|
339
|
+
tags: t.tags ?? void 0
|
|
340
|
+
}), "parseCommit"), ze = /* @__PURE__ */ h((t) => ({
|
|
341
|
+
name: t.name,
|
|
342
|
+
order: t.order ?? 0
|
|
343
|
+
}), "parseBranch"), Ge = /* @__PURE__ */ h((t) => ({
|
|
344
|
+
branch: t.branch,
|
|
345
|
+
id: t.id ?? "",
|
|
346
|
+
type: t.type !== void 0 ? x[t.type] : void 0,
|
|
347
|
+
tags: t.tags ?? void 0
|
|
348
|
+
}), "parseMerge"), He = /* @__PURE__ */ h((t) => t.branch, "parseCheckout"), Pe = /* @__PURE__ */ h((t) => {
|
|
349
|
+
var a;
|
|
350
|
+
return {
|
|
351
|
+
id: t.id,
|
|
352
|
+
targetId: "",
|
|
353
|
+
tags: ((a = t.tags) == null ? void 0 : a.length) === 0 ? void 0 : t.tags,
|
|
354
|
+
parent: t.parent
|
|
355
|
+
};
|
|
356
|
+
}, "parseCherryPicking"), We = {
|
|
357
|
+
parse: /* @__PURE__ */ h(async (t) => {
|
|
358
|
+
const e = await ge("gitGraph", t);
|
|
359
|
+
w.debug(e), Ie(e, X);
|
|
360
|
+
}, "parse")
|
|
361
|
+
}, S = ee(), b = S == null ? void 0 : S.gitGraph, R = 10, I = 40, k = 4, L = 2, O = 8, v = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), P = 30, G = /* @__PURE__ */ new Map(), W = [], M = 0, u = "LR", je = /* @__PURE__ */ h(() => {
|
|
362
|
+
v.clear(), E.clear(), G.clear(), M = 0, W = [], u = "LR";
|
|
363
|
+
}, "clear"), J = /* @__PURE__ */ h((t) => {
|
|
364
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
365
|
+
return (typeof t == "string" ? t.split(/\\n|\n|<br\s*\/?>/gi) : t).forEach((s) => {
|
|
366
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
367
|
+
r.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), r.setAttribute("dy", "1em"), r.setAttribute("x", "0"), r.setAttribute("class", "row"), r.textContent = s.trim(), e.appendChild(r);
|
|
368
|
+
}), e;
|
|
369
|
+
}, "drawText"), Q = /* @__PURE__ */ h((t) => {
|
|
370
|
+
let e, a, s;
|
|
371
|
+
return u === "BT" ? (a = /* @__PURE__ */ h((r, n) => r <= n, "comparisonFunc"), s = 1 / 0) : (a = /* @__PURE__ */ h((r, n) => r >= n, "comparisonFunc"), s = 0), t.forEach((r) => {
|
|
372
|
+
var o, c;
|
|
373
|
+
const n = u === "TB" || u == "BT" ? (o = E.get(r)) == null ? void 0 : o.y : (c = E.get(r)) == null ? void 0 : c.x;
|
|
374
|
+
n !== void 0 && a(n, s) && (e = r, s = n);
|
|
375
|
+
}), e;
|
|
376
|
+
}, "findClosestParent"), Se = /* @__PURE__ */ h((t) => {
|
|
377
|
+
let e = "", a = 1 / 0;
|
|
378
|
+
return t.forEach((s) => {
|
|
379
|
+
const r = E.get(s).y;
|
|
380
|
+
r <= a && (e = s, a = r);
|
|
381
|
+
}), e || void 0;
|
|
382
|
+
}, "findClosestParentBT"), Ae = /* @__PURE__ */ h((t, e, a) => {
|
|
383
|
+
let s = a, r = a;
|
|
384
|
+
const n = [];
|
|
385
|
+
t.forEach((o) => {
|
|
386
|
+
const c = e.get(o);
|
|
387
|
+
if (!c)
|
|
388
|
+
throw new Error(`Commit not found for key ${o}`);
|
|
389
|
+
c.parents.length ? (s = Ye(c), r = Math.max(s, r)) : n.push(c), Ke(c, s);
|
|
390
|
+
}), s = r, n.forEach((o) => {
|
|
391
|
+
Ne(o, s, a);
|
|
392
|
+
}), t.forEach((o) => {
|
|
393
|
+
const c = e.get(o);
|
|
394
|
+
if (c != null && c.parents.length) {
|
|
395
|
+
const $ = Se(c.parents);
|
|
396
|
+
s = E.get($).y - I, s <= r && (r = s);
|
|
397
|
+
const l = v.get(c.branch).pos, f = s - R;
|
|
398
|
+
E.set(c.id, { x: l, y: f });
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}, "setParallelBTPos"), De = /* @__PURE__ */ h((t) => {
|
|
402
|
+
var s;
|
|
403
|
+
const e = Q(t.parents.filter((r) => r !== null));
|
|
404
|
+
if (!e)
|
|
405
|
+
throw new Error(`Closest parent not found for commit ${t.id}`);
|
|
406
|
+
const a = (s = E.get(e)) == null ? void 0 : s.y;
|
|
407
|
+
if (a === void 0)
|
|
408
|
+
throw new Error(`Closest parent position not found for commit ${t.id}`);
|
|
409
|
+
return a;
|
|
410
|
+
}, "findClosestParentPos"), Ye = /* @__PURE__ */ h((t) => De(t) + I, "calculateCommitPosition"), Ke = /* @__PURE__ */ h((t, e) => {
|
|
411
|
+
const a = v.get(t.branch);
|
|
412
|
+
if (!a)
|
|
413
|
+
throw new Error(`Branch not found for commit ${t.id}`);
|
|
414
|
+
const s = a.pos, r = e + R;
|
|
415
|
+
return E.set(t.id, { x: s, y: r }), { x: s, y: r };
|
|
416
|
+
}, "setCommitPosition"), Ne = /* @__PURE__ */ h((t, e, a) => {
|
|
417
|
+
const s = v.get(t.branch);
|
|
418
|
+
if (!s)
|
|
419
|
+
throw new Error(`Branch not found for commit ${t.id}`);
|
|
420
|
+
const r = e + a, n = s.pos;
|
|
421
|
+
E.set(t.id, { x: n, y: r });
|
|
422
|
+
}, "setRootPosition"), _e = /* @__PURE__ */ h((t, e, a, s, r, n) => {
|
|
423
|
+
if (n === x.HIGHLIGHT)
|
|
424
|
+
t.append("rect").attr("x", a.x - 10).attr("y", a.y - 10).attr("width", 20).attr("height", 20).attr(
|
|
425
|
+
"class",
|
|
426
|
+
`commit ${e.id} commit-highlight${r % O} ${s}-outer`
|
|
427
|
+
), t.append("rect").attr("x", a.x - 6).attr("y", a.y - 6).attr("width", 12).attr("height", 12).attr(
|
|
428
|
+
"class",
|
|
429
|
+
`commit ${e.id} commit${r % O} ${s}-inner`
|
|
430
|
+
);
|
|
431
|
+
else if (n === x.CHERRY_PICK)
|
|
432
|
+
t.append("circle").attr("cx", a.x).attr("cy", a.y).attr("r", 10).attr("class", `commit ${e.id} ${s}`), t.append("circle").attr("cx", a.x - 3).attr("cy", a.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${e.id} ${s}`), t.append("circle").attr("cx", a.x + 3).attr("cy", a.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${e.id} ${s}`), t.append("line").attr("x1", a.x + 3).attr("y1", a.y + 1).attr("x2", a.x).attr("y2", a.y - 5).attr("stroke", "#fff").attr("class", `commit ${e.id} ${s}`), t.append("line").attr("x1", a.x - 3).attr("y1", a.y + 1).attr("x2", a.x).attr("y2", a.y - 5).attr("stroke", "#fff").attr("class", `commit ${e.id} ${s}`);
|
|
433
|
+
else {
|
|
434
|
+
const o = t.append("circle");
|
|
435
|
+
if (o.attr("cx", a.x), o.attr("cy", a.y), o.attr("r", e.type === x.MERGE ? 9 : 10), o.attr("class", `commit ${e.id} commit${r % O}`), n === x.MERGE) {
|
|
436
|
+
const c = t.append("circle");
|
|
437
|
+
c.attr("cx", a.x), c.attr("cy", a.y), c.attr("r", 6), c.attr(
|
|
438
|
+
"class",
|
|
439
|
+
`commit ${s} ${e.id} commit${r % O}`
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
n === x.REVERSE && t.append("path").attr(
|
|
443
|
+
"d",
|
|
444
|
+
`M ${a.x - 5},${a.y - 5}L${a.x + 5},${a.y + 5}M${a.x - 5},${a.y + 5}L${a.x + 5},${a.y - 5}`
|
|
445
|
+
).attr("class", `commit ${s} ${e.id} commit${r % O}`);
|
|
446
|
+
}
|
|
447
|
+
}, "drawCommitBullet"), Ve = /* @__PURE__ */ h((t, e, a, s) => {
|
|
448
|
+
var r;
|
|
449
|
+
if (e.type !== x.CHERRY_PICK && (e.customId && e.type === x.MERGE || e.type !== x.MERGE) && (b != null && b.showCommitLabel)) {
|
|
450
|
+
const n = t.append("g"), o = n.insert("rect").attr("class", "commit-label-bkg"), c = n.append("text").attr("x", s).attr("y", a.y + 25).attr("class", "commit-label").text(e.id), $ = (r = c.node()) == null ? void 0 : r.getBBox();
|
|
451
|
+
if ($ && (o.attr("x", a.posWithOffset - $.width / 2 - L).attr("y", a.y + 13.5).attr("width", $.width + 2 * L).attr("height", $.height + 2 * L), u === "TB" || u === "BT" ? (o.attr("x", a.x - ($.width + 4 * k + 5)).attr("y", a.y - 12), c.attr("x", a.x - ($.width + 4 * k)).attr("y", a.y + $.height - 12)) : c.attr("x", a.posWithOffset - $.width / 2), b.rotateCommitLabel))
|
|
452
|
+
if (u === "TB" || u === "BT")
|
|
453
|
+
c.attr(
|
|
454
|
+
"transform",
|
|
455
|
+
"rotate(-45, " + a.x + ", " + a.y + ")"
|
|
456
|
+
), o.attr(
|
|
457
|
+
"transform",
|
|
458
|
+
"rotate(-45, " + a.x + ", " + a.y + ")"
|
|
459
|
+
);
|
|
460
|
+
else {
|
|
461
|
+
const l = -7.5 - ($.width + 10) / 25 * 9.5, f = 10 + $.width / 25 * 8.5;
|
|
462
|
+
n.attr(
|
|
463
|
+
"transform",
|
|
464
|
+
"translate(" + l + ", " + f + ") rotate(-45, " + s + ", " + a.y + ")"
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}, "drawCommitLabel"), Xe = /* @__PURE__ */ h((t, e, a, s) => {
|
|
469
|
+
var r;
|
|
470
|
+
if (e.tags.length > 0) {
|
|
471
|
+
let n = 0, o = 0, c = 0;
|
|
472
|
+
const $ = [];
|
|
473
|
+
for (const l of e.tags.reverse()) {
|
|
474
|
+
const f = t.insert("polygon"), g = t.append("circle"), d = t.append("text").attr("y", a.y - 16 - n).attr("class", "tag-label").text(l), y = (r = d.node()) == null ? void 0 : r.getBBox();
|
|
475
|
+
if (!y)
|
|
476
|
+
throw new Error("Tag bbox not found");
|
|
477
|
+
o = Math.max(o, y.width), c = Math.max(c, y.height), d.attr("x", a.posWithOffset - y.width / 2), $.push({
|
|
478
|
+
tag: d,
|
|
479
|
+
hole: g,
|
|
480
|
+
rect: f,
|
|
481
|
+
yOffset: n
|
|
482
|
+
}), n += 20;
|
|
483
|
+
}
|
|
484
|
+
for (const { tag: l, hole: f, rect: g, yOffset: d } of $) {
|
|
485
|
+
const y = c / 2, p = a.y - 19.2 - d;
|
|
486
|
+
if (g.attr("class", "tag-label-bkg").attr(
|
|
487
|
+
"points",
|
|
488
|
+
`
|
|
489
|
+
${s - o / 2 - k / 2},${p + L}
|
|
490
|
+
${s - o / 2 - k / 2},${p - L}
|
|
491
|
+
${a.posWithOffset - o / 2 - k},${p - y - L}
|
|
492
|
+
${a.posWithOffset + o / 2 + k},${p - y - L}
|
|
493
|
+
${a.posWithOffset + o / 2 + k},${p + y + L}
|
|
494
|
+
${a.posWithOffset - o / 2 - k},${p + y + L}`
|
|
495
|
+
), f.attr("cy", p).attr("cx", s - o / 2 + k / 2).attr("r", 1.5).attr("class", "tag-hole"), u === "TB" || u === "BT") {
|
|
496
|
+
const m = s + d;
|
|
497
|
+
g.attr("class", "tag-label-bkg").attr(
|
|
498
|
+
"points",
|
|
499
|
+
`
|
|
500
|
+
${a.x},${m + 2}
|
|
501
|
+
${a.x},${m - 2}
|
|
502
|
+
${a.x + R},${m - y - 2}
|
|
503
|
+
${a.x + R + o + 4},${m - y - 2}
|
|
504
|
+
${a.x + R + o + 4},${m + y + 2}
|
|
505
|
+
${a.x + R},${m + y + 2}`
|
|
506
|
+
).attr("transform", "translate(12,12) rotate(45, " + a.x + "," + s + ")"), f.attr("cx", a.x + k / 2).attr("cy", m).attr("transform", "translate(12,12) rotate(45, " + a.x + "," + s + ")"), l.attr("x", a.x + 5).attr("y", m + 3).attr("transform", "translate(14,14) rotate(45, " + a.x + "," + s + ")");
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}, "drawCommitTags"), Je = /* @__PURE__ */ h((t) => {
|
|
511
|
+
switch (t.customType ?? t.type) {
|
|
512
|
+
case x.NORMAL:
|
|
513
|
+
return "commit-normal";
|
|
514
|
+
case x.REVERSE:
|
|
515
|
+
return "commit-reverse";
|
|
516
|
+
case x.HIGHLIGHT:
|
|
517
|
+
return "commit-highlight";
|
|
518
|
+
case x.MERGE:
|
|
519
|
+
return "commit-merge";
|
|
520
|
+
case x.CHERRY_PICK:
|
|
521
|
+
return "commit-cherry-pick";
|
|
522
|
+
default:
|
|
523
|
+
return "commit-normal";
|
|
524
|
+
}
|
|
525
|
+
}, "getCommitClassType"), Qe = /* @__PURE__ */ h((t, e, a, s) => {
|
|
526
|
+
const r = { x: 0, y: 0 };
|
|
527
|
+
if (t.parents.length > 0) {
|
|
528
|
+
const n = Q(t.parents);
|
|
529
|
+
if (n) {
|
|
530
|
+
const o = s.get(n) ?? r;
|
|
531
|
+
return e === "TB" ? o.y + I : e === "BT" ? (s.get(t.id) ?? r).y - I : o.x + I;
|
|
532
|
+
}
|
|
533
|
+
} else
|
|
534
|
+
return e === "TB" ? P : e === "BT" ? (s.get(t.id) ?? r).y - I : 0;
|
|
535
|
+
return 0;
|
|
536
|
+
}, "calculatePosition"), Ze = /* @__PURE__ */ h((t, e, a) => {
|
|
537
|
+
var o, c;
|
|
538
|
+
const s = u === "BT" && a ? e : e + R, r = u === "TB" || u === "BT" ? s : (o = v.get(t.branch)) == null ? void 0 : o.pos, n = u === "TB" || u === "BT" ? (c = v.get(t.branch)) == null ? void 0 : c.pos : s;
|
|
539
|
+
if (n === void 0 || r === void 0)
|
|
540
|
+
throw new Error(`Position were undefined for commit ${t.id}`);
|
|
541
|
+
return { x: n, y: r, posWithOffset: s };
|
|
542
|
+
}, "getCommitPosition"), K = /* @__PURE__ */ h((t, e, a) => {
|
|
543
|
+
if (!b)
|
|
544
|
+
throw new Error("GitGraph config not found");
|
|
545
|
+
const s = t.append("g").attr("class", "commit-bullets"), r = t.append("g").attr("class", "commit-labels");
|
|
546
|
+
let n = u === "TB" || u === "BT" ? P : 0;
|
|
547
|
+
const o = [...e.keys()], c = (b == null ? void 0 : b.parallelCommits) ?? !1, $ = /* @__PURE__ */ h((f, g) => {
|
|
548
|
+
var p, m;
|
|
549
|
+
const d = (p = e.get(f)) == null ? void 0 : p.seq, y = (m = e.get(g)) == null ? void 0 : m.seq;
|
|
550
|
+
return d !== void 0 && y !== void 0 ? d - y : 0;
|
|
551
|
+
}, "sortKeys");
|
|
552
|
+
let l = o.sort($);
|
|
553
|
+
u === "BT" && (c && Ae(l, e, n), l = l.reverse()), l.forEach((f) => {
|
|
554
|
+
var y;
|
|
555
|
+
const g = e.get(f);
|
|
556
|
+
if (!g)
|
|
557
|
+
throw new Error(`Commit not found for key ${f}`);
|
|
558
|
+
c && (n = Qe(g, u, n, E));
|
|
559
|
+
const d = Ze(g, n, c);
|
|
560
|
+
if (a) {
|
|
561
|
+
const p = Je(g), m = g.customType ?? g.type, q = ((y = v.get(g.branch)) == null ? void 0 : y.index) ?? 0;
|
|
562
|
+
_e(s, g, d, p, q, m), Ve(r, g, d, n), Xe(r, g, d, n);
|
|
563
|
+
}
|
|
564
|
+
u === "TB" || u === "BT" ? E.set(g.id, { x: d.x, y: d.posWithOffset }) : E.set(g.id, { x: d.posWithOffset, y: d.y }), n = u === "BT" && c ? n + I : n + I + R, n > M && (M = n);
|
|
565
|
+
});
|
|
566
|
+
}, "drawCommits"), Fe = /* @__PURE__ */ h((t, e, a, s, r) => {
|
|
567
|
+
const o = (u === "TB" || u === "BT" ? a.x < s.x : a.y < s.y) ? e.branch : t.branch, c = /* @__PURE__ */ h((l) => l.branch === o, "isOnBranchToGetCurve"), $ = /* @__PURE__ */ h((l) => l.seq > t.seq && l.seq < e.seq, "isBetweenCommits");
|
|
568
|
+
return [...r.values()].some((l) => $(l) && c(l));
|
|
569
|
+
}, "shouldRerouteArrow"), H = /* @__PURE__ */ h((t, e, a = 0) => {
|
|
570
|
+
const s = t + Math.abs(t - e) / 2;
|
|
571
|
+
if (a > 5)
|
|
572
|
+
return s;
|
|
573
|
+
if (W.every((o) => Math.abs(o - s) >= 10))
|
|
574
|
+
return W.push(s), s;
|
|
575
|
+
const n = Math.abs(t - e);
|
|
576
|
+
return H(t, e - n / 5, a + 1);
|
|
577
|
+
}, "findLane"), Ue = /* @__PURE__ */ h((t, e, a, s) => {
|
|
578
|
+
var y, p, m, q, Y;
|
|
579
|
+
const r = E.get(e.id), n = E.get(a.id);
|
|
580
|
+
if (r === void 0 || n === void 0)
|
|
581
|
+
throw new Error(`Commit positions not found for commits ${e.id} and ${a.id}`);
|
|
582
|
+
const o = Fe(e, a, r, n, s);
|
|
583
|
+
let c = "", $ = "", l = 0, f = 0, g = (y = v.get(a.branch)) == null ? void 0 : y.index;
|
|
584
|
+
a.type === x.MERGE && e.id !== a.parents[0] && (g = (p = v.get(e.branch)) == null ? void 0 : p.index);
|
|
585
|
+
let d;
|
|
586
|
+
if (o) {
|
|
587
|
+
c = "A 10 10, 0, 0, 0,", $ = "A 10 10, 0, 0, 1,", l = 10, f = 10;
|
|
588
|
+
const T = r.y < n.y ? H(r.y, n.y) : H(n.y, r.y), C = r.x < n.x ? H(r.x, n.x) : H(n.x, r.x);
|
|
589
|
+
u === "TB" ? r.x < n.x ? d = `M ${r.x} ${r.y} L ${C - l} ${r.y} ${$} ${C} ${r.y + f} L ${C} ${n.y - l} ${c} ${C + f} ${n.y} L ${n.x} ${n.y}` : (g = (m = v.get(e.branch)) == null ? void 0 : m.index, d = `M ${r.x} ${r.y} L ${C + l} ${r.y} ${c} ${C} ${r.y + f} L ${C} ${n.y - l} ${$} ${C - f} ${n.y} L ${n.x} ${n.y}`) : u === "BT" ? r.x < n.x ? d = `M ${r.x} ${r.y} L ${C - l} ${r.y} ${c} ${C} ${r.y - f} L ${C} ${n.y + l} ${$} ${C + f} ${n.y} L ${n.x} ${n.y}` : (g = (q = v.get(e.branch)) == null ? void 0 : q.index, d = `M ${r.x} ${r.y} L ${C + l} ${r.y} ${$} ${C} ${r.y - f} L ${C} ${n.y + l} ${c} ${C - f} ${n.y} L ${n.x} ${n.y}`) : r.y < n.y ? d = `M ${r.x} ${r.y} L ${r.x} ${T - l} ${c} ${r.x + f} ${T} L ${n.x - l} ${T} ${$} ${n.x} ${T + f} L ${n.x} ${n.y}` : (g = (Y = v.get(e.branch)) == null ? void 0 : Y.index, d = `M ${r.x} ${r.y} L ${r.x} ${T + l} ${$} ${r.x + f} ${T} L ${n.x - l} ${T} ${c} ${n.x} ${T - f} L ${n.x} ${n.y}`);
|
|
590
|
+
} else
|
|
591
|
+
c = "A 20 20, 0, 0, 0,", $ = "A 20 20, 0, 0, 1,", l = 20, f = 20, u === "TB" ? (r.x < n.x && (a.type === x.MERGE && e.id !== a.parents[0] ? d = `M ${r.x} ${r.y} L ${r.x} ${n.y - l} ${c} ${r.x + f} ${n.y} L ${n.x} ${n.y}` : d = `M ${r.x} ${r.y} L ${n.x - l} ${r.y} ${$} ${n.x} ${r.y + f} L ${n.x} ${n.y}`), r.x > n.x && (c = "A 20 20, 0, 0, 0,", $ = "A 20 20, 0, 0, 1,", l = 20, f = 20, a.type === x.MERGE && e.id !== a.parents[0] ? d = `M ${r.x} ${r.y} L ${r.x} ${n.y - l} ${$} ${r.x - f} ${n.y} L ${n.x} ${n.y}` : d = `M ${r.x} ${r.y} L ${n.x + l} ${r.y} ${c} ${n.x} ${r.y + f} L ${n.x} ${n.y}`), r.x === n.x && (d = `M ${r.x} ${r.y} L ${n.x} ${n.y}`)) : u === "BT" ? (r.x < n.x && (a.type === x.MERGE && e.id !== a.parents[0] ? d = `M ${r.x} ${r.y} L ${r.x} ${n.y + l} ${$} ${r.x + f} ${n.y} L ${n.x} ${n.y}` : d = `M ${r.x} ${r.y} L ${n.x - l} ${r.y} ${c} ${n.x} ${r.y - f} L ${n.x} ${n.y}`), r.x > n.x && (c = "A 20 20, 0, 0, 0,", $ = "A 20 20, 0, 0, 1,", l = 20, f = 20, a.type === x.MERGE && e.id !== a.parents[0] ? d = `M ${r.x} ${r.y} L ${r.x} ${n.y + l} ${c} ${r.x - f} ${n.y} L ${n.x} ${n.y}` : d = `M ${r.x} ${r.y} L ${n.x - l} ${r.y} ${c} ${n.x} ${r.y - f} L ${n.x} ${n.y}`), r.x === n.x && (d = `M ${r.x} ${r.y} L ${n.x} ${n.y}`)) : (r.y < n.y && (a.type === x.MERGE && e.id !== a.parents[0] ? d = `M ${r.x} ${r.y} L ${n.x - l} ${r.y} ${$} ${n.x} ${r.y + f} L ${n.x} ${n.y}` : d = `M ${r.x} ${r.y} L ${r.x} ${n.y - l} ${c} ${r.x + f} ${n.y} L ${n.x} ${n.y}`), r.y > n.y && (a.type === x.MERGE && e.id !== a.parents[0] ? d = `M ${r.x} ${r.y} L ${n.x - l} ${r.y} ${c} ${n.x} ${r.y - f} L ${n.x} ${n.y}` : d = `M ${r.x} ${r.y} L ${r.x} ${n.y + l} ${$} ${r.x + f} ${n.y} L ${n.x} ${n.y}`), r.y === n.y && (d = `M ${r.x} ${r.y} L ${n.x} ${n.y}`));
|
|
592
|
+
if (d === void 0)
|
|
593
|
+
throw new Error("Line definition not found");
|
|
594
|
+
t.append("path").attr("d", d).attr("class", "arrow arrow" + g % O);
|
|
595
|
+
}, "drawArrow"), er = /* @__PURE__ */ h((t, e) => {
|
|
596
|
+
const a = t.append("g").attr("class", "commit-arrows");
|
|
597
|
+
[...e.keys()].forEach((s) => {
|
|
598
|
+
const r = e.get(s);
|
|
599
|
+
r.parents && r.parents.length > 0 && r.parents.forEach((n) => {
|
|
600
|
+
Ue(a, e.get(n), r, e);
|
|
601
|
+
});
|
|
602
|
+
});
|
|
603
|
+
}, "drawArrows"), rr = /* @__PURE__ */ h((t, e) => {
|
|
604
|
+
const a = t.append("g");
|
|
605
|
+
e.forEach((s, r) => {
|
|
606
|
+
var p;
|
|
607
|
+
const n = r % O, o = (p = v.get(s.name)) == null ? void 0 : p.pos;
|
|
608
|
+
if (o === void 0)
|
|
609
|
+
throw new Error(`Position not found for branch ${s.name}`);
|
|
610
|
+
const c = a.append("line");
|
|
611
|
+
c.attr("x1", 0), c.attr("y1", o), c.attr("x2", M), c.attr("y2", o), c.attr("class", "branch branch" + n), u === "TB" ? (c.attr("y1", P), c.attr("x1", o), c.attr("y2", M), c.attr("x2", o)) : u === "BT" && (c.attr("y1", M), c.attr("x1", o), c.attr("y2", P), c.attr("x2", o)), W.push(o);
|
|
612
|
+
const $ = s.name, l = J($), f = a.insert("rect"), d = a.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + n);
|
|
613
|
+
d.node().appendChild(l);
|
|
614
|
+
const y = l.getBBox();
|
|
615
|
+
f.attr("class", "branchLabelBkg label" + n).attr("rx", 4).attr("ry", 4).attr("x", -y.width - 4 - ((b == null ? void 0 : b.rotateCommitLabel) === !0 ? 30 : 0)).attr("y", -y.height / 2 + 8).attr("width", y.width + 18).attr("height", y.height + 4), d.attr(
|
|
616
|
+
"transform",
|
|
617
|
+
"translate(" + (-y.width - 14 - ((b == null ? void 0 : b.rotateCommitLabel) === !0 ? 30 : 0)) + ", " + (o - y.height / 2 - 1) + ")"
|
|
618
|
+
), u === "TB" ? (f.attr("x", o - y.width / 2 - 10).attr("y", 0), d.attr("transform", "translate(" + (o - y.width / 2 - 5) + ", 0)")) : u === "BT" ? (f.attr("x", o - y.width / 2 - 10).attr("y", M), d.attr("transform", "translate(" + (o - y.width / 2 - 5) + ", " + M + ")")) : f.attr("transform", "translate(-19, " + (o - y.height / 2) + ")");
|
|
619
|
+
});
|
|
620
|
+
}, "drawBranches"), tr = /* @__PURE__ */ h(function(t, e, a, s, r) {
|
|
621
|
+
return v.set(t, { pos: e, index: a }), e += 50 + (r ? 40 : 0) + (u === "TB" || u === "BT" ? s.width / 2 : 0), e;
|
|
622
|
+
}, "setBranchPosition"), ar = /* @__PURE__ */ h(function(t, e, a, s) {
|
|
623
|
+
if (je(), w.debug("in gitgraph renderer", t + `
|
|
624
|
+
`, "id:", e, a), !b)
|
|
625
|
+
throw new Error("GitGraph config not found");
|
|
626
|
+
const r = b.rotateCommitLabel ?? !1, n = s.db;
|
|
627
|
+
G = n.getCommits();
|
|
628
|
+
const o = n.getBranchesAsObjArray();
|
|
629
|
+
u = n.getDirection();
|
|
630
|
+
const c = le(`[id="${e}"]`);
|
|
631
|
+
let $ = 0;
|
|
632
|
+
o.forEach((l, f) => {
|
|
633
|
+
var q;
|
|
634
|
+
const g = J(l.name), d = c.append("g"), y = d.insert("g").attr("class", "branchLabel"), p = y.insert("g").attr("class", "label branch-label");
|
|
635
|
+
(q = p.node()) == null || q.appendChild(g);
|
|
636
|
+
const m = g.getBBox();
|
|
637
|
+
$ = tr(l.name, $, f, m, r), p.remove(), y.remove(), d.remove();
|
|
638
|
+
}), K(c, G, !1), b.showBranches && rr(c, o), er(c, G), K(c, G, !0), $e.insertTitle(
|
|
639
|
+
c,
|
|
640
|
+
"gitTitleText",
|
|
641
|
+
b.titleTopMargin ?? 0,
|
|
642
|
+
n.getDiagramTitle()
|
|
643
|
+
), fe(
|
|
644
|
+
void 0,
|
|
645
|
+
c,
|
|
646
|
+
b.diagramPadding,
|
|
647
|
+
b.useMaxWidth
|
|
648
|
+
);
|
|
649
|
+
}, "draw"), nr = {
|
|
650
|
+
draw: ar
|
|
651
|
+
}, sr = /* @__PURE__ */ h((t) => `
|
|
652
|
+
.commit-id,
|
|
653
|
+
.commit-msg,
|
|
654
|
+
.branch-label {
|
|
655
|
+
fill: lightgrey;
|
|
656
|
+
color: lightgrey;
|
|
657
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
658
|
+
font-family: var(--mermaid-font-family);
|
|
659
|
+
}
|
|
660
|
+
${[0, 1, 2, 3, 4, 5, 6, 7].map(
|
|
661
|
+
(e) => `
|
|
662
|
+
.branch-label${e} { fill: ${t["gitBranchLabel" + e]}; }
|
|
663
|
+
.commit${e} { stroke: ${t["git" + e]}; fill: ${t["git" + e]}; }
|
|
664
|
+
.commit-highlight${e} { stroke: ${t["gitInv" + e]}; fill: ${t["gitInv" + e]}; }
|
|
665
|
+
.label${e} { fill: ${t["git" + e]}; }
|
|
666
|
+
.arrow${e} { stroke: ${t["git" + e]}; }
|
|
667
|
+
`
|
|
668
|
+
).join(`
|
|
669
|
+
`)}
|
|
670
|
+
|
|
671
|
+
.branch {
|
|
672
|
+
stroke-width: 1;
|
|
673
|
+
stroke: ${t.lineColor};
|
|
674
|
+
stroke-dasharray: 2;
|
|
675
|
+
}
|
|
676
|
+
.commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
|
|
677
|
+
.commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
|
|
678
|
+
.tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
|
|
679
|
+
.tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
|
|
680
|
+
.tag-hole { fill: ${t.textColor}; }
|
|
681
|
+
|
|
682
|
+
.commit-merge {
|
|
683
|
+
stroke: ${t.primaryColor};
|
|
684
|
+
fill: ${t.primaryColor};
|
|
685
|
+
}
|
|
686
|
+
.commit-reverse {
|
|
687
|
+
stroke: ${t.primaryColor};
|
|
688
|
+
fill: ${t.primaryColor};
|
|
689
|
+
stroke-width: 3;
|
|
690
|
+
}
|
|
691
|
+
.commit-highlight-outer {
|
|
692
|
+
}
|
|
693
|
+
.commit-highlight-inner {
|
|
694
|
+
stroke: ${t.primaryColor};
|
|
695
|
+
fill: ${t.primaryColor};
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
|
|
699
|
+
.gitTitleText {
|
|
700
|
+
text-anchor: middle;
|
|
701
|
+
font-size: 18px;
|
|
702
|
+
fill: ${t.textColor};
|
|
703
|
+
}
|
|
704
|
+
`, "getStyles"), cr = sr, lr = {
|
|
705
|
+
parser: We,
|
|
706
|
+
db: X,
|
|
707
|
+
renderer: nr,
|
|
708
|
+
styles: cr
|
|
709
|
+
};
|
|
710
|
+
export {
|
|
711
|
+
lr as diagram
|
|
712
|
+
};
|