react-docs-ui 0.6.17 → 0.6.19
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/{AIChatDialog-W60DtiEW.js → AIChatDialog-BnAX3dRn.js} +2 -2
- package/dist/{AISelectionTrigger-MaBGhxTE.js → AISelectionTrigger-SLyb8Vep.js} +2 -2
- package/dist/{AISettingsPanel-aiMnncnQ.js → AISettingsPanel-Bsd_wLP4.js} +3 -3
- package/dist/{DocsApp-BN6Bo0YD.js → DocsApp-CybQmyB8.js} +3669 -3285
- package/dist/{GlobalContextMenu-DG6x5Y5w.js → GlobalContextMenu-BtVjQk0v.js} +1 -1
- package/dist/{MdxContent-CMB8ZbXo.js → MdxContent-CH9GcMIg.js} +310 -306
- package/dist/{MdxContent.lazy-C4rcCv4v.js → MdxContent.lazy-D7XJ-ZHl.js} +1 -1
- package/dist/{SearchDialog-tUSKKsxW.js → SearchDialog-DWVre6R9.js} +66 -56
- package/dist/{SearchRuntime-5fXpxDsi.js → SearchRuntime-D0rSMKV3.js} +6 -5
- package/dist/_basePickBy-D8oNWNf8.js +166 -0
- package/dist/_baseUniq-DHuXxixa.js +682 -0
- package/dist/arc-j69r3jDe.js +80 -0
- package/dist/architecture-PBZL5I3N-DvHexcWL.js +3 -0
- package/dist/architectureDiagram-2XIMDMQ5-DmhcSwl7.js +4045 -0
- package/dist/array-DHiPsILf.js +6 -0
- package/dist/blockDiagram-WCTKOSBZ-B6A-w3LB.js +3025 -0
- package/dist/c4Diagram-IC4MRINW-AmEpu2Zd.js +2964 -0
- package/dist/channel-CqxMgZ5t.js +5 -0
- package/dist/chunk-4BX2VUAB-D3p73nhw.js +8 -0
- package/dist/chunk-55IACEB6-CLgZJbYv.js +8 -0
- package/dist/chunk-7E7YKBS2-CKRA8Egz.js +23 -0
- package/dist/chunk-7R4GIKGN-C19ZEV_b.js +2596 -0
- package/dist/chunk-C72U2L5F-B6IP-vol.js +23 -0
- package/dist/chunk-EGIJ26TM-Cw4ft_Ra.js +23 -0
- package/dist/chunk-FMBD7UC4-D-Ronn4l.js +5 -0
- package/dist/chunk-GEFDOKGD-8e2771NL.js +1121 -0
- package/dist/chunk-GLR3WWYH-ShSppUzV.js +41 -0
- package/dist/chunk-HHEYEP7N-CU-ZzGab.js +9 -0
- package/dist/chunk-JSJVCQXG-D49UMhzO.js +60 -0
- package/dist/chunk-KX2RTZJC-BDcxmH0D.js +25 -0
- package/dist/chunk-KYZI473N-B9L8Kk83.js +3434 -0
- package/dist/chunk-L3YUKLVL-CEVeJJT9.js +23 -0
- package/dist/chunk-MX3YWQON-CVZUx3EI.js +80 -0
- package/dist/chunk-NBPlniwU.js +23 -0
- package/dist/chunk-NQ4KR5QH-BWRGvKed.js +2002 -0
- package/dist/chunk-O4XLMI2P-BlC0d_Zr.js +511 -0
- package/dist/chunk-OZEHJAEY-BuORg3qI.js +64 -0
- package/dist/chunk-PQ6SQG4A-BggLWIDB.js +67 -0
- package/dist/chunk-PU5JKC2W-CeOPBYeP.js +1885 -0
- package/dist/chunk-QZHKN3VN-3LiJhn2O.js +15 -0
- package/dist/chunk-R5LLSJPH-B8KdhC9h.js +35 -0
- package/dist/chunk-WL4C6EOR-DLbU3P3W.js +3194 -0
- package/dist/chunk-XIRO2GV7-Bv7JEVD4.js +30 -0
- package/dist/chunk-XPW4576I-Bu03pPNP.js +1146 -0
- package/dist/chunk-XZSTWKYB-CpQJcKKv.js +15797 -0
- package/dist/chunk-YBOYWFTD-BAPGCoDq.js +32 -0
- package/dist/classDiagram-VBA2DB6C-D4y64v83.js +29 -0
- package/dist/classDiagram-v2-RAHNMMFH-DXkt0Wd4.js +29 -0
- package/dist/clone-B2fVtDap.js +8 -0
- package/dist/cose-bilkent-S5V4N54A-BX63fiTJ.js +2250 -0
- package/dist/cytoscape.esm-D1tmL96B.js +18100 -0
- package/dist/dagre-BM10A37c.js +1483 -0
- package/dist/dagre-KLK3FWXG-BkGeaeJf.js +294 -0
- package/dist/defaultLocale-CS9riXxY.js +201 -0
- package/dist/diagram-E7M64L7V-BCpOexcP.js +527 -0
- package/dist/diagram-IFDJBPK2-lSNeST-Z.js +213 -0
- package/dist/diagram-P4PSJMXO-Dd8HMHpS.js +133 -0
- package/dist/dist-DeXxBykG.js +50 -0
- package/dist/docs-app.es.js +1 -1
- package/dist/erDiagram-INFDFZHY-DjNq2UqZ.js +1666 -0
- package/dist/flowDiagram-PKNHOUZH-AUeVhXRc.js +4161 -0
- package/dist/ganttDiagram-A5KZAMGK-DZIM1zx8.js +3072 -0
- package/dist/gitGraph-HDMCJU4V-BiirFMfI.js +3 -0
- package/dist/gitGraphDiagram-K3NZZRJ6-CpR0vINe.js +625 -0
- package/dist/graphlib-DOjl69i0.js +225 -0
- package/dist/info-3K5VOQVL-CfGgZztt.js +3 -0
- package/dist/infoDiagram-LFFYTUFH-DAJ9foHI.js +19 -0
- package/dist/init-B4NvJPDj.js +15 -0
- package/dist/isArrayLikeObject-DLIYDRni.js +578 -0
- package/dist/isEmpty-DhbfzuZy.js +35 -0
- package/dist/ishikawaDiagram-PHBUUO56-B7xss2de.js +717 -0
- package/dist/journeyDiagram-4ABVD52K-BbX80Gcw.js +883 -0
- package/dist/kanban-definition-K7BYSVSG-BQ87hifQ.js +971 -0
- package/dist/line-DfLnhEwA.js +34 -0
- package/dist/linear-CWB56ned.js +289 -0
- package/dist/math-DHDNczAo.js +10 -0
- package/dist/{shiki-highlighter-BmQSSJpS.js → mdx-components-m1cGPhc8.js} +1437 -1338
- package/dist/mermaid-parser.core-l4wHnGuN.js +59 -0
- package/dist/mermaid.core-CtkJeRVj.js +919 -0
- package/dist/mindmap-definition-YRQLILUH-Cnl-qPDR.js +964 -0
- package/dist/ordinal-CD64W6lf.js +65 -0
- package/dist/packet-RMMSAZCW-DfA9M99B.js +3 -0
- package/dist/path-BjiRrKY7.js +85 -0
- package/dist/pie-UPGHQEXC-Bujrkgkt.js +3 -0
- package/dist/pieDiagram-SKSYHLDU-xow4mVuZ.js +165 -0
- package/dist/quadrantDiagram-337W2JSQ-CV2tMWXO.js +1974 -0
- package/dist/radar-KQ55EAFF-DEzDT04F.js +3 -0
- package/dist/react-docs-ui.css +1 -1
- package/dist/react-docs-ui.es.js +19 -19
- package/dist/requirementDiagram-Z7DCOOCP-Bx6NAgqy.js +2201 -0
- package/dist/rough.esm-BOvWpVpy.js +1352 -0
- package/dist/sankeyDiagram-WA2Y5GQK-CvTU-CXN.js +920 -0
- package/dist/sequenceDiagram-2WXFIKYE-1wYHvZEI.js +4109 -0
- package/dist/src-DI0MZP4m.js +2146 -0
- package/dist/stateDiagram-RAJIS63D-DFmbSHPX.js +217 -0
- package/dist/stateDiagram-v2-FVOUBMTO-TjYtTjLB.js +27 -0
- package/dist/timeline-definition-YZTLITO2-BAK411Yg.js +830 -0
- package/dist/treemap-KZPCXAKY-DThdSsPR.js +3 -0
- package/dist/types/components/AnnouncementBar.d.ts +12 -0
- package/dist/types/components/AnnouncementBar.d.ts.map +1 -0
- package/dist/types/components/DocsLayout.d.ts +10 -2
- package/dist/types/components/DocsLayout.d.ts.map +1 -1
- package/dist/types/components/HeaderNav.d.ts +17 -1
- package/dist/types/components/HeaderNav.d.ts.map +1 -1
- package/dist/types/components/MdxContent.d.ts.map +1 -1
- package/dist/types/components/MobileSidebar.d.ts +2 -1
- package/dist/types/components/MobileSidebar.d.ts.map +1 -1
- package/dist/types/components/PageFeedback.d.ts +11 -0
- package/dist/types/components/PageFeedback.d.ts.map +1 -0
- package/dist/types/components/PageMetaActions.d.ts +15 -0
- package/dist/types/components/PageMetaActions.d.ts.map +1 -0
- package/dist/types/components/PageNavigation.d.ts +2 -1
- package/dist/types/components/PageNavigation.d.ts.map +1 -1
- package/dist/types/components/SearchLauncher.d.ts +2 -1
- package/dist/types/components/SearchLauncher.d.ts.map +1 -1
- package/dist/types/components/SidebarNav.d.ts +2 -1
- package/dist/types/components/SidebarNav.d.ts.map +1 -1
- package/dist/types/components/mdx-components/Mermaid.d.ts +6 -0
- package/dist/types/components/mdx-components/Mermaid.d.ts.map +1 -0
- package/dist/types/components/mdx-components/Tabs.d.ts +13 -0
- package/dist/types/components/mdx-components/Tabs.d.ts.map +1 -0
- package/dist/types/components/mdx-components/index.d.ts +2 -0
- package/dist/types/components/mdx-components/index.d.ts.map +1 -1
- package/dist/types/components/search/SearchProvider.d.ts +2 -1
- package/dist/types/components/search/SearchProvider.d.ts.map +1 -1
- package/dist/types/components/search/SearchRuntime.d.ts +2 -1
- package/dist/types/components/search/SearchRuntime.d.ts.map +1 -1
- package/dist/types/lib/component-scanner.d.ts.map +1 -1
- package/dist/types/lib/config.d.ts +52 -0
- package/dist/types/lib/config.d.ts.map +1 -1
- package/dist/types/lib/navigation.d.ts +1 -1
- package/dist/types/lib/navigation.d.ts.map +1 -1
- package/dist/types/lib/page-meta.d.ts +16 -0
- package/dist/types/lib/page-meta.d.ts.map +1 -0
- package/dist/types/lib/search/build/index-generator.d.ts.map +1 -1
- package/dist/types/lib/search/build/types.d.ts +1 -0
- package/dist/types/lib/search/build/types.d.ts.map +1 -1
- package/dist/types/lib/search/runtime/search-engine.d.ts.map +1 -1
- package/dist/types/lib/search/runtime/types.d.ts +1 -0
- package/dist/types/lib/search/runtime/types.d.ts.map +1 -1
- package/dist/types/lib/versioning.d.ts +6 -0
- package/dist/types/lib/versioning.d.ts.map +1 -0
- package/dist/vennDiagram-LZ73GAT5-B7dft0U9.js +1858 -0
- package/dist/xychartDiagram-JWTSCODW-CXtfEnJM.js +2041 -0
- package/package.json +6 -2
- /package/dist/{AIProvider-C1_b1iKH.js → AIProvider-niZNPSGi.js} +0 -0
- /package/dist/{context-menu-CB7erSoV.js → context-menu-BIQsQup7.js} +0 -0
- /package/dist/{dialog-DQ6nkP0y.js → dialog-D8otbqQL.js} +0 -0
- /package/dist/{mdx-components-Dxpipc50.js → mdx-components-TEc3uhbY.js} +0 -0
- /package/dist/{use-toast-d9VPBjMn.js → use-toast-DK69oadB.js} +0 -0
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
import { h as e, p as t, r as n } from "./chunk-GEFDOKGD-8e2771NL.js";
|
|
2
|
+
import { g as r, h as i, p as a } from "./src-DI0MZP4m.js";
|
|
3
|
+
import { B as o, C as s, V as c, W as l, _ as u, a as d, d as f, q as ee, s as p, v as te, y as m } from "./chunk-7R4GIKGN-C19ZEV_b.js";
|
|
4
|
+
import { t as h } from "./chunk-4BX2VUAB-D3p73nhw.js";
|
|
5
|
+
import { t as g } from "./mermaid-parser.core-l4wHnGuN.js";
|
|
6
|
+
import { t as ne } from "./chunk-QZHKN3VN-3LiJhn2O.js";
|
|
7
|
+
//#region node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-K3NZZRJ6.mjs
|
|
8
|
+
var _ = {
|
|
9
|
+
NORMAL: 0,
|
|
10
|
+
REVERSE: 1,
|
|
11
|
+
HIGHLIGHT: 2,
|
|
12
|
+
MERGE: 3,
|
|
13
|
+
CHERRY_PICK: 4
|
|
14
|
+
}, re = f.gitGraph, v = /* @__PURE__ */ i(() => n({
|
|
15
|
+
...re,
|
|
16
|
+
...m().gitGraph
|
|
17
|
+
}), "getConfig"), y = new ne(() => {
|
|
18
|
+
let e = v(), t = e.mainBranchName, n = e.mainBranchOrder;
|
|
19
|
+
return {
|
|
20
|
+
mainBranchName: t,
|
|
21
|
+
commits: /* @__PURE__ */ new Map(),
|
|
22
|
+
head: null,
|
|
23
|
+
branchConfig: /* @__PURE__ */ new Map([[t, {
|
|
24
|
+
name: t,
|
|
25
|
+
order: n
|
|
26
|
+
}]]),
|
|
27
|
+
branches: /* @__PURE__ */ new Map([[t, null]]),
|
|
28
|
+
currBranch: t,
|
|
29
|
+
direction: "LR",
|
|
30
|
+
seq: 0,
|
|
31
|
+
options: {}
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
function b() {
|
|
35
|
+
return t({ length: 7 });
|
|
36
|
+
}
|
|
37
|
+
i(b, "getID");
|
|
38
|
+
function x(e, t) {
|
|
39
|
+
let n = /* @__PURE__ */ Object.create(null);
|
|
40
|
+
return e.reduce((e, r) => {
|
|
41
|
+
let i = t(r);
|
|
42
|
+
return n[i] || (n[i] = !0, e.push(r)), e;
|
|
43
|
+
}, []);
|
|
44
|
+
}
|
|
45
|
+
i(x, "uniqBy");
|
|
46
|
+
var S = /* @__PURE__ */ i(function(e) {
|
|
47
|
+
y.records.direction = e;
|
|
48
|
+
}, "setDirection"), C = /* @__PURE__ */ i(function(e) {
|
|
49
|
+
r.debug("options str", e), e = e?.trim(), e ||= "{}";
|
|
50
|
+
try {
|
|
51
|
+
y.records.options = JSON.parse(e);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
r.error("error while parsing gitGraph options", e.message);
|
|
54
|
+
}
|
|
55
|
+
}, "setOptions"), ie = /* @__PURE__ */ i(function() {
|
|
56
|
+
return y.records.options;
|
|
57
|
+
}, "getOptions"), ae = /* @__PURE__ */ i(function(e) {
|
|
58
|
+
let t = e.msg, n = e.id, i = e.type, a = e.tags;
|
|
59
|
+
r.info("commit", t, n, i, a), r.debug("Entering commit:", t, n, i, a);
|
|
60
|
+
let o = v();
|
|
61
|
+
n = p.sanitizeText(n, o), t = p.sanitizeText(t, o), a = a?.map((e) => p.sanitizeText(e, o));
|
|
62
|
+
let s = {
|
|
63
|
+
id: n || y.records.seq + "-" + b(),
|
|
64
|
+
message: t,
|
|
65
|
+
seq: y.records.seq++,
|
|
66
|
+
type: i ?? _.NORMAL,
|
|
67
|
+
tags: a ?? [],
|
|
68
|
+
parents: y.records.head == null ? [] : [y.records.head.id],
|
|
69
|
+
branch: y.records.currBranch
|
|
70
|
+
};
|
|
71
|
+
y.records.head = s, r.info("main branch", o.mainBranchName), y.records.commits.has(s.id) && r.warn(`Commit ID ${s.id} already exists`), y.records.commits.set(s.id, s), y.records.branches.set(y.records.currBranch, s.id), r.debug("in pushCommit " + s.id);
|
|
72
|
+
}, "commit"), oe = /* @__PURE__ */ i(function(e) {
|
|
73
|
+
let t = e.name, n = e.order;
|
|
74
|
+
if (t = p.sanitizeText(t, v()), y.records.branches.has(t)) throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${t}")`);
|
|
75
|
+
y.records.branches.set(t, y.records.head == null ? null : y.records.head.id), y.records.branchConfig.set(t, {
|
|
76
|
+
name: t,
|
|
77
|
+
order: n
|
|
78
|
+
}), w(t), r.debug("in createBranch");
|
|
79
|
+
}, "branch"), se = /* @__PURE__ */ i((e) => {
|
|
80
|
+
let t = e.branch, n = e.id, i = e.type, a = e.tags, o = v();
|
|
81
|
+
t = p.sanitizeText(t, o), n &&= p.sanitizeText(n, o);
|
|
82
|
+
let s = y.records.branches.get(y.records.currBranch), c = y.records.branches.get(t), l = s ? y.records.commits.get(s) : void 0, u = c ? y.records.commits.get(c) : void 0;
|
|
83
|
+
if (l && u && l.branch === t) throw Error(`Cannot merge branch '${t}' into itself.`);
|
|
84
|
+
if (y.records.currBranch === t) {
|
|
85
|
+
let e = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Cannot merge a branch to itself");
|
|
86
|
+
throw e.hash = {
|
|
87
|
+
text: `merge ${t}`,
|
|
88
|
+
token: `merge ${t}`,
|
|
89
|
+
expected: ["branch abc"]
|
|
90
|
+
}, e;
|
|
91
|
+
}
|
|
92
|
+
if (l === void 0 || !l) {
|
|
93
|
+
let e = /* @__PURE__ */ Error(`Incorrect usage of "merge". Current branch (${y.records.currBranch})has no commits`);
|
|
94
|
+
throw e.hash = {
|
|
95
|
+
text: `merge ${t}`,
|
|
96
|
+
token: `merge ${t}`,
|
|
97
|
+
expected: ["commit"]
|
|
98
|
+
}, e;
|
|
99
|
+
}
|
|
100
|
+
if (!y.records.branches.has(t)) {
|
|
101
|
+
let e = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Branch to be merged (" + t + ") does not exist");
|
|
102
|
+
throw e.hash = {
|
|
103
|
+
text: `merge ${t}`,
|
|
104
|
+
token: `merge ${t}`,
|
|
105
|
+
expected: [`branch ${t}`]
|
|
106
|
+
}, e;
|
|
107
|
+
}
|
|
108
|
+
if (u === void 0 || !u) {
|
|
109
|
+
let e = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Branch to be merged (" + t + ") has no commits");
|
|
110
|
+
throw e.hash = {
|
|
111
|
+
text: `merge ${t}`,
|
|
112
|
+
token: `merge ${t}`,
|
|
113
|
+
expected: ["\"commit\""]
|
|
114
|
+
}, e;
|
|
115
|
+
}
|
|
116
|
+
if (l === u) {
|
|
117
|
+
let e = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Both branches have same head");
|
|
118
|
+
throw e.hash = {
|
|
119
|
+
text: `merge ${t}`,
|
|
120
|
+
token: `merge ${t}`,
|
|
121
|
+
expected: ["branch abc"]
|
|
122
|
+
}, e;
|
|
123
|
+
}
|
|
124
|
+
if (n && y.records.commits.has(n)) {
|
|
125
|
+
let e = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Commit with id:" + n + " already exists, use different custom id");
|
|
126
|
+
throw e.hash = {
|
|
127
|
+
text: `merge ${t} ${n} ${i} ${a?.join(" ")}`,
|
|
128
|
+
token: `merge ${t} ${n} ${i} ${a?.join(" ")}`,
|
|
129
|
+
expected: [`merge ${t} ${n}_UNIQUE ${i} ${a?.join(" ")}`]
|
|
130
|
+
}, e;
|
|
131
|
+
}
|
|
132
|
+
let d = c || "", f = {
|
|
133
|
+
id: n || `${y.records.seq}-${b()}`,
|
|
134
|
+
message: `merged branch ${t} into ${y.records.currBranch}`,
|
|
135
|
+
seq: y.records.seq++,
|
|
136
|
+
parents: y.records.head == null ? [] : [y.records.head.id, d],
|
|
137
|
+
branch: y.records.currBranch,
|
|
138
|
+
type: _.MERGE,
|
|
139
|
+
customType: i,
|
|
140
|
+
customId: !!n,
|
|
141
|
+
tags: a ?? []
|
|
142
|
+
};
|
|
143
|
+
y.records.head = f, y.records.commits.set(f.id, f), y.records.branches.set(y.records.currBranch, f.id), r.debug(y.records.branches), r.debug("in mergeBranch");
|
|
144
|
+
}, "merge"), ce = /* @__PURE__ */ i(function(e) {
|
|
145
|
+
let t = e.id, n = e.targetId, i = e.tags, a = e.parent;
|
|
146
|
+
r.debug("Entering cherryPick:", t, n, i);
|
|
147
|
+
let o = v();
|
|
148
|
+
if (t = p.sanitizeText(t, o), n = p.sanitizeText(n, o), i = i?.map((e) => p.sanitizeText(e, o)), a = p.sanitizeText(a, o), !t || !y.records.commits.has(t)) {
|
|
149
|
+
let e = /* @__PURE__ */ Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
|
|
150
|
+
throw e.hash = {
|
|
151
|
+
text: `cherryPick ${t} ${n}`,
|
|
152
|
+
token: `cherryPick ${t} ${n}`,
|
|
153
|
+
expected: ["cherry-pick abc"]
|
|
154
|
+
}, e;
|
|
155
|
+
}
|
|
156
|
+
let s = y.records.commits.get(t);
|
|
157
|
+
if (s === void 0 || !s) throw Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
|
|
158
|
+
if (a && !(Array.isArray(s.parents) && s.parents.includes(a))) throw /* @__PURE__ */ Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");
|
|
159
|
+
let c = s.branch;
|
|
160
|
+
if (s.type === _.MERGE && !a) throw /* @__PURE__ */ Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");
|
|
161
|
+
if (!n || !y.records.commits.has(n)) {
|
|
162
|
+
if (c === y.records.currBranch) {
|
|
163
|
+
let e = /* @__PURE__ */ Error("Incorrect usage of \"cherryPick\". Source commit is already on current branch");
|
|
164
|
+
throw e.hash = {
|
|
165
|
+
text: `cherryPick ${t} ${n}`,
|
|
166
|
+
token: `cherryPick ${t} ${n}`,
|
|
167
|
+
expected: ["cherry-pick abc"]
|
|
168
|
+
}, e;
|
|
169
|
+
}
|
|
170
|
+
let e = y.records.branches.get(y.records.currBranch);
|
|
171
|
+
if (e === void 0 || !e) {
|
|
172
|
+
let e = /* @__PURE__ */ Error(`Incorrect usage of "cherry-pick". Current branch (${y.records.currBranch})has no commits`);
|
|
173
|
+
throw e.hash = {
|
|
174
|
+
text: `cherryPick ${t} ${n}`,
|
|
175
|
+
token: `cherryPick ${t} ${n}`,
|
|
176
|
+
expected: ["cherry-pick abc"]
|
|
177
|
+
}, e;
|
|
178
|
+
}
|
|
179
|
+
let o = y.records.commits.get(e);
|
|
180
|
+
if (o === void 0 || !o) {
|
|
181
|
+
let e = /* @__PURE__ */ Error(`Incorrect usage of "cherry-pick". Current branch (${y.records.currBranch})has no commits`);
|
|
182
|
+
throw e.hash = {
|
|
183
|
+
text: `cherryPick ${t} ${n}`,
|
|
184
|
+
token: `cherryPick ${t} ${n}`,
|
|
185
|
+
expected: ["cherry-pick abc"]
|
|
186
|
+
}, e;
|
|
187
|
+
}
|
|
188
|
+
let l = {
|
|
189
|
+
id: y.records.seq + "-" + b(),
|
|
190
|
+
message: `cherry-picked ${s?.message} into ${y.records.currBranch}`,
|
|
191
|
+
seq: y.records.seq++,
|
|
192
|
+
parents: y.records.head == null ? [] : [y.records.head.id, s.id],
|
|
193
|
+
branch: y.records.currBranch,
|
|
194
|
+
type: _.CHERRY_PICK,
|
|
195
|
+
tags: i ? i.filter(Boolean) : [`cherry-pick:${s.id}${s.type === _.MERGE ? `|parent:${a}` : ""}`]
|
|
196
|
+
};
|
|
197
|
+
y.records.head = l, y.records.commits.set(l.id, l), y.records.branches.set(y.records.currBranch, l.id), r.debug(y.records.branches), r.debug("in cherryPick");
|
|
198
|
+
}
|
|
199
|
+
}, "cherryPick"), w = /* @__PURE__ */ i(function(e) {
|
|
200
|
+
if (e = p.sanitizeText(e, v()), y.records.branches.has(e)) {
|
|
201
|
+
y.records.currBranch = e;
|
|
202
|
+
let t = y.records.branches.get(y.records.currBranch);
|
|
203
|
+
t === void 0 || !t ? y.records.head = null : y.records.head = y.records.commits.get(t) ?? null;
|
|
204
|
+
} else {
|
|
205
|
+
let t = /* @__PURE__ */ Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);
|
|
206
|
+
throw t.hash = {
|
|
207
|
+
text: `checkout ${e}`,
|
|
208
|
+
token: `checkout ${e}`,
|
|
209
|
+
expected: [`branch ${e}`]
|
|
210
|
+
}, t;
|
|
211
|
+
}
|
|
212
|
+
}, "checkout");
|
|
213
|
+
function T(e, t, n) {
|
|
214
|
+
let r = e.indexOf(t);
|
|
215
|
+
r === -1 ? e.push(n) : e.splice(r, 1, n);
|
|
216
|
+
}
|
|
217
|
+
i(T, "upsert");
|
|
218
|
+
function E(e) {
|
|
219
|
+
let t = e.reduce((e, t) => e.seq > t.seq ? e : t, e[0]), n = "";
|
|
220
|
+
e.forEach(function(e) {
|
|
221
|
+
e === t ? n += " *" : n += " |";
|
|
222
|
+
});
|
|
223
|
+
let i = [
|
|
224
|
+
n,
|
|
225
|
+
t.id,
|
|
226
|
+
t.seq
|
|
227
|
+
];
|
|
228
|
+
for (let e in y.records.branches) y.records.branches.get(e) === t.id && i.push(e);
|
|
229
|
+
if (r.debug(i.join(" ")), t.parents && t.parents.length == 2 && t.parents[0] && t.parents[1]) {
|
|
230
|
+
let n = y.records.commits.get(t.parents[0]);
|
|
231
|
+
T(e, t, n), t.parents[1] && e.push(y.records.commits.get(t.parents[1]));
|
|
232
|
+
} else if (t.parents.length == 0) return;
|
|
233
|
+
else if (t.parents[0]) {
|
|
234
|
+
let n = y.records.commits.get(t.parents[0]);
|
|
235
|
+
T(e, t, n);
|
|
236
|
+
}
|
|
237
|
+
e = x(e, (e) => e.id), E(e);
|
|
238
|
+
}
|
|
239
|
+
i(E, "prettyPrintCommitHistory");
|
|
240
|
+
var le = /* @__PURE__ */ i(function() {
|
|
241
|
+
r.debug(y.records.commits);
|
|
242
|
+
let e = D()[0];
|
|
243
|
+
E([e]);
|
|
244
|
+
}, "prettyPrint"), ue = /* @__PURE__ */ i(function() {
|
|
245
|
+
y.reset(), d();
|
|
246
|
+
}, "clear"), de = /* @__PURE__ */ i(function() {
|
|
247
|
+
return [...y.records.branchConfig.values()].map((e, t) => e.order !== null && e.order !== void 0 ? e : {
|
|
248
|
+
...e,
|
|
249
|
+
order: parseFloat(`0.${t}`)
|
|
250
|
+
}).sort((e, t) => (e.order ?? 0) - (t.order ?? 0)).map(({ name: e }) => ({ name: e }));
|
|
251
|
+
}, "getBranchesAsObjArray"), fe = /* @__PURE__ */ i(function() {
|
|
252
|
+
return y.records.branches;
|
|
253
|
+
}, "getBranches"), pe = /* @__PURE__ */ i(function() {
|
|
254
|
+
return y.records.commits;
|
|
255
|
+
}, "getCommits"), D = /* @__PURE__ */ i(function() {
|
|
256
|
+
let e = [...y.records.commits.values()];
|
|
257
|
+
return e.forEach(function(e) {
|
|
258
|
+
r.debug(e.id);
|
|
259
|
+
}), e.sort((e, t) => e.seq - t.seq), e;
|
|
260
|
+
}, "getCommitsArray"), O = {
|
|
261
|
+
commitType: _,
|
|
262
|
+
getConfig: v,
|
|
263
|
+
setDirection: S,
|
|
264
|
+
setOptions: C,
|
|
265
|
+
getOptions: ie,
|
|
266
|
+
commit: ae,
|
|
267
|
+
branch: oe,
|
|
268
|
+
merge: se,
|
|
269
|
+
cherryPick: ce,
|
|
270
|
+
checkout: w,
|
|
271
|
+
prettyPrint: le,
|
|
272
|
+
clear: ue,
|
|
273
|
+
getBranchesAsObjArray: de,
|
|
274
|
+
getBranches: fe,
|
|
275
|
+
getCommits: pe,
|
|
276
|
+
getCommitsArray: D,
|
|
277
|
+
getCurrentBranch: /* @__PURE__ */ i(function() {
|
|
278
|
+
return y.records.currBranch;
|
|
279
|
+
}, "getCurrentBranch"),
|
|
280
|
+
getDirection: /* @__PURE__ */ i(function() {
|
|
281
|
+
return y.records.direction;
|
|
282
|
+
}, "getDirection"),
|
|
283
|
+
getHead: /* @__PURE__ */ i(function() {
|
|
284
|
+
return y.records.head;
|
|
285
|
+
}, "getHead"),
|
|
286
|
+
setAccTitle: c,
|
|
287
|
+
getAccTitle: te,
|
|
288
|
+
getAccDescription: u,
|
|
289
|
+
setAccDescription: o,
|
|
290
|
+
setDiagramTitle: l,
|
|
291
|
+
getDiagramTitle: s
|
|
292
|
+
}, k = /* @__PURE__ */ i((e, t) => {
|
|
293
|
+
h(e, t), e.dir && t.setDirection(e.dir);
|
|
294
|
+
for (let n of e.statements) A(n, t);
|
|
295
|
+
}, "populate"), A = /* @__PURE__ */ i((e, t) => {
|
|
296
|
+
let n = {
|
|
297
|
+
Commit: /* @__PURE__ */ i((e) => t.commit(j(e)), "Commit"),
|
|
298
|
+
Branch: /* @__PURE__ */ i((e) => t.branch(M(e)), "Branch"),
|
|
299
|
+
Merge: /* @__PURE__ */ i((e) => t.merge(N(e)), "Merge"),
|
|
300
|
+
Checkout: /* @__PURE__ */ i((e) => t.checkout(P(e)), "Checkout"),
|
|
301
|
+
CherryPicking: /* @__PURE__ */ i((e) => t.cherryPick(F(e)), "CherryPicking")
|
|
302
|
+
}[e.$type];
|
|
303
|
+
n ? n(e) : r.error(`Unknown statement type: ${e.$type}`);
|
|
304
|
+
}, "parseStatement"), j = /* @__PURE__ */ i((e) => ({
|
|
305
|
+
id: e.id,
|
|
306
|
+
msg: e.message ?? "",
|
|
307
|
+
type: e.type === void 0 ? _.NORMAL : _[e.type],
|
|
308
|
+
tags: e.tags ?? void 0
|
|
309
|
+
}), "parseCommit"), M = /* @__PURE__ */ i((e) => ({
|
|
310
|
+
name: e.name,
|
|
311
|
+
order: e.order ?? 0
|
|
312
|
+
}), "parseBranch"), N = /* @__PURE__ */ i((e) => ({
|
|
313
|
+
branch: e.branch,
|
|
314
|
+
id: e.id ?? "",
|
|
315
|
+
type: e.type === void 0 ? void 0 : _[e.type],
|
|
316
|
+
tags: e.tags ?? void 0
|
|
317
|
+
}), "parseMerge"), P = /* @__PURE__ */ i((e) => e.branch, "parseCheckout"), F = /* @__PURE__ */ i((e) => ({
|
|
318
|
+
id: e.id,
|
|
319
|
+
targetId: "",
|
|
320
|
+
tags: e.tags?.length === 0 ? void 0 : e.tags,
|
|
321
|
+
parent: e.parent
|
|
322
|
+
}), "parseCherryPicking"), I = { parse: /* @__PURE__ */ i(async (e) => {
|
|
323
|
+
let t = await g("gitGraph", e);
|
|
324
|
+
r.debug(t), k(t, O);
|
|
325
|
+
}, "parse") }, L = 10, R = 40, z = 4, B = 2, V = 8, H = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), W = 30, G = /* @__PURE__ */ new Map(), K = [], q = 0, J = "LR", me = /* @__PURE__ */ i(() => {
|
|
326
|
+
H.clear(), U.clear(), G.clear(), q = 0, K = [], J = "LR";
|
|
327
|
+
}, "clear"), Y = /* @__PURE__ */ i((e) => {
|
|
328
|
+
let t = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
329
|
+
return (typeof e == "string" ? e.split(/\\n|\n|<br\s*\/?>/gi) : e).forEach((e) => {
|
|
330
|
+
let n = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
331
|
+
n.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), n.setAttribute("dy", "1em"), n.setAttribute("x", "0"), n.setAttribute("class", "row"), n.textContent = e.trim(), t.appendChild(n);
|
|
332
|
+
}), t;
|
|
333
|
+
}, "drawText"), X = /* @__PURE__ */ i((e) => {
|
|
334
|
+
let t, n, r;
|
|
335
|
+
return J === "BT" ? (n = /* @__PURE__ */ i((e, t) => e <= t, "comparisonFunc"), r = Infinity) : (n = /* @__PURE__ */ i((e, t) => e >= t, "comparisonFunc"), r = 0), e.forEach((e) => {
|
|
336
|
+
let i = J === "TB" || J == "BT" ? U.get(e)?.y : U.get(e)?.x;
|
|
337
|
+
i !== void 0 && n(i, r) && (t = e, r = i);
|
|
338
|
+
}), t;
|
|
339
|
+
}, "findClosestParent"), he = /* @__PURE__ */ i((e) => {
|
|
340
|
+
let t = "", n = Infinity;
|
|
341
|
+
return e.forEach((e) => {
|
|
342
|
+
let r = U.get(e).y;
|
|
343
|
+
r <= n && (t = e, n = r);
|
|
344
|
+
}), t || void 0;
|
|
345
|
+
}, "findClosestParentBT"), ge = /* @__PURE__ */ i((e, t, n) => {
|
|
346
|
+
let r = n, i = n, a = [];
|
|
347
|
+
e.forEach((e) => {
|
|
348
|
+
let n = t.get(e);
|
|
349
|
+
if (!n) throw Error(`Commit not found for key ${e}`);
|
|
350
|
+
n.parents.length ? (r = ve(n), i = Math.max(r, i)) : a.push(n), ye(n, r);
|
|
351
|
+
}), r = i, a.forEach((e) => {
|
|
352
|
+
be(e, r, n);
|
|
353
|
+
}), e.forEach((e) => {
|
|
354
|
+
let n = t.get(e);
|
|
355
|
+
if (n?.parents.length) {
|
|
356
|
+
let e = he(n.parents);
|
|
357
|
+
r = U.get(e).y - R, r <= i && (i = r);
|
|
358
|
+
let t = H.get(n.branch).pos, a = r - L;
|
|
359
|
+
U.set(n.id, {
|
|
360
|
+
x: t,
|
|
361
|
+
y: a
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
}, "setParallelBTPos"), _e = /* @__PURE__ */ i((e) => {
|
|
366
|
+
let t = X(e.parents.filter((e) => e !== null));
|
|
367
|
+
if (!t) throw Error(`Closest parent not found for commit ${e.id}`);
|
|
368
|
+
let n = U.get(t)?.y;
|
|
369
|
+
if (n === void 0) throw Error(`Closest parent position not found for commit ${e.id}`);
|
|
370
|
+
return n;
|
|
371
|
+
}, "findClosestParentPos"), ve = /* @__PURE__ */ i((e) => _e(e) + R, "calculateCommitPosition"), ye = /* @__PURE__ */ i((e, t) => {
|
|
372
|
+
let n = H.get(e.branch);
|
|
373
|
+
if (!n) throw Error(`Branch not found for commit ${e.id}`);
|
|
374
|
+
let r = n.pos, i = t + L;
|
|
375
|
+
return U.set(e.id, {
|
|
376
|
+
x: r,
|
|
377
|
+
y: i
|
|
378
|
+
}), {
|
|
379
|
+
x: r,
|
|
380
|
+
y: i
|
|
381
|
+
};
|
|
382
|
+
}, "setCommitPosition"), be = /* @__PURE__ */ i((e, t, n) => {
|
|
383
|
+
let r = H.get(e.branch);
|
|
384
|
+
if (!r) throw Error(`Branch not found for commit ${e.id}`);
|
|
385
|
+
let i = t + n, a = r.pos;
|
|
386
|
+
U.set(e.id, {
|
|
387
|
+
x: a,
|
|
388
|
+
y: i
|
|
389
|
+
});
|
|
390
|
+
}, "setRootPosition"), xe = /* @__PURE__ */ i((e, t, n, r, i, a) => {
|
|
391
|
+
if (a === _.HIGHLIGHT) e.append("rect").attr("x", n.x - 10).attr("y", n.y - 10).attr("width", 20).attr("height", 20).attr("class", `commit ${t.id} commit-highlight${i % V} ${r}-outer`), e.append("rect").attr("x", n.x - 6).attr("y", n.y - 6).attr("width", 12).attr("height", 12).attr("class", `commit ${t.id} commit${i % V} ${r}-inner`);
|
|
392
|
+
else if (a === _.CHERRY_PICK) e.append("circle").attr("cx", n.x).attr("cy", n.y).attr("r", 10).attr("class", `commit ${t.id} ${r}`), e.append("circle").attr("cx", n.x - 3).attr("cy", n.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${t.id} ${r}`), e.append("circle").attr("cx", n.x + 3).attr("cy", n.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${t.id} ${r}`), e.append("line").attr("x1", n.x + 3).attr("y1", n.y + 1).attr("x2", n.x).attr("y2", n.y - 5).attr("stroke", "#fff").attr("class", `commit ${t.id} ${r}`), e.append("line").attr("x1", n.x - 3).attr("y1", n.y + 1).attr("x2", n.x).attr("y2", n.y - 5).attr("stroke", "#fff").attr("class", `commit ${t.id} ${r}`);
|
|
393
|
+
else {
|
|
394
|
+
let o = e.append("circle");
|
|
395
|
+
if (o.attr("cx", n.x), o.attr("cy", n.y), o.attr("r", t.type === _.MERGE ? 9 : 10), o.attr("class", `commit ${t.id} commit${i % V}`), a === _.MERGE) {
|
|
396
|
+
let a = e.append("circle");
|
|
397
|
+
a.attr("cx", n.x), a.attr("cy", n.y), a.attr("r", 6), a.attr("class", `commit ${r} ${t.id} commit${i % V}`);
|
|
398
|
+
}
|
|
399
|
+
a === _.REVERSE && e.append("path").attr("d", `M ${n.x - 5},${n.y - 5}L${n.x + 5},${n.y + 5}M${n.x - 5},${n.y + 5}L${n.x + 5},${n.y - 5}`).attr("class", `commit ${r} ${t.id} commit${i % V}`);
|
|
400
|
+
}
|
|
401
|
+
}, "drawCommitBullet"), Se = /* @__PURE__ */ i((e, t, n, r, i) => {
|
|
402
|
+
if (t.type !== _.CHERRY_PICK && (t.customId && t.type === _.MERGE || t.type !== _.MERGE) && i.showCommitLabel) {
|
|
403
|
+
let a = e.append("g"), o = a.insert("rect").attr("class", "commit-label-bkg"), s = a.append("text").attr("x", r).attr("y", n.y + 25).attr("class", "commit-label").text(t.id), c = s.node()?.getBBox();
|
|
404
|
+
if (c && (o.attr("x", n.posWithOffset - c.width / 2 - B).attr("y", n.y + 13.5).attr("width", c.width + 2 * B).attr("height", c.height + 2 * B), J === "TB" || J === "BT" ? (o.attr("x", n.x - (c.width + 4 * z + 5)).attr("y", n.y - 12), s.attr("x", n.x - (c.width + 4 * z)).attr("y", n.y + c.height - 12)) : s.attr("x", n.posWithOffset - c.width / 2), i.rotateCommitLabel)) if (J === "TB" || J === "BT") s.attr("transform", "rotate(-45, " + n.x + ", " + n.y + ")"), o.attr("transform", "rotate(-45, " + n.x + ", " + n.y + ")");
|
|
405
|
+
else {
|
|
406
|
+
let e = -7.5 - (c.width + 10) / 25 * 9.5, t = 10 + c.width / 25 * 8.5;
|
|
407
|
+
a.attr("transform", "translate(" + e + ", " + t + ") rotate(-45, " + r + ", " + n.y + ")");
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}, "drawCommitLabel"), Z = /* @__PURE__ */ i((e, t, n, r) => {
|
|
411
|
+
if (t.tags.length > 0) {
|
|
412
|
+
let i = 0, a = 0, o = 0, s = [];
|
|
413
|
+
for (let r of t.tags.reverse()) {
|
|
414
|
+
let t = e.insert("polygon"), c = e.append("circle"), l = e.append("text").attr("y", n.y - 16 - i).attr("class", "tag-label").text(r), u = l.node()?.getBBox();
|
|
415
|
+
if (!u) throw Error("Tag bbox not found");
|
|
416
|
+
a = Math.max(a, u.width), o = Math.max(o, u.height), l.attr("x", n.posWithOffset - u.width / 2), s.push({
|
|
417
|
+
tag: l,
|
|
418
|
+
hole: c,
|
|
419
|
+
rect: t,
|
|
420
|
+
yOffset: i
|
|
421
|
+
}), i += 20;
|
|
422
|
+
}
|
|
423
|
+
for (let { tag: e, hole: t, rect: i, yOffset: c } of s) {
|
|
424
|
+
let s = o / 2, l = n.y - 19.2 - c;
|
|
425
|
+
if (i.attr("class", "tag-label-bkg").attr("points", `
|
|
426
|
+
${r - a / 2 - z / 2},${l + B}
|
|
427
|
+
${r - a / 2 - z / 2},${l - B}
|
|
428
|
+
${n.posWithOffset - a / 2 - z},${l - s - B}
|
|
429
|
+
${n.posWithOffset + a / 2 + z},${l - s - B}
|
|
430
|
+
${n.posWithOffset + a / 2 + z},${l + s + B}
|
|
431
|
+
${n.posWithOffset - a / 2 - z},${l + s + B}`), t.attr("cy", l).attr("cx", r - a / 2 + z / 2).attr("r", 1.5).attr("class", "tag-hole"), J === "TB" || J === "BT") {
|
|
432
|
+
let o = r + c;
|
|
433
|
+
i.attr("class", "tag-label-bkg").attr("points", `
|
|
434
|
+
${n.x},${o + 2}
|
|
435
|
+
${n.x},${o - 2}
|
|
436
|
+
${n.x + L},${o - s - 2}
|
|
437
|
+
${n.x + L + a + 4},${o - s - 2}
|
|
438
|
+
${n.x + L + a + 4},${o + s + 2}
|
|
439
|
+
${n.x + L},${o + s + 2}`).attr("transform", "translate(12,12) rotate(45, " + n.x + "," + r + ")"), t.attr("cx", n.x + z / 2).attr("cy", o).attr("transform", "translate(12,12) rotate(45, " + n.x + "," + r + ")"), e.attr("x", n.x + 5).attr("y", o + 3).attr("transform", "translate(14,14) rotate(45, " + n.x + "," + r + ")");
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}, "drawCommitTags"), Ce = /* @__PURE__ */ i((e) => {
|
|
444
|
+
switch (e.customType ?? e.type) {
|
|
445
|
+
case _.NORMAL: return "commit-normal";
|
|
446
|
+
case _.REVERSE: return "commit-reverse";
|
|
447
|
+
case _.HIGHLIGHT: return "commit-highlight";
|
|
448
|
+
case _.MERGE: return "commit-merge";
|
|
449
|
+
case _.CHERRY_PICK: return "commit-cherry-pick";
|
|
450
|
+
default: return "commit-normal";
|
|
451
|
+
}
|
|
452
|
+
}, "getCommitClassType"), we = /* @__PURE__ */ i((e, t, n, r) => {
|
|
453
|
+
let i = {
|
|
454
|
+
x: 0,
|
|
455
|
+
y: 0
|
|
456
|
+
};
|
|
457
|
+
if (e.parents.length > 0) {
|
|
458
|
+
let n = X(e.parents);
|
|
459
|
+
if (n) {
|
|
460
|
+
let a = r.get(n) ?? i;
|
|
461
|
+
return t === "TB" ? a.y + R : t === "BT" ? (r.get(e.id) ?? i).y - R : a.x + R;
|
|
462
|
+
}
|
|
463
|
+
} else if (t === "TB") return W;
|
|
464
|
+
else if (t === "BT") return (r.get(e.id) ?? i).y - R;
|
|
465
|
+
else return 0;
|
|
466
|
+
return 0;
|
|
467
|
+
}, "calculatePosition"), Te = /* @__PURE__ */ i((e, t, n) => {
|
|
468
|
+
let r = J === "BT" && n ? t : t + L, i = J === "TB" || J === "BT" ? r : H.get(e.branch)?.pos, a = J === "TB" || J === "BT" ? H.get(e.branch)?.pos : r;
|
|
469
|
+
if (a === void 0 || i === void 0) throw Error(`Position were undefined for commit ${e.id}`);
|
|
470
|
+
return {
|
|
471
|
+
x: a,
|
|
472
|
+
y: i,
|
|
473
|
+
posWithOffset: r
|
|
474
|
+
};
|
|
475
|
+
}, "getCommitPosition"), Q = /* @__PURE__ */ i((e, t, n, r) => {
|
|
476
|
+
let a = e.append("g").attr("class", "commit-bullets"), o = e.append("g").attr("class", "commit-labels"), s = J === "TB" || J === "BT" ? W : 0, c = [...t.keys()], l = r.parallelCommits ?? !1, u = /* @__PURE__ */ i((e, n) => {
|
|
477
|
+
let r = t.get(e)?.seq, i = t.get(n)?.seq;
|
|
478
|
+
return r !== void 0 && i !== void 0 ? r - i : 0;
|
|
479
|
+
}, "sortKeys"), d = c.sort(u);
|
|
480
|
+
J === "BT" && (l && ge(d, t, s), d = d.reverse()), d.forEach((e) => {
|
|
481
|
+
let i = t.get(e);
|
|
482
|
+
if (!i) throw Error(`Commit not found for key ${e}`);
|
|
483
|
+
l && (s = we(i, J, s, U));
|
|
484
|
+
let c = Te(i, s, l);
|
|
485
|
+
if (n) {
|
|
486
|
+
let e = Ce(i), t = i.customType ?? i.type;
|
|
487
|
+
xe(a, i, c, e, H.get(i.branch)?.index ?? 0, t), Se(o, i, c, s, r), Z(o, i, c, s);
|
|
488
|
+
}
|
|
489
|
+
J === "TB" || J === "BT" ? U.set(i.id, {
|
|
490
|
+
x: c.x,
|
|
491
|
+
y: c.posWithOffset
|
|
492
|
+
}) : U.set(i.id, {
|
|
493
|
+
x: c.posWithOffset,
|
|
494
|
+
y: c.y
|
|
495
|
+
}), s = J === "BT" && l ? s + R : s + R + L, s > q && (q = s);
|
|
496
|
+
});
|
|
497
|
+
}, "drawCommits"), Ee = /* @__PURE__ */ i((e, t, n, r, a) => {
|
|
498
|
+
let o = (J === "TB" || J === "BT" ? n.x < r.x : n.y < r.y) ? t.branch : e.branch, s = /* @__PURE__ */ i((e) => e.branch === o, "isOnBranchToGetCurve"), c = /* @__PURE__ */ i((n) => n.seq > e.seq && n.seq < t.seq, "isBetweenCommits");
|
|
499
|
+
return [...a.values()].some((e) => c(e) && s(e));
|
|
500
|
+
}, "shouldRerouteArrow"), $ = /* @__PURE__ */ i((e, t, n = 0) => {
|
|
501
|
+
let r = e + Math.abs(e - t) / 2;
|
|
502
|
+
return n > 5 ? r : K.every((e) => Math.abs(e - r) >= 10) ? (K.push(r), r) : $(e, t - Math.abs(e - t) / 5, n + 1);
|
|
503
|
+
}, "findLane"), De = /* @__PURE__ */ i((e, t, n, r) => {
|
|
504
|
+
let i = U.get(t.id), a = U.get(n.id);
|
|
505
|
+
if (i === void 0 || a === void 0) throw Error(`Commit positions not found for commits ${t.id} and ${n.id}`);
|
|
506
|
+
let o = Ee(t, n, i, a, r), s = "", c = "", l = 0, u = 0, d = H.get(n.branch)?.index;
|
|
507
|
+
n.type === _.MERGE && t.id !== n.parents[0] && (d = H.get(t.branch)?.index);
|
|
508
|
+
let f;
|
|
509
|
+
if (o) {
|
|
510
|
+
s = "A 10 10, 0, 0, 0,", c = "A 10 10, 0, 0, 1,", l = 10, u = 10;
|
|
511
|
+
let e = i.y < a.y ? $(i.y, a.y) : $(a.y, i.y), n = i.x < a.x ? $(i.x, a.x) : $(a.x, i.x);
|
|
512
|
+
J === "TB" ? i.x < a.x ? f = `M ${i.x} ${i.y} L ${n - l} ${i.y} ${c} ${n} ${i.y + u} L ${n} ${a.y - l} ${s} ${n + u} ${a.y} L ${a.x} ${a.y}` : (d = H.get(t.branch)?.index, f = `M ${i.x} ${i.y} L ${n + l} ${i.y} ${s} ${n} ${i.y + u} L ${n} ${a.y - l} ${c} ${n - u} ${a.y} L ${a.x} ${a.y}`) : J === "BT" ? i.x < a.x ? f = `M ${i.x} ${i.y} L ${n - l} ${i.y} ${s} ${n} ${i.y - u} L ${n} ${a.y + l} ${c} ${n + u} ${a.y} L ${a.x} ${a.y}` : (d = H.get(t.branch)?.index, f = `M ${i.x} ${i.y} L ${n + l} ${i.y} ${c} ${n} ${i.y - u} L ${n} ${a.y + l} ${s} ${n - u} ${a.y} L ${a.x} ${a.y}`) : i.y < a.y ? f = `M ${i.x} ${i.y} L ${i.x} ${e - l} ${s} ${i.x + u} ${e} L ${a.x - l} ${e} ${c} ${a.x} ${e + u} L ${a.x} ${a.y}` : (d = H.get(t.branch)?.index, f = `M ${i.x} ${i.y} L ${i.x} ${e + l} ${c} ${i.x + u} ${e} L ${a.x - l} ${e} ${s} ${a.x} ${e - u} L ${a.x} ${a.y}`);
|
|
513
|
+
} else s = "A 20 20, 0, 0, 0,", c = "A 20 20, 0, 0, 1,", l = 20, u = 20, J === "TB" ? (i.x < a.x && (f = n.type === _.MERGE && t.id !== n.parents[0] ? `M ${i.x} ${i.y} L ${i.x} ${a.y - l} ${s} ${i.x + u} ${a.y} L ${a.x} ${a.y}` : `M ${i.x} ${i.y} L ${a.x - l} ${i.y} ${c} ${a.x} ${i.y + u} L ${a.x} ${a.y}`), i.x > a.x && (s = "A 20 20, 0, 0, 0,", c = "A 20 20, 0, 0, 1,", l = 20, u = 20, f = n.type === _.MERGE && t.id !== n.parents[0] ? `M ${i.x} ${i.y} L ${i.x} ${a.y - l} ${c} ${i.x - u} ${a.y} L ${a.x} ${a.y}` : `M ${i.x} ${i.y} L ${a.x + l} ${i.y} ${s} ${a.x} ${i.y + u} L ${a.x} ${a.y}`), i.x === a.x && (f = `M ${i.x} ${i.y} L ${a.x} ${a.y}`)) : J === "BT" ? (i.x < a.x && (f = n.type === _.MERGE && t.id !== n.parents[0] ? `M ${i.x} ${i.y} L ${i.x} ${a.y + l} ${c} ${i.x + u} ${a.y} L ${a.x} ${a.y}` : `M ${i.x} ${i.y} L ${a.x - l} ${i.y} ${s} ${a.x} ${i.y - u} L ${a.x} ${a.y}`), i.x > a.x && (s = "A 20 20, 0, 0, 0,", c = "A 20 20, 0, 0, 1,", l = 20, u = 20, f = n.type === _.MERGE && t.id !== n.parents[0] ? `M ${i.x} ${i.y} L ${i.x} ${a.y + l} ${s} ${i.x - u} ${a.y} L ${a.x} ${a.y}` : `M ${i.x} ${i.y} L ${a.x + l} ${i.y} ${c} ${a.x} ${i.y - u} L ${a.x} ${a.y}`), i.x === a.x && (f = `M ${i.x} ${i.y} L ${a.x} ${a.y}`)) : (i.y < a.y && (f = n.type === _.MERGE && t.id !== n.parents[0] ? `M ${i.x} ${i.y} L ${a.x - l} ${i.y} ${c} ${a.x} ${i.y + u} L ${a.x} ${a.y}` : `M ${i.x} ${i.y} L ${i.x} ${a.y - l} ${s} ${i.x + u} ${a.y} L ${a.x} ${a.y}`), i.y > a.y && (f = n.type === _.MERGE && t.id !== n.parents[0] ? `M ${i.x} ${i.y} L ${a.x - l} ${i.y} ${s} ${a.x} ${i.y - u} L ${a.x} ${a.y}` : `M ${i.x} ${i.y} L ${i.x} ${a.y + l} ${c} ${i.x + u} ${a.y} L ${a.x} ${a.y}`), i.y === a.y && (f = `M ${i.x} ${i.y} L ${a.x} ${a.y}`));
|
|
514
|
+
if (f === void 0) throw Error("Line definition not found");
|
|
515
|
+
e.append("path").attr("d", f).attr("class", "arrow arrow" + d % V);
|
|
516
|
+
}, "drawArrow"), Oe = /* @__PURE__ */ i((e, t) => {
|
|
517
|
+
let n = e.append("g").attr("class", "commit-arrows");
|
|
518
|
+
[...t.keys()].forEach((e) => {
|
|
519
|
+
let r = t.get(e);
|
|
520
|
+
r.parents && r.parents.length > 0 && r.parents.forEach((e) => {
|
|
521
|
+
De(n, t.get(e), r, t);
|
|
522
|
+
});
|
|
523
|
+
});
|
|
524
|
+
}, "drawArrows"), ke = /* @__PURE__ */ i((e, t, n) => {
|
|
525
|
+
let r = e.append("g");
|
|
526
|
+
t.forEach((e, t) => {
|
|
527
|
+
let i = t % V, a = H.get(e.name)?.pos;
|
|
528
|
+
if (a === void 0) throw Error(`Position not found for branch ${e.name}`);
|
|
529
|
+
let o = r.append("line");
|
|
530
|
+
o.attr("x1", 0), o.attr("y1", a), o.attr("x2", q), o.attr("y2", a), o.attr("class", "branch branch" + i), J === "TB" ? (o.attr("y1", W), o.attr("x1", a), o.attr("y2", q), o.attr("x2", a)) : J === "BT" && (o.attr("y1", q), o.attr("x1", a), o.attr("y2", W), o.attr("x2", a)), K.push(a);
|
|
531
|
+
let s = e.name, c = Y(s), l = r.insert("rect"), u = r.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + i);
|
|
532
|
+
u.node().appendChild(c);
|
|
533
|
+
let d = c.getBBox();
|
|
534
|
+
l.attr("class", "branchLabelBkg label" + i).attr("rx", 4).attr("ry", 4).attr("x", -d.width - 4 - (n.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -d.height / 2 + 8).attr("width", d.width + 18).attr("height", d.height + 4), u.attr("transform", "translate(" + (-d.width - 14 - (n.rotateCommitLabel === !0 ? 30 : 0)) + ", " + (a - d.height / 2 - 1) + ")"), J === "TB" ? (l.attr("x", a - d.width / 2 - 10).attr("y", 0), u.attr("transform", "translate(" + (a - d.width / 2 - 5) + ", 0)")) : J === "BT" ? (l.attr("x", a - d.width / 2 - 10).attr("y", q), u.attr("transform", "translate(" + (a - d.width / 2 - 5) + ", " + q + ")")) : l.attr("transform", "translate(-19, " + (a - d.height / 2) + ")");
|
|
535
|
+
});
|
|
536
|
+
}, "drawBranches"), Ae = /* @__PURE__ */ i(function(e, t, n, r, i) {
|
|
537
|
+
return H.set(e, {
|
|
538
|
+
pos: t,
|
|
539
|
+
index: n
|
|
540
|
+
}), t += 50 + (i ? 40 : 0) + (J === "TB" || J === "BT" ? r.width / 2 : 0), t;
|
|
541
|
+
}, "setBranchPosition"), je = {
|
|
542
|
+
parser: I,
|
|
543
|
+
db: O,
|
|
544
|
+
renderer: { draw: /* @__PURE__ */ i(function(t, n, i, o) {
|
|
545
|
+
me(), r.debug("in gitgraph renderer", t + "\n", "id:", n, i);
|
|
546
|
+
let s = o.db;
|
|
547
|
+
if (!s.getConfig) {
|
|
548
|
+
r.error("getConfig method is not available on db");
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
let c = s.getConfig(), l = c.rotateCommitLabel ?? !1;
|
|
552
|
+
G = s.getCommits();
|
|
553
|
+
let u = s.getBranchesAsObjArray();
|
|
554
|
+
J = s.getDirection();
|
|
555
|
+
let d = a(`[id="${n}"]`), f = 0;
|
|
556
|
+
u.forEach((e, t) => {
|
|
557
|
+
let n = Y(e.name), r = d.append("g"), i = r.insert("g").attr("class", "branchLabel"), a = i.insert("g").attr("class", "label branch-label");
|
|
558
|
+
a.node()?.appendChild(n);
|
|
559
|
+
let o = n.getBBox();
|
|
560
|
+
f = Ae(e.name, f, t, o, l), a.remove(), i.remove(), r.remove();
|
|
561
|
+
}), Q(d, G, !1, c), c.showBranches && ke(d, u, c), Oe(d, G), Q(d, G, !0, c), e.insertTitle(d, "gitTitleText", c.titleTopMargin ?? 0, s.getDiagramTitle()), ee(void 0, d, c.diagramPadding, c.useMaxWidth);
|
|
562
|
+
}, "draw") },
|
|
563
|
+
styles: /* @__PURE__ */ i((e) => `
|
|
564
|
+
.commit-id,
|
|
565
|
+
.commit-msg,
|
|
566
|
+
.branch-label {
|
|
567
|
+
fill: lightgrey;
|
|
568
|
+
color: lightgrey;
|
|
569
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
570
|
+
font-family: var(--mermaid-font-family);
|
|
571
|
+
}
|
|
572
|
+
${[
|
|
573
|
+
0,
|
|
574
|
+
1,
|
|
575
|
+
2,
|
|
576
|
+
3,
|
|
577
|
+
4,
|
|
578
|
+
5,
|
|
579
|
+
6,
|
|
580
|
+
7
|
|
581
|
+
].map((t) => `
|
|
582
|
+
.branch-label${t} { fill: ${e["gitBranchLabel" + t]}; }
|
|
583
|
+
.commit${t} { stroke: ${e["git" + t]}; fill: ${e["git" + t]}; }
|
|
584
|
+
.commit-highlight${t} { stroke: ${e["gitInv" + t]}; fill: ${e["gitInv" + t]}; }
|
|
585
|
+
.label${t} { fill: ${e["git" + t]}; }
|
|
586
|
+
.arrow${t} { stroke: ${e["git" + t]}; }
|
|
587
|
+
`).join("\n")}
|
|
588
|
+
|
|
589
|
+
.branch {
|
|
590
|
+
stroke-width: 1;
|
|
591
|
+
stroke: ${e.lineColor};
|
|
592
|
+
stroke-dasharray: 2;
|
|
593
|
+
}
|
|
594
|
+
.commit-label { font-size: ${e.commitLabelFontSize}; fill: ${e.commitLabelColor};}
|
|
595
|
+
.commit-label-bkg { font-size: ${e.commitLabelFontSize}; fill: ${e.commitLabelBackground}; opacity: 0.5; }
|
|
596
|
+
.tag-label { font-size: ${e.tagLabelFontSize}; fill: ${e.tagLabelColor};}
|
|
597
|
+
.tag-label-bkg { fill: ${e.tagLabelBackground}; stroke: ${e.tagLabelBorder}; }
|
|
598
|
+
.tag-hole { fill: ${e.textColor}; }
|
|
599
|
+
|
|
600
|
+
.commit-merge {
|
|
601
|
+
stroke: ${e.primaryColor};
|
|
602
|
+
fill: ${e.primaryColor};
|
|
603
|
+
}
|
|
604
|
+
.commit-reverse {
|
|
605
|
+
stroke: ${e.primaryColor};
|
|
606
|
+
fill: ${e.primaryColor};
|
|
607
|
+
stroke-width: 3;
|
|
608
|
+
}
|
|
609
|
+
.commit-highlight-outer {
|
|
610
|
+
}
|
|
611
|
+
.commit-highlight-inner {
|
|
612
|
+
stroke: ${e.primaryColor};
|
|
613
|
+
fill: ${e.primaryColor};
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
|
|
617
|
+
.gitTitleText {
|
|
618
|
+
text-anchor: middle;
|
|
619
|
+
font-size: 18px;
|
|
620
|
+
fill: ${e.textColor};
|
|
621
|
+
}
|
|
622
|
+
`, "getStyles")
|
|
623
|
+
};
|
|
624
|
+
//#endregion
|
|
625
|
+
export { je as diagram };
|