@prefecthq/prefab-ui-docs 0.16.3 → 0.17.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/_renderer/_basePickBy-fiErwOTY.mjs +151 -0
- package/dist/_renderer/_baseUniq-Iy7gOYgw.mjs +614 -0
- package/dist/_renderer/arc-BYm2F1-h.mjs +83 -0
- package/dist/_renderer/architectureDiagram-2XIMDMQ5-BKR0-ZSX.mjs +4683 -0
- package/dist/_renderer/band-TE_TbDmh.mjs +56 -0
- package/dist/_renderer/blockDiagram-WCTKOSBZ-BruGG_9M.mjs +2298 -0
- package/dist/_renderer/c4Diagram-IC4MRINW-K4nxeBNU.mjs +1581 -0
- package/dist/_renderer/channel-D4_UYSAN.mjs +5 -0
- package/dist/_renderer/charts-Bwny4UB2.mjs +19169 -0
- package/dist/_renderer/chunk-4BX2VUAB-mqLb5fm9.mjs +9 -0
- package/dist/_renderer/chunk-55IACEB6-Bxgi9T70.mjs +8 -0
- package/dist/_renderer/chunk-FMBD7UC4-Dsah75wQ.mjs +19 -0
- package/dist/_renderer/chunk-JSJVCQXG-Bsg6dsjU.mjs +68 -0
- package/dist/_renderer/chunk-KX2RTZJC-DvDXsxvC.mjs +20 -0
- package/dist/_renderer/chunk-NQ4KR5QH-CwFlbBfF.mjs +1384 -0
- package/dist/_renderer/chunk-QZHKN3VN-CYPyScRI.mjs +15 -0
- package/dist/_renderer/chunk-WL4C6EOR-2eYOPJVd.mjs +1430 -0
- package/dist/_renderer/classDiagram-VBA2DB6C-Dj8h8-wl.mjs +16 -0
- package/dist/_renderer/classDiagram-v2-RAHNMMFH-Dj8h8-wl.mjs +16 -0
- package/dist/_renderer/clone-BmajYOc3.mjs +8 -0
- package/dist/_renderer/{compound-calendar-Cn18AoRs.mjs → compound-calendar-Bmz7kTAd.mjs} +3 -3
- package/dist/_renderer/{content-e43PvxaF.mjs → content-Bd8N98h-.mjs} +6 -6
- package/dist/_renderer/cose-bilkent-S5V4N54A-BLhD0lt7.mjs +2609 -0
- package/dist/_renderer/cytoscape.esm-CjI2IsL8.mjs +18735 -0
- package/dist/_renderer/dagre-KLK3FWXG-DCIde85z.mjs +447 -0
- package/dist/_renderer/defaultLocale-BgPVtth8.mjs +171 -0
- package/dist/_renderer/diagram-E7M64L7V-BbWs-jbo.mjs +533 -0
- package/dist/_renderer/diagram-IFDJBPK2-Sfx8kanl.mjs +221 -0
- package/dist/_renderer/diagram-P4PSJMXO-DCqYaW3Z.mjs +143 -0
- package/dist/_renderer/{embed-DRE2wKZJ.mjs → embed-BCPaWfQN.mjs} +1119 -1114
- package/dist/_renderer/embed.mjs +1 -1
- package/dist/_renderer/erDiagram-INFDFZHY-D8cdLSCi.mjs +863 -0
- package/dist/_renderer/flowDiagram-PKNHOUZH-B_rW2Xww.mjs +1647 -0
- package/dist/_renderer/ganttDiagram-A5KZAMGK-Be_Svnat.mjs +1964 -0
- package/dist/_renderer/gitGraphDiagram-K3NZZRJ6--wMgYsSv.mjs +709 -0
- package/dist/_renderer/graph-alLjIojU.mjs +604 -0
- package/dist/_renderer/{icons-CImNZgDa.mjs → icons-w8tvN_30.mjs} +155 -135
- package/dist/_renderer/infoDiagram-LFFYTUFH-QW1PzgNF.mjs +24 -0
- package/dist/_renderer/init-DxzjmxYy.mjs +32 -0
- package/dist/_renderer/ishikawaDiagram-PHBUUO56-xY8fsGh3.mjs +621 -0
- package/dist/_renderer/journeyDiagram-4ABVD52K-7XeHSH9G.mjs +834 -0
- package/dist/_renderer/kanban-definition-K7BYSVSG-Cn7INDI0.mjs +723 -0
- package/dist/_renderer/katex-AQJr8RMF.mjs +11623 -0
- package/dist/_renderer/layout-Bspk8k85.mjs +1335 -0
- package/dist/_renderer/linear-CVnzSbdA.mjs +275 -0
- package/dist/_renderer/mermaid-DjgBUZ1W.mjs +48 -0
- package/dist/_renderer/mermaid.core-BzbdT8_O.mjs +13838 -0
- package/dist/_renderer/mindmap-definition-YRQLILUH-CVIMKVZI.mjs +788 -0
- package/dist/_renderer/ordinal-Bq0KrZxK.mjs +62 -0
- package/dist/_renderer/pieDiagram-SKSYHLDU-CL_luPJM.mjs +162 -0
- package/dist/_renderer/{svg-BL0kMZ_p.mjs → purify.es-M2Bspgo5.mjs} +222 -240
- package/dist/_renderer/quadrantDiagram-337W2JSQ-BQWFWFNU.mjs +1024 -0
- package/dist/_renderer/requirementDiagram-Z7DCOOCP-Di29RxJ6.mjs +862 -0
- package/dist/_renderer/sankeyDiagram-WA2Y5GQK-DY4kgDbR.mjs +810 -0
- package/dist/_renderer/sequenceDiagram-2WXFIKYE-vjbD37pn.mjs +2823 -0
- package/dist/_renderer/stateDiagram-RAJIS63D-BQ9BAuO6.mjs +264 -0
- package/dist/_renderer/stateDiagram-v2-FVOUBMTO-Bs26kEor.mjs +16 -0
- package/dist/_renderer/string-kGvNrjOo.mjs +934 -0
- package/dist/_renderer/svg-qTs_3V9p.mjs +22 -0
- package/dist/_renderer/time-sQ_UKgU4.mjs +765 -0
- package/dist/_renderer/timeline-definition-YZTLITO2-CJfaRgME.mjs +799 -0
- package/dist/_renderer/treemap-KZPCXAKY-DQq6TCTm.mjs +17996 -0
- package/dist/_renderer/vennDiagram-LZ73GAT5-BkBksHrj.mjs +1564 -0
- package/dist/_renderer/xychartDiagram-JWTSCODW-Boo1R-nF.mjs +1299 -0
- package/package.json +1 -1
- package/dist/_renderer/charts-Dr57vKmb.mjs +0 -21311
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
import { p as V } from "./chunk-4BX2VUAB-mqLb5fm9.mjs";
|
|
2
|
+
import { I as X } from "./chunk-QZHKN3VN-CYPyScRI.mjs";
|
|
3
|
+
import { q as J, p as Q, s as Z, g as rr, a as er, b as tr, _ as $, l as m, d as ar, u as sr, C as nr, y as or, k as E, D as cr, E as ir, F as dr, G as hr } from "./mermaid.core-BzbdT8_O.mjs";
|
|
4
|
+
import { p as lr } from "./treemap-KZPCXAKY-DQq6TCTm.mjs";
|
|
5
|
+
var p = {
|
|
6
|
+
NORMAL: 0,
|
|
7
|
+
REVERSE: 1,
|
|
8
|
+
HIGHLIGHT: 2,
|
|
9
|
+
MERGE: 3,
|
|
10
|
+
CHERRY_PICK: 4
|
|
11
|
+
}, $r = ir.gitGraph, q = /* @__PURE__ */ $(() => cr({
|
|
12
|
+
...$r,
|
|
13
|
+
...dr().gitGraph
|
|
14
|
+
}), "getConfig"), i = new X(() => {
|
|
15
|
+
const t = q(), r = t.mainBranchName, a = t.mainBranchOrder;
|
|
16
|
+
return {
|
|
17
|
+
mainBranchName: r,
|
|
18
|
+
commits: /* @__PURE__ */ new Map(),
|
|
19
|
+
head: null,
|
|
20
|
+
branchConfig: /* @__PURE__ */ new Map([[r, { name: r, order: a }]]),
|
|
21
|
+
branches: /* @__PURE__ */ new Map([[r, null]]),
|
|
22
|
+
currBranch: r,
|
|
23
|
+
direction: "LR",
|
|
24
|
+
seq: 0,
|
|
25
|
+
options: {}
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
function z() {
|
|
29
|
+
return hr({ length: 7 });
|
|
30
|
+
}
|
|
31
|
+
$(z, "getID");
|
|
32
|
+
function W(t, r) {
|
|
33
|
+
const a = /* @__PURE__ */ Object.create(null);
|
|
34
|
+
return t.reduce((n, e) => {
|
|
35
|
+
const s = r(e);
|
|
36
|
+
return a[s] || (a[s] = !0, n.push(e)), n;
|
|
37
|
+
}, []);
|
|
38
|
+
}
|
|
39
|
+
$(W, "uniqBy");
|
|
40
|
+
var fr = /* @__PURE__ */ $(function(t) {
|
|
41
|
+
i.records.direction = t;
|
|
42
|
+
}, "setDirection"), yr = /* @__PURE__ */ $(function(t) {
|
|
43
|
+
m.debug("options str", t), t = t == null ? void 0 : t.trim(), t = t || "{}";
|
|
44
|
+
try {
|
|
45
|
+
i.records.options = JSON.parse(t);
|
|
46
|
+
} catch (r) {
|
|
47
|
+
m.error("error while parsing gitGraph options", r.message);
|
|
48
|
+
}
|
|
49
|
+
}, "setOptions"), gr = /* @__PURE__ */ $(function() {
|
|
50
|
+
return i.records.options;
|
|
51
|
+
}, "getOptions"), xr = /* @__PURE__ */ $(function(t) {
|
|
52
|
+
let r = t.msg, a = t.id;
|
|
53
|
+
const n = t.type;
|
|
54
|
+
let e = t.tags;
|
|
55
|
+
m.info("commit", r, a, n, e), m.debug("Entering commit:", r, a, n, e);
|
|
56
|
+
const s = q();
|
|
57
|
+
a = E.sanitizeText(a, s), r = E.sanitizeText(r, s), e = e == null ? void 0 : e.map((c) => E.sanitizeText(c, s));
|
|
58
|
+
const o = {
|
|
59
|
+
id: a || i.records.seq + "-" + z(),
|
|
60
|
+
message: r,
|
|
61
|
+
seq: i.records.seq++,
|
|
62
|
+
type: n ?? p.NORMAL,
|
|
63
|
+
tags: e ?? [],
|
|
64
|
+
parents: i.records.head == null ? [] : [i.records.head.id],
|
|
65
|
+
branch: i.records.currBranch
|
|
66
|
+
};
|
|
67
|
+
i.records.head = o, m.info("main branch", s.mainBranchName), i.records.commits.has(o.id) && m.warn(`Commit ID ${o.id} already exists`), i.records.commits.set(o.id, o), i.records.branches.set(i.records.currBranch, o.id), m.debug("in pushCommit " + o.id);
|
|
68
|
+
}, "commit"), ur = /* @__PURE__ */ $(function(t) {
|
|
69
|
+
let r = t.name;
|
|
70
|
+
const a = t.order;
|
|
71
|
+
if (r = E.sanitizeText(r, q()), i.records.branches.has(r))
|
|
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 ${r}")`
|
|
74
|
+
);
|
|
75
|
+
i.records.branches.set(r, i.records.head != null ? i.records.head.id : null), i.records.branchConfig.set(r, { name: r, order: a }), S(r), m.debug("in createBranch");
|
|
76
|
+
}, "branch"), pr = /* @__PURE__ */ $((t) => {
|
|
77
|
+
let r = t.branch, a = t.id;
|
|
78
|
+
const n = t.type, e = t.tags, s = q();
|
|
79
|
+
r = E.sanitizeText(r, s), a && (a = E.sanitizeText(a, s));
|
|
80
|
+
const o = i.records.branches.get(i.records.currBranch), c = i.records.branches.get(r), d = o ? i.records.commits.get(o) : void 0, h = c ? i.records.commits.get(c) : void 0;
|
|
81
|
+
if (d && h && d.branch === r)
|
|
82
|
+
throw new Error(`Cannot merge branch '${r}' into itself.`);
|
|
83
|
+
if (i.records.currBranch === r) {
|
|
84
|
+
const l = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
|
|
85
|
+
throw l.hash = {
|
|
86
|
+
text: `merge ${r}`,
|
|
87
|
+
token: `merge ${r}`,
|
|
88
|
+
expected: ["branch abc"]
|
|
89
|
+
}, l;
|
|
90
|
+
}
|
|
91
|
+
if (d === void 0 || !d) {
|
|
92
|
+
const l = new Error(
|
|
93
|
+
`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`
|
|
94
|
+
);
|
|
95
|
+
throw l.hash = {
|
|
96
|
+
text: `merge ${r}`,
|
|
97
|
+
token: `merge ${r}`,
|
|
98
|
+
expected: ["commit"]
|
|
99
|
+
}, l;
|
|
100
|
+
}
|
|
101
|
+
if (!i.records.branches.has(r)) {
|
|
102
|
+
const l = new Error(
|
|
103
|
+
'Incorrect usage of "merge". Branch to be merged (' + r + ") does not exist"
|
|
104
|
+
);
|
|
105
|
+
throw l.hash = {
|
|
106
|
+
text: `merge ${r}`,
|
|
107
|
+
token: `merge ${r}`,
|
|
108
|
+
expected: [`branch ${r}`]
|
|
109
|
+
}, l;
|
|
110
|
+
}
|
|
111
|
+
if (h === void 0 || !h) {
|
|
112
|
+
const l = new Error(
|
|
113
|
+
'Incorrect usage of "merge". Branch to be merged (' + r + ") has no commits"
|
|
114
|
+
);
|
|
115
|
+
throw l.hash = {
|
|
116
|
+
text: `merge ${r}`,
|
|
117
|
+
token: `merge ${r}`,
|
|
118
|
+
expected: ['"commit"']
|
|
119
|
+
}, l;
|
|
120
|
+
}
|
|
121
|
+
if (d === h) {
|
|
122
|
+
const l = new Error('Incorrect usage of "merge". Both branches have same head');
|
|
123
|
+
throw l.hash = {
|
|
124
|
+
text: `merge ${r}`,
|
|
125
|
+
token: `merge ${r}`,
|
|
126
|
+
expected: ["branch abc"]
|
|
127
|
+
}, l;
|
|
128
|
+
}
|
|
129
|
+
if (a && i.records.commits.has(a)) {
|
|
130
|
+
const l = new Error(
|
|
131
|
+
'Incorrect usage of "merge". Commit with id:' + a + " already exists, use different custom id"
|
|
132
|
+
);
|
|
133
|
+
throw l.hash = {
|
|
134
|
+
text: `merge ${r} ${a} ${n} ${e == null ? void 0 : e.join(" ")}`,
|
|
135
|
+
token: `merge ${r} ${a} ${n} ${e == null ? void 0 : e.join(" ")}`,
|
|
136
|
+
expected: [
|
|
137
|
+
`merge ${r} ${a}_UNIQUE ${n} ${e == null ? void 0 : e.join(" ")}`
|
|
138
|
+
]
|
|
139
|
+
}, l;
|
|
140
|
+
}
|
|
141
|
+
const f = c || "", y = {
|
|
142
|
+
id: a || `${i.records.seq}-${z()}`,
|
|
143
|
+
message: `merged branch ${r} 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: p.MERGE,
|
|
148
|
+
customType: n,
|
|
149
|
+
customId: !!a,
|
|
150
|
+
tags: e ?? []
|
|
151
|
+
};
|
|
152
|
+
i.records.head = y, i.records.commits.set(y.id, y), i.records.branches.set(i.records.currBranch, y.id), m.debug(i.records.branches), m.debug("in mergeBranch");
|
|
153
|
+
}, "merge"), br = /* @__PURE__ */ $(function(t) {
|
|
154
|
+
let r = t.id, a = t.targetId, n = t.tags, e = t.parent;
|
|
155
|
+
m.debug("Entering cherryPick:", r, a, n);
|
|
156
|
+
const s = q();
|
|
157
|
+
if (r = E.sanitizeText(r, s), a = E.sanitizeText(a, s), n = n == null ? void 0 : n.map((d) => E.sanitizeText(d, s)), e = E.sanitizeText(e, s), !r || !i.records.commits.has(r)) {
|
|
158
|
+
const d = new Error(
|
|
159
|
+
'Incorrect usage of "cherryPick". Source commit id should exist and provided'
|
|
160
|
+
);
|
|
161
|
+
throw d.hash = {
|
|
162
|
+
text: `cherryPick ${r} ${a}`,
|
|
163
|
+
token: `cherryPick ${r} ${a}`,
|
|
164
|
+
expected: ["cherry-pick abc"]
|
|
165
|
+
}, d;
|
|
166
|
+
}
|
|
167
|
+
const o = i.records.commits.get(r);
|
|
168
|
+
if (o === void 0 || !o)
|
|
169
|
+
throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
|
|
170
|
+
if (e && !(Array.isArray(o.parents) && o.parents.includes(e)))
|
|
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 === p.MERGE && !e)
|
|
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 y = new Error(
|
|
182
|
+
'Incorrect usage of "cherryPick". Source commit is already on current branch'
|
|
183
|
+
);
|
|
184
|
+
throw y.hash = {
|
|
185
|
+
text: `cherryPick ${r} ${a}`,
|
|
186
|
+
token: `cherryPick ${r} ${a}`,
|
|
187
|
+
expected: ["cherry-pick abc"]
|
|
188
|
+
}, y;
|
|
189
|
+
}
|
|
190
|
+
const d = i.records.branches.get(i.records.currBranch);
|
|
191
|
+
if (d === void 0 || !d) {
|
|
192
|
+
const y = new Error(
|
|
193
|
+
`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`
|
|
194
|
+
);
|
|
195
|
+
throw y.hash = {
|
|
196
|
+
text: `cherryPick ${r} ${a}`,
|
|
197
|
+
token: `cherryPick ${r} ${a}`,
|
|
198
|
+
expected: ["cherry-pick abc"]
|
|
199
|
+
}, y;
|
|
200
|
+
}
|
|
201
|
+
const h = i.records.commits.get(d);
|
|
202
|
+
if (h === void 0 || !h) {
|
|
203
|
+
const y = new Error(
|
|
204
|
+
`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`
|
|
205
|
+
);
|
|
206
|
+
throw y.hash = {
|
|
207
|
+
text: `cherryPick ${r} ${a}`,
|
|
208
|
+
token: `cherryPick ${r} ${a}`,
|
|
209
|
+
expected: ["cherry-pick abc"]
|
|
210
|
+
}, y;
|
|
211
|
+
}
|
|
212
|
+
const f = {
|
|
213
|
+
id: i.records.seq + "-" + z(),
|
|
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: p.CHERRY_PICK,
|
|
219
|
+
tags: n ? n.filter(Boolean) : [
|
|
220
|
+
`cherry-pick:${o.id}${o.type === p.MERGE ? `|parent:${e}` : ""}`
|
|
221
|
+
]
|
|
222
|
+
};
|
|
223
|
+
i.records.head = f, i.records.commits.set(f.id, f), i.records.branches.set(i.records.currBranch, f.id), m.debug(i.records.branches), m.debug("in cherryPick");
|
|
224
|
+
}
|
|
225
|
+
}, "cherryPick"), S = /* @__PURE__ */ $(function(t) {
|
|
226
|
+
if (t = E.sanitizeText(t, q()), i.records.branches.has(t)) {
|
|
227
|
+
i.records.currBranch = t;
|
|
228
|
+
const r = i.records.branches.get(i.records.currBranch);
|
|
229
|
+
r === void 0 || !r ? i.records.head = null : i.records.head = i.records.commits.get(r) ?? null;
|
|
230
|
+
} else {
|
|
231
|
+
const r = new Error(
|
|
232
|
+
`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`
|
|
233
|
+
);
|
|
234
|
+
throw r.hash = {
|
|
235
|
+
text: `checkout ${t}`,
|
|
236
|
+
token: `checkout ${t}`,
|
|
237
|
+
expected: [`branch ${t}`]
|
|
238
|
+
}, r;
|
|
239
|
+
}
|
|
240
|
+
}, "checkout");
|
|
241
|
+
function D(t, r, a) {
|
|
242
|
+
const n = t.indexOf(r);
|
|
243
|
+
n === -1 ? t.push(a) : t.splice(n, 1, a);
|
|
244
|
+
}
|
|
245
|
+
$(D, "upsert");
|
|
246
|
+
function F(t) {
|
|
247
|
+
const r = t.reduce((e, s) => e.seq > s.seq ? e : s, t[0]);
|
|
248
|
+
let a = "";
|
|
249
|
+
t.forEach(function(e) {
|
|
250
|
+
e === r ? a += " *" : a += " |";
|
|
251
|
+
});
|
|
252
|
+
const n = [a, r.id, r.seq];
|
|
253
|
+
for (const e in i.records.branches)
|
|
254
|
+
i.records.branches.get(e) === r.id && n.push(e);
|
|
255
|
+
if (m.debug(n.join(" ")), r.parents && r.parents.length == 2 && r.parents[0] && r.parents[1]) {
|
|
256
|
+
const e = i.records.commits.get(r.parents[0]);
|
|
257
|
+
D(t, r, e), r.parents[1] && t.push(i.records.commits.get(r.parents[1]));
|
|
258
|
+
} else {
|
|
259
|
+
if (r.parents.length == 0)
|
|
260
|
+
return;
|
|
261
|
+
if (r.parents[0]) {
|
|
262
|
+
const e = i.records.commits.get(r.parents[0]);
|
|
263
|
+
D(t, r, e);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
t = W(t, (e) => e.id), F(t);
|
|
267
|
+
}
|
|
268
|
+
$(F, "prettyPrintCommitHistory");
|
|
269
|
+
var mr = /* @__PURE__ */ $(function() {
|
|
270
|
+
m.debug(i.records.commits);
|
|
271
|
+
const t = j()[0];
|
|
272
|
+
F([t]);
|
|
273
|
+
}, "prettyPrint"), wr = /* @__PURE__ */ $(function() {
|
|
274
|
+
i.reset(), or();
|
|
275
|
+
}, "clear"), vr = /* @__PURE__ */ $(function() {
|
|
276
|
+
return [...i.records.branchConfig.values()].map((r, a) => r.order !== null && r.order !== void 0 ? r : {
|
|
277
|
+
...r,
|
|
278
|
+
order: parseFloat(`0.${a}`)
|
|
279
|
+
}).sort((r, a) => (r.order ?? 0) - (a.order ?? 0)).map(({ name: r }) => ({ name: r }));
|
|
280
|
+
}, "getBranchesAsObjArray"), Cr = /* @__PURE__ */ $(function() {
|
|
281
|
+
return i.records.branches;
|
|
282
|
+
}, "getBranches"), Er = /* @__PURE__ */ $(function() {
|
|
283
|
+
return i.records.commits;
|
|
284
|
+
}, "getCommits"), j = /* @__PURE__ */ $(function() {
|
|
285
|
+
const t = [...i.records.commits.values()];
|
|
286
|
+
return t.forEach(function(r) {
|
|
287
|
+
m.debug(r.id);
|
|
288
|
+
}), t.sort((r, a) => r.seq - a.seq), t;
|
|
289
|
+
}, "getCommitsArray"), Br = /* @__PURE__ */ $(function() {
|
|
290
|
+
return i.records.currBranch;
|
|
291
|
+
}, "getCurrentBranch"), Tr = /* @__PURE__ */ $(function() {
|
|
292
|
+
return i.records.direction;
|
|
293
|
+
}, "getDirection"), Lr = /* @__PURE__ */ $(function() {
|
|
294
|
+
return i.records.head;
|
|
295
|
+
}, "getHead"), Y = {
|
|
296
|
+
commitType: p,
|
|
297
|
+
getConfig: q,
|
|
298
|
+
setDirection: fr,
|
|
299
|
+
setOptions: yr,
|
|
300
|
+
getOptions: gr,
|
|
301
|
+
commit: xr,
|
|
302
|
+
branch: ur,
|
|
303
|
+
merge: pr,
|
|
304
|
+
cherryPick: br,
|
|
305
|
+
checkout: S,
|
|
306
|
+
//reset,
|
|
307
|
+
prettyPrint: mr,
|
|
308
|
+
clear: wr,
|
|
309
|
+
getBranchesAsObjArray: vr,
|
|
310
|
+
getBranches: Cr,
|
|
311
|
+
getCommits: Er,
|
|
312
|
+
getCommitsArray: j,
|
|
313
|
+
getCurrentBranch: Br,
|
|
314
|
+
getDirection: Tr,
|
|
315
|
+
getHead: Lr,
|
|
316
|
+
setAccTitle: tr,
|
|
317
|
+
getAccTitle: er,
|
|
318
|
+
getAccDescription: rr,
|
|
319
|
+
setAccDescription: Z,
|
|
320
|
+
setDiagramTitle: Q,
|
|
321
|
+
getDiagramTitle: J
|
|
322
|
+
}, kr = /* @__PURE__ */ $((t, r) => {
|
|
323
|
+
V(t, r), t.dir && r.setDirection(t.dir);
|
|
324
|
+
for (const a of t.statements)
|
|
325
|
+
Mr(a, r);
|
|
326
|
+
}, "populate"), Mr = /* @__PURE__ */ $((t, r) => {
|
|
327
|
+
const n = {
|
|
328
|
+
Commit: /* @__PURE__ */ $((e) => r.commit(Ir(e)), "Commit"),
|
|
329
|
+
Branch: /* @__PURE__ */ $((e) => r.branch(Rr(e)), "Branch"),
|
|
330
|
+
Merge: /* @__PURE__ */ $((e) => r.merge(Gr(e)), "Merge"),
|
|
331
|
+
Checkout: /* @__PURE__ */ $((e) => r.checkout(Or(e)), "Checkout"),
|
|
332
|
+
CherryPicking: /* @__PURE__ */ $((e) => r.cherryPick(qr(e)), "CherryPicking")
|
|
333
|
+
}[t.$type];
|
|
334
|
+
n ? n(t) : m.error(`Unknown statement type: ${t.$type}`);
|
|
335
|
+
}, "parseStatement"), Ir = /* @__PURE__ */ $((t) => ({
|
|
336
|
+
id: t.id,
|
|
337
|
+
msg: t.message ?? "",
|
|
338
|
+
type: t.type !== void 0 ? p[t.type] : p.NORMAL,
|
|
339
|
+
tags: t.tags ?? void 0
|
|
340
|
+
}), "parseCommit"), Rr = /* @__PURE__ */ $((t) => ({
|
|
341
|
+
name: t.name,
|
|
342
|
+
order: t.order ?? 0
|
|
343
|
+
}), "parseBranch"), Gr = /* @__PURE__ */ $((t) => ({
|
|
344
|
+
branch: t.branch,
|
|
345
|
+
id: t.id ?? "",
|
|
346
|
+
type: t.type !== void 0 ? p[t.type] : void 0,
|
|
347
|
+
tags: t.tags ?? void 0
|
|
348
|
+
}), "parseMerge"), Or = /* @__PURE__ */ $((t) => t.branch, "parseCheckout"), qr = /* @__PURE__ */ $((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"), Ar = {
|
|
357
|
+
parse: /* @__PURE__ */ $(async (t) => {
|
|
358
|
+
const r = await lr("gitGraph", t);
|
|
359
|
+
m.debug(r), kr(r, Y);
|
|
360
|
+
}, "parse")
|
|
361
|
+
}, I = 10, R = 40, B = 4, L = 2, O = 8, v = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), P = 30, A = /* @__PURE__ */ new Map(), _ = [], M = 0, x = "LR", Hr = /* @__PURE__ */ $(() => {
|
|
362
|
+
v.clear(), C.clear(), A.clear(), M = 0, _ = [], x = "LR";
|
|
363
|
+
}, "clear"), K = /* @__PURE__ */ $((t) => {
|
|
364
|
+
const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
365
|
+
return (typeof t == "string" ? t.split(/\\n|\n|<br\s*\/?>/gi) : t).forEach((n) => {
|
|
366
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
367
|
+
e.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), e.setAttribute("dy", "1em"), e.setAttribute("x", "0"), e.setAttribute("class", "row"), e.textContent = n.trim(), r.appendChild(e);
|
|
368
|
+
}), r;
|
|
369
|
+
}, "drawText"), U = /* @__PURE__ */ $((t) => {
|
|
370
|
+
let r, a, n;
|
|
371
|
+
return x === "BT" ? (a = /* @__PURE__ */ $((e, s) => e <= s, "comparisonFunc"), n = 1 / 0) : (a = /* @__PURE__ */ $((e, s) => e >= s, "comparisonFunc"), n = 0), t.forEach((e) => {
|
|
372
|
+
var o, c;
|
|
373
|
+
const s = x === "TB" || x == "BT" ? (o = C.get(e)) == null ? void 0 : o.y : (c = C.get(e)) == null ? void 0 : c.x;
|
|
374
|
+
s !== void 0 && a(s, n) && (r = e, n = s);
|
|
375
|
+
}), r;
|
|
376
|
+
}, "findClosestParent"), Pr = /* @__PURE__ */ $((t) => {
|
|
377
|
+
let r = "", a = 1 / 0;
|
|
378
|
+
return t.forEach((n) => {
|
|
379
|
+
const e = C.get(n).y;
|
|
380
|
+
e <= a && (r = n, a = e);
|
|
381
|
+
}), r || void 0;
|
|
382
|
+
}, "findClosestParentBT"), _r = /* @__PURE__ */ $((t, r, a) => {
|
|
383
|
+
let n = a, e = a;
|
|
384
|
+
const s = [];
|
|
385
|
+
t.forEach((o) => {
|
|
386
|
+
const c = r.get(o);
|
|
387
|
+
if (!c)
|
|
388
|
+
throw new Error(`Commit not found for key ${o}`);
|
|
389
|
+
c.parents.length ? (n = Dr(c), e = Math.max(n, e)) : s.push(c), Fr(c, n);
|
|
390
|
+
}), n = e, s.forEach((o) => {
|
|
391
|
+
Nr(o, n, a);
|
|
392
|
+
}), t.forEach((o) => {
|
|
393
|
+
const c = r.get(o);
|
|
394
|
+
if (c != null && c.parents.length) {
|
|
395
|
+
const d = Pr(c.parents);
|
|
396
|
+
n = C.get(d).y - R, n <= e && (e = n);
|
|
397
|
+
const h = v.get(c.branch).pos, f = n - I;
|
|
398
|
+
C.set(c.id, { x: h, y: f });
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}, "setParallelBTPos"), zr = /* @__PURE__ */ $((t) => {
|
|
402
|
+
var n;
|
|
403
|
+
const r = U(t.parents.filter((e) => e !== null));
|
|
404
|
+
if (!r)
|
|
405
|
+
throw new Error(`Closest parent not found for commit ${t.id}`);
|
|
406
|
+
const a = (n = C.get(r)) == null ? void 0 : n.y;
|
|
407
|
+
if (a === void 0)
|
|
408
|
+
throw new Error(`Closest parent position not found for commit ${t.id}`);
|
|
409
|
+
return a;
|
|
410
|
+
}, "findClosestParentPos"), Dr = /* @__PURE__ */ $((t) => zr(t) + R, "calculateCommitPosition"), Fr = /* @__PURE__ */ $((t, r) => {
|
|
411
|
+
const a = v.get(t.branch);
|
|
412
|
+
if (!a)
|
|
413
|
+
throw new Error(`Branch not found for commit ${t.id}`);
|
|
414
|
+
const n = a.pos, e = r + I;
|
|
415
|
+
return C.set(t.id, { x: n, y: e }), { x: n, y: e };
|
|
416
|
+
}, "setCommitPosition"), Nr = /* @__PURE__ */ $((t, r, a) => {
|
|
417
|
+
const n = v.get(t.branch);
|
|
418
|
+
if (!n)
|
|
419
|
+
throw new Error(`Branch not found for commit ${t.id}`);
|
|
420
|
+
const e = r + a, s = n.pos;
|
|
421
|
+
C.set(t.id, { x: s, y: e });
|
|
422
|
+
}, "setRootPosition"), Wr = /* @__PURE__ */ $((t, r, a, n, e, s) => {
|
|
423
|
+
if (s === p.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 ${r.id} commit-highlight${e % O} ${n}-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 ${r.id} commit${e % O} ${n}-inner`
|
|
430
|
+
);
|
|
431
|
+
else if (s === p.CHERRY_PICK)
|
|
432
|
+
t.append("circle").attr("cx", a.x).attr("cy", a.y).attr("r", 10).attr("class", `commit ${r.id} ${n}`), t.append("circle").attr("cx", a.x - 3).attr("cy", a.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${n}`), t.append("circle").attr("cx", a.x + 3).attr("cy", a.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${n}`), 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 ${r.id} ${n}`), 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 ${r.id} ${n}`);
|
|
433
|
+
else {
|
|
434
|
+
const o = t.append("circle");
|
|
435
|
+
if (o.attr("cx", a.x), o.attr("cy", a.y), o.attr("r", r.type === p.MERGE ? 9 : 10), o.attr("class", `commit ${r.id} commit${e % O}`), s === p.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 ${n} ${r.id} commit${e % O}`
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
s === p.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 ${n} ${r.id} commit${e % O}`);
|
|
446
|
+
}
|
|
447
|
+
}, "drawCommitBullet"), Sr = /* @__PURE__ */ $((t, r, a, n, e) => {
|
|
448
|
+
var s;
|
|
449
|
+
if (r.type !== p.CHERRY_PICK && (r.customId && r.type === p.MERGE || r.type !== p.MERGE) && e.showCommitLabel) {
|
|
450
|
+
const o = t.append("g"), c = o.insert("rect").attr("class", "commit-label-bkg"), d = o.append("text").attr("x", n).attr("y", a.y + 25).attr("class", "commit-label").text(r.id), h = (s = d.node()) == null ? void 0 : s.getBBox();
|
|
451
|
+
if (h && (c.attr("x", a.posWithOffset - h.width / 2 - L).attr("y", a.y + 13.5).attr("width", h.width + 2 * L).attr("height", h.height + 2 * L), x === "TB" || x === "BT" ? (c.attr("x", a.x - (h.width + 4 * B + 5)).attr("y", a.y - 12), d.attr("x", a.x - (h.width + 4 * B)).attr("y", a.y + h.height - 12)) : d.attr("x", a.posWithOffset - h.width / 2), e.rotateCommitLabel))
|
|
452
|
+
if (x === "TB" || x === "BT")
|
|
453
|
+
d.attr(
|
|
454
|
+
"transform",
|
|
455
|
+
"rotate(-45, " + a.x + ", " + a.y + ")"
|
|
456
|
+
), c.attr(
|
|
457
|
+
"transform",
|
|
458
|
+
"rotate(-45, " + a.x + ", " + a.y + ")"
|
|
459
|
+
);
|
|
460
|
+
else {
|
|
461
|
+
const f = -7.5 - (h.width + 10) / 25 * 9.5, y = 10 + h.width / 25 * 8.5;
|
|
462
|
+
o.attr(
|
|
463
|
+
"transform",
|
|
464
|
+
"translate(" + f + ", " + y + ") rotate(-45, " + n + ", " + a.y + ")"
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}, "drawCommitLabel"), jr = /* @__PURE__ */ $((t, r, a, n) => {
|
|
469
|
+
var e;
|
|
470
|
+
if (r.tags.length > 0) {
|
|
471
|
+
let s = 0, o = 0, c = 0;
|
|
472
|
+
const d = [];
|
|
473
|
+
for (const h of r.tags.reverse()) {
|
|
474
|
+
const f = t.insert("polygon"), y = t.append("circle"), l = t.append("text").attr("y", a.y - 16 - s).attr("class", "tag-label").text(h), g = (e = l.node()) == null ? void 0 : e.getBBox();
|
|
475
|
+
if (!g)
|
|
476
|
+
throw new Error("Tag bbox not found");
|
|
477
|
+
o = Math.max(o, g.width), c = Math.max(c, g.height), l.attr("x", a.posWithOffset - g.width / 2), d.push({
|
|
478
|
+
tag: l,
|
|
479
|
+
hole: y,
|
|
480
|
+
rect: f,
|
|
481
|
+
yOffset: s
|
|
482
|
+
}), s += 20;
|
|
483
|
+
}
|
|
484
|
+
for (const { tag: h, hole: f, rect: y, yOffset: l } of d) {
|
|
485
|
+
const g = c / 2, u = a.y - 19.2 - l;
|
|
486
|
+
if (y.attr("class", "tag-label-bkg").attr(
|
|
487
|
+
"points",
|
|
488
|
+
`
|
|
489
|
+
${n - o / 2 - B / 2},${u + L}
|
|
490
|
+
${n - o / 2 - B / 2},${u - L}
|
|
491
|
+
${a.posWithOffset - o / 2 - B},${u - g - L}
|
|
492
|
+
${a.posWithOffset + o / 2 + B},${u - g - L}
|
|
493
|
+
${a.posWithOffset + o / 2 + B},${u + g + L}
|
|
494
|
+
${a.posWithOffset - o / 2 - B},${u + g + L}`
|
|
495
|
+
), f.attr("cy", u).attr("cx", n - o / 2 + B / 2).attr("r", 1.5).attr("class", "tag-hole"), x === "TB" || x === "BT") {
|
|
496
|
+
const b = n + l;
|
|
497
|
+
y.attr("class", "tag-label-bkg").attr(
|
|
498
|
+
"points",
|
|
499
|
+
`
|
|
500
|
+
${a.x},${b + 2}
|
|
501
|
+
${a.x},${b - 2}
|
|
502
|
+
${a.x + I},${b - g - 2}
|
|
503
|
+
${a.x + I + o + 4},${b - g - 2}
|
|
504
|
+
${a.x + I + o + 4},${b + g + 2}
|
|
505
|
+
${a.x + I},${b + g + 2}`
|
|
506
|
+
).attr("transform", "translate(12,12) rotate(45, " + a.x + "," + n + ")"), f.attr("cx", a.x + B / 2).attr("cy", b).attr("transform", "translate(12,12) rotate(45, " + a.x + "," + n + ")"), h.attr("x", a.x + 5).attr("y", b + 3).attr("transform", "translate(14,14) rotate(45, " + a.x + "," + n + ")");
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}, "drawCommitTags"), Yr = /* @__PURE__ */ $((t) => {
|
|
511
|
+
switch (t.customType ?? t.type) {
|
|
512
|
+
case p.NORMAL:
|
|
513
|
+
return "commit-normal";
|
|
514
|
+
case p.REVERSE:
|
|
515
|
+
return "commit-reverse";
|
|
516
|
+
case p.HIGHLIGHT:
|
|
517
|
+
return "commit-highlight";
|
|
518
|
+
case p.MERGE:
|
|
519
|
+
return "commit-merge";
|
|
520
|
+
case p.CHERRY_PICK:
|
|
521
|
+
return "commit-cherry-pick";
|
|
522
|
+
default:
|
|
523
|
+
return "commit-normal";
|
|
524
|
+
}
|
|
525
|
+
}, "getCommitClassType"), Kr = /* @__PURE__ */ $((t, r, a, n) => {
|
|
526
|
+
const e = { x: 0, y: 0 };
|
|
527
|
+
if (t.parents.length > 0) {
|
|
528
|
+
const s = U(t.parents);
|
|
529
|
+
if (s) {
|
|
530
|
+
const o = n.get(s) ?? e;
|
|
531
|
+
return r === "TB" ? o.y + R : r === "BT" ? (n.get(t.id) ?? e).y - R : o.x + R;
|
|
532
|
+
}
|
|
533
|
+
} else
|
|
534
|
+
return r === "TB" ? P : r === "BT" ? (n.get(t.id) ?? e).y - R : 0;
|
|
535
|
+
return 0;
|
|
536
|
+
}, "calculatePosition"), Ur = /* @__PURE__ */ $((t, r, a) => {
|
|
537
|
+
var o, c;
|
|
538
|
+
const n = x === "BT" && a ? r : r + I, e = x === "TB" || x === "BT" ? n : (o = v.get(t.branch)) == null ? void 0 : o.pos, s = x === "TB" || x === "BT" ? (c = v.get(t.branch)) == null ? void 0 : c.pos : n;
|
|
539
|
+
if (s === void 0 || e === void 0)
|
|
540
|
+
throw new Error(`Position were undefined for commit ${t.id}`);
|
|
541
|
+
return { x: s, y: e, posWithOffset: n };
|
|
542
|
+
}, "getCommitPosition"), N = /* @__PURE__ */ $((t, r, a, n) => {
|
|
543
|
+
const e = t.append("g").attr("class", "commit-bullets"), s = t.append("g").attr("class", "commit-labels");
|
|
544
|
+
let o = x === "TB" || x === "BT" ? P : 0;
|
|
545
|
+
const c = [...r.keys()], d = n.parallelCommits ?? !1, h = /* @__PURE__ */ $((y, l) => {
|
|
546
|
+
var b, T;
|
|
547
|
+
const g = (b = r.get(y)) == null ? void 0 : b.seq, u = (T = r.get(l)) == null ? void 0 : T.seq;
|
|
548
|
+
return g !== void 0 && u !== void 0 ? g - u : 0;
|
|
549
|
+
}, "sortKeys");
|
|
550
|
+
let f = c.sort(h);
|
|
551
|
+
x === "BT" && (d && _r(f, r, o), f = f.reverse()), f.forEach((y) => {
|
|
552
|
+
var u;
|
|
553
|
+
const l = r.get(y);
|
|
554
|
+
if (!l)
|
|
555
|
+
throw new Error(`Commit not found for key ${y}`);
|
|
556
|
+
d && (o = Kr(l, x, o, C));
|
|
557
|
+
const g = Ur(l, o, d);
|
|
558
|
+
if (a) {
|
|
559
|
+
const b = Yr(l), T = l.customType ?? l.type, G = ((u = v.get(l.branch)) == null ? void 0 : u.index) ?? 0;
|
|
560
|
+
Wr(e, l, g, b, G, T), Sr(s, l, g, o, n), jr(s, l, g, o);
|
|
561
|
+
}
|
|
562
|
+
x === "TB" || x === "BT" ? C.set(l.id, { x: g.x, y: g.posWithOffset }) : C.set(l.id, { x: g.posWithOffset, y: g.y }), o = x === "BT" && d ? o + R : o + R + I, o > M && (M = o);
|
|
563
|
+
});
|
|
564
|
+
}, "drawCommits"), Vr = /* @__PURE__ */ $((t, r, a, n, e) => {
|
|
565
|
+
const o = (x === "TB" || x === "BT" ? a.x < n.x : a.y < n.y) ? r.branch : t.branch, c = /* @__PURE__ */ $((h) => h.branch === o, "isOnBranchToGetCurve"), d = /* @__PURE__ */ $((h) => h.seq > t.seq && h.seq < r.seq, "isBetweenCommits");
|
|
566
|
+
return [...e.values()].some((h) => d(h) && c(h));
|
|
567
|
+
}, "shouldRerouteArrow"), H = /* @__PURE__ */ $((t, r, a = 0) => {
|
|
568
|
+
const n = t + Math.abs(t - r) / 2;
|
|
569
|
+
if (a > 5)
|
|
570
|
+
return n;
|
|
571
|
+
if (_.every((o) => Math.abs(o - n) >= 10))
|
|
572
|
+
return _.push(n), n;
|
|
573
|
+
const s = Math.abs(t - r);
|
|
574
|
+
return H(t, r - s / 5, a + 1);
|
|
575
|
+
}, "findLane"), Xr = /* @__PURE__ */ $((t, r, a, n) => {
|
|
576
|
+
var g, u, b, T, G;
|
|
577
|
+
const e = C.get(r.id), s = C.get(a.id);
|
|
578
|
+
if (e === void 0 || s === void 0)
|
|
579
|
+
throw new Error(`Commit positions not found for commits ${r.id} and ${a.id}`);
|
|
580
|
+
const o = Vr(r, a, e, s, n);
|
|
581
|
+
let c = "", d = "", h = 0, f = 0, y = (g = v.get(a.branch)) == null ? void 0 : g.index;
|
|
582
|
+
a.type === p.MERGE && r.id !== a.parents[0] && (y = (u = v.get(r.branch)) == null ? void 0 : u.index);
|
|
583
|
+
let l;
|
|
584
|
+
if (o) {
|
|
585
|
+
c = "A 10 10, 0, 0, 0,", d = "A 10 10, 0, 0, 1,", h = 10, f = 10;
|
|
586
|
+
const k = e.y < s.y ? H(e.y, s.y) : H(s.y, e.y), w = e.x < s.x ? H(e.x, s.x) : H(s.x, e.x);
|
|
587
|
+
x === "TB" ? e.x < s.x ? l = `M ${e.x} ${e.y} L ${w - h} ${e.y} ${d} ${w} ${e.y + f} L ${w} ${s.y - h} ${c} ${w + f} ${s.y} L ${s.x} ${s.y}` : (y = (b = v.get(r.branch)) == null ? void 0 : b.index, l = `M ${e.x} ${e.y} L ${w + h} ${e.y} ${c} ${w} ${e.y + f} L ${w} ${s.y - h} ${d} ${w - f} ${s.y} L ${s.x} ${s.y}`) : x === "BT" ? e.x < s.x ? l = `M ${e.x} ${e.y} L ${w - h} ${e.y} ${c} ${w} ${e.y - f} L ${w} ${s.y + h} ${d} ${w + f} ${s.y} L ${s.x} ${s.y}` : (y = (T = v.get(r.branch)) == null ? void 0 : T.index, l = `M ${e.x} ${e.y} L ${w + h} ${e.y} ${d} ${w} ${e.y - f} L ${w} ${s.y + h} ${c} ${w - f} ${s.y} L ${s.x} ${s.y}`) : e.y < s.y ? l = `M ${e.x} ${e.y} L ${e.x} ${k - h} ${c} ${e.x + f} ${k} L ${s.x - h} ${k} ${d} ${s.x} ${k + f} L ${s.x} ${s.y}` : (y = (G = v.get(r.branch)) == null ? void 0 : G.index, l = `M ${e.x} ${e.y} L ${e.x} ${k + h} ${d} ${e.x + f} ${k} L ${s.x - h} ${k} ${c} ${s.x} ${k - f} L ${s.x} ${s.y}`);
|
|
588
|
+
} else
|
|
589
|
+
c = "A 20 20, 0, 0, 0,", d = "A 20 20, 0, 0, 1,", h = 20, f = 20, x === "TB" ? (e.x < s.x && (a.type === p.MERGE && r.id !== a.parents[0] ? l = `M ${e.x} ${e.y} L ${e.x} ${s.y - h} ${c} ${e.x + f} ${s.y} L ${s.x} ${s.y}` : l = `M ${e.x} ${e.y} L ${s.x - h} ${e.y} ${d} ${s.x} ${e.y + f} L ${s.x} ${s.y}`), e.x > s.x && (c = "A 20 20, 0, 0, 0,", d = "A 20 20, 0, 0, 1,", h = 20, f = 20, a.type === p.MERGE && r.id !== a.parents[0] ? l = `M ${e.x} ${e.y} L ${e.x} ${s.y - h} ${d} ${e.x - f} ${s.y} L ${s.x} ${s.y}` : l = `M ${e.x} ${e.y} L ${s.x + h} ${e.y} ${c} ${s.x} ${e.y + f} L ${s.x} ${s.y}`), e.x === s.x && (l = `M ${e.x} ${e.y} L ${s.x} ${s.y}`)) : x === "BT" ? (e.x < s.x && (a.type === p.MERGE && r.id !== a.parents[0] ? l = `M ${e.x} ${e.y} L ${e.x} ${s.y + h} ${d} ${e.x + f} ${s.y} L ${s.x} ${s.y}` : l = `M ${e.x} ${e.y} L ${s.x - h} ${e.y} ${c} ${s.x} ${e.y - f} L ${s.x} ${s.y}`), e.x > s.x && (c = "A 20 20, 0, 0, 0,", d = "A 20 20, 0, 0, 1,", h = 20, f = 20, a.type === p.MERGE && r.id !== a.parents[0] ? l = `M ${e.x} ${e.y} L ${e.x} ${s.y + h} ${c} ${e.x - f} ${s.y} L ${s.x} ${s.y}` : l = `M ${e.x} ${e.y} L ${s.x + h} ${e.y} ${d} ${s.x} ${e.y - f} L ${s.x} ${s.y}`), e.x === s.x && (l = `M ${e.x} ${e.y} L ${s.x} ${s.y}`)) : (e.y < s.y && (a.type === p.MERGE && r.id !== a.parents[0] ? l = `M ${e.x} ${e.y} L ${s.x - h} ${e.y} ${d} ${s.x} ${e.y + f} L ${s.x} ${s.y}` : l = `M ${e.x} ${e.y} L ${e.x} ${s.y - h} ${c} ${e.x + f} ${s.y} L ${s.x} ${s.y}`), e.y > s.y && (a.type === p.MERGE && r.id !== a.parents[0] ? l = `M ${e.x} ${e.y} L ${s.x - h} ${e.y} ${c} ${s.x} ${e.y - f} L ${s.x} ${s.y}` : l = `M ${e.x} ${e.y} L ${e.x} ${s.y + h} ${d} ${e.x + f} ${s.y} L ${s.x} ${s.y}`), e.y === s.y && (l = `M ${e.x} ${e.y} L ${s.x} ${s.y}`));
|
|
590
|
+
if (l === void 0)
|
|
591
|
+
throw new Error("Line definition not found");
|
|
592
|
+
t.append("path").attr("d", l).attr("class", "arrow arrow" + y % O);
|
|
593
|
+
}, "drawArrow"), Jr = /* @__PURE__ */ $((t, r) => {
|
|
594
|
+
const a = t.append("g").attr("class", "commit-arrows");
|
|
595
|
+
[...r.keys()].forEach((n) => {
|
|
596
|
+
const e = r.get(n);
|
|
597
|
+
e.parents && e.parents.length > 0 && e.parents.forEach((s) => {
|
|
598
|
+
Xr(a, r.get(s), e, r);
|
|
599
|
+
});
|
|
600
|
+
});
|
|
601
|
+
}, "drawArrows"), Qr = /* @__PURE__ */ $((t, r, a) => {
|
|
602
|
+
const n = t.append("g");
|
|
603
|
+
r.forEach((e, s) => {
|
|
604
|
+
var b;
|
|
605
|
+
const o = s % O, c = (b = v.get(e.name)) == null ? void 0 : b.pos;
|
|
606
|
+
if (c === void 0)
|
|
607
|
+
throw new Error(`Position not found for branch ${e.name}`);
|
|
608
|
+
const d = n.append("line");
|
|
609
|
+
d.attr("x1", 0), d.attr("y1", c), d.attr("x2", M), d.attr("y2", c), d.attr("class", "branch branch" + o), x === "TB" ? (d.attr("y1", P), d.attr("x1", c), d.attr("y2", M), d.attr("x2", c)) : x === "BT" && (d.attr("y1", M), d.attr("x1", c), d.attr("y2", P), d.attr("x2", c)), _.push(c);
|
|
610
|
+
const h = e.name, f = K(h), y = n.insert("rect"), g = n.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + o);
|
|
611
|
+
g.node().appendChild(f);
|
|
612
|
+
const u = f.getBBox();
|
|
613
|
+
y.attr("class", "branchLabelBkg label" + o).attr("rx", 4).attr("ry", 4).attr("x", -u.width - 4 - (a.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -u.height / 2 + 8).attr("width", u.width + 18).attr("height", u.height + 4), g.attr(
|
|
614
|
+
"transform",
|
|
615
|
+
"translate(" + (-u.width - 14 - (a.rotateCommitLabel === !0 ? 30 : 0)) + ", " + (c - u.height / 2 - 1) + ")"
|
|
616
|
+
), x === "TB" ? (y.attr("x", c - u.width / 2 - 10).attr("y", 0), g.attr("transform", "translate(" + (c - u.width / 2 - 5) + ", 0)")) : x === "BT" ? (y.attr("x", c - u.width / 2 - 10).attr("y", M), g.attr("transform", "translate(" + (c - u.width / 2 - 5) + ", " + M + ")")) : y.attr("transform", "translate(-19, " + (c - u.height / 2) + ")");
|
|
617
|
+
});
|
|
618
|
+
}, "drawBranches"), Zr = /* @__PURE__ */ $(function(t, r, a, n, e) {
|
|
619
|
+
return v.set(t, { pos: r, index: a }), r += 50 + (e ? 40 : 0) + (x === "TB" || x === "BT" ? n.width / 2 : 0), r;
|
|
620
|
+
}, "setBranchPosition"), re = /* @__PURE__ */ $(function(t, r, a, n) {
|
|
621
|
+
Hr(), m.debug("in gitgraph renderer", t + `
|
|
622
|
+
`, "id:", r, a);
|
|
623
|
+
const e = n.db;
|
|
624
|
+
if (!e.getConfig) {
|
|
625
|
+
m.error("getConfig method is not available on db");
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
const s = e.getConfig(), o = s.rotateCommitLabel ?? !1;
|
|
629
|
+
A = e.getCommits();
|
|
630
|
+
const c = e.getBranchesAsObjArray();
|
|
631
|
+
x = e.getDirection();
|
|
632
|
+
const d = ar(`[id="${r}"]`);
|
|
633
|
+
let h = 0;
|
|
634
|
+
c.forEach((f, y) => {
|
|
635
|
+
var G;
|
|
636
|
+
const l = K(f.name), g = d.append("g"), u = g.insert("g").attr("class", "branchLabel"), b = u.insert("g").attr("class", "label branch-label");
|
|
637
|
+
(G = b.node()) == null || G.appendChild(l);
|
|
638
|
+
const T = l.getBBox();
|
|
639
|
+
h = Zr(f.name, h, y, T, o), b.remove(), u.remove(), g.remove();
|
|
640
|
+
}), N(d, A, !1, s), s.showBranches && Qr(d, c, s), Jr(d, A), N(d, A, !0, s), sr.insertTitle(
|
|
641
|
+
d,
|
|
642
|
+
"gitTitleText",
|
|
643
|
+
s.titleTopMargin ?? 0,
|
|
644
|
+
e.getDiagramTitle()
|
|
645
|
+
), nr(void 0, d, s.diagramPadding, s.useMaxWidth);
|
|
646
|
+
}, "draw"), ee = {
|
|
647
|
+
draw: re
|
|
648
|
+
}, te = /* @__PURE__ */ $((t) => `
|
|
649
|
+
.commit-id,
|
|
650
|
+
.commit-msg,
|
|
651
|
+
.branch-label {
|
|
652
|
+
fill: lightgrey;
|
|
653
|
+
color: lightgrey;
|
|
654
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
655
|
+
font-family: var(--mermaid-font-family);
|
|
656
|
+
}
|
|
657
|
+
${[0, 1, 2, 3, 4, 5, 6, 7].map(
|
|
658
|
+
(r) => `
|
|
659
|
+
.branch-label${r} { fill: ${t["gitBranchLabel" + r]}; }
|
|
660
|
+
.commit${r} { stroke: ${t["git" + r]}; fill: ${t["git" + r]}; }
|
|
661
|
+
.commit-highlight${r} { stroke: ${t["gitInv" + r]}; fill: ${t["gitInv" + r]}; }
|
|
662
|
+
.label${r} { fill: ${t["git" + r]}; }
|
|
663
|
+
.arrow${r} { stroke: ${t["git" + r]}; }
|
|
664
|
+
`
|
|
665
|
+
).join(`
|
|
666
|
+
`)}
|
|
667
|
+
|
|
668
|
+
.branch {
|
|
669
|
+
stroke-width: 1;
|
|
670
|
+
stroke: ${t.lineColor};
|
|
671
|
+
stroke-dasharray: 2;
|
|
672
|
+
}
|
|
673
|
+
.commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
|
|
674
|
+
.commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
|
|
675
|
+
.tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
|
|
676
|
+
.tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
|
|
677
|
+
.tag-hole { fill: ${t.textColor}; }
|
|
678
|
+
|
|
679
|
+
.commit-merge {
|
|
680
|
+
stroke: ${t.primaryColor};
|
|
681
|
+
fill: ${t.primaryColor};
|
|
682
|
+
}
|
|
683
|
+
.commit-reverse {
|
|
684
|
+
stroke: ${t.primaryColor};
|
|
685
|
+
fill: ${t.primaryColor};
|
|
686
|
+
stroke-width: 3;
|
|
687
|
+
}
|
|
688
|
+
.commit-highlight-outer {
|
|
689
|
+
}
|
|
690
|
+
.commit-highlight-inner {
|
|
691
|
+
stroke: ${t.primaryColor};
|
|
692
|
+
fill: ${t.primaryColor};
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
|
|
696
|
+
.gitTitleText {
|
|
697
|
+
text-anchor: middle;
|
|
698
|
+
font-size: 18px;
|
|
699
|
+
fill: ${t.textColor};
|
|
700
|
+
}
|
|
701
|
+
`, "getStyles"), ae = te, ie = {
|
|
702
|
+
parser: Ar,
|
|
703
|
+
db: Y,
|
|
704
|
+
renderer: ee,
|
|
705
|
+
styles: ae
|
|
706
|
+
};
|
|
707
|
+
export {
|
|
708
|
+
ie as diagram
|
|
709
|
+
};
|