@webskill/sdk 0.21.0 → 0.22.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/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
- package/dist/agent.d.ts +3 -3
- package/dist/agent.js +1012 -130
- package/dist/{approval-DwN2o2QG.js → approval-DWQlDPbY.js} +102 -16
- package/dist/arc-8U_6NQWm.js +130 -0
- package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
- package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
- package/dist/array-DQfpQNY8.js +8 -0
- package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
- package/dist/browser.d.ts +444 -48
- package/dist/browser.js +1771 -91
- package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
- package/dist/channel-CZxxLrG7.js +9 -0
- package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
- package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
- package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
- package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
- package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
- package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
- package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
- package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
- package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
- package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
- package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
- package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
- package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
- package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
- package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
- package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
- package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
- package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
- package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
- package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
- package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
- package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
- package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
- package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
- package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
- package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
- package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
- package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
- package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
- package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
- package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
- package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
- package/dist/defaultLocale-B_EoOkSF.js +249 -0
- package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
- package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
- package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
- package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
- package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
- package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
- package/dist/dist-UajCDt3n.js +92 -0
- package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
- package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
- package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
- package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
- package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
- package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
- package/dist/{toolSource-C9oNuKmr.js → geometry-wx5ZTYzi.js} +162 -12
- package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
- package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
- package/dist/governance.d.ts +3 -3
- package/dist/graphlib-tk9gQYuN.js +4194 -0
- package/dist/{index-B8Tgmpwh.d.ts → index-BiO9_XRk.d.ts} +2 -2
- package/dist/{index-CYLt5u4L.d.ts → index-CjwdZQOS.d.ts} +700 -12
- package/dist/{index-DHopiH_m.d.ts → index-YPd8ZSEa.d.ts} +156 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
- package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
- package/dist/init-CMOIWdg-.js +16 -0
- package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
- package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
- package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
- package/dist/katex-BcRRvyh_.js +26465 -0
- package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
- package/dist/line-LgV8iVMV.js +48 -0
- package/dist/linear-BWKR0Tqd.js +393 -0
- package/dist/linkedDocument-CIuh_Yp0.js +416 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
- package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
- package/dist/mermaid.core-DMtwGCHy.js +1756 -0
- package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +2 -2
- package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
- package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
- package/dist/ordinal-CxA6GHQS.js +84 -0
- package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
- package/dist/path-C27Z2Bjv.js +106 -0
- package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
- package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
- package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
- package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
- package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
- package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
- package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
- package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
- package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
- package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
- package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
- package/dist/rough.cjs-AmDd_NQk.js +1395 -0
- package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
- package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
- package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
- package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-B24Jjjry-BY1H7Krp.d.ts} +1 -1
- package/dist/src-NkhI3UMl.js +2653 -0
- package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
- package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
- package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
- package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
- package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
- package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BM5FI9oN.d.ts} +59 -8
- package/dist/ui-react.d.ts +3 -3
- package/dist/ui-react.js +3718 -77
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
- package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
- package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
- package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
- package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-Dy-Zjv0y.js} +1 -1
- package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
- package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
- package/package.json +1 -1
- package/dist/linkedDocument-C0gj1sMq.js +0 -245
|
@@ -0,0 +1,1153 @@
|
|
|
1
|
+
import { n as parse } from "./mermaid-parser.core-pYR5siSx.js";
|
|
2
|
+
import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
|
|
3
|
+
import { m as log, p as select_default } from "./src-NkhI3UMl.js";
|
|
4
|
+
import { H as setAccDescription, U as setAccTitle, X as setupGraphViewbox2, a as clear, b as getConfig, f as defaultConfig_default, q as setDiagramTitle, s as common_default, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-O7XYJQB3-B6K0KOSL.js";
|
|
5
|
+
import { g as utils_default, i as cleanAndMerge, m as random } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
|
|
6
|
+
import { t as populateCommonDb } from "./chunk-JWPE2WC7-D1rC79GS.js";
|
|
7
|
+
import { t as ImperativeState } from "./chunk-2Q5K7J3B-Ck03gkFR.js";
|
|
8
|
+
|
|
9
|
+
//#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-X574FWY7.mjs
|
|
10
|
+
var commitType = {
|
|
11
|
+
NORMAL: 0,
|
|
12
|
+
REVERSE: 1,
|
|
13
|
+
HIGHLIGHT: 2,
|
|
14
|
+
MERGE: 3,
|
|
15
|
+
CHERRY_PICK: 4
|
|
16
|
+
};
|
|
17
|
+
var DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph;
|
|
18
|
+
var getConfig3 = /* @__PURE__ */ __name(() => {
|
|
19
|
+
return cleanAndMerge({
|
|
20
|
+
...DEFAULT_GITGRAPH_CONFIG,
|
|
21
|
+
...getConfig().gitGraph
|
|
22
|
+
});
|
|
23
|
+
}, "getConfig");
|
|
24
|
+
var state = new ImperativeState(() => {
|
|
25
|
+
const config = getConfig3();
|
|
26
|
+
const mainBranchName = config.mainBranchName;
|
|
27
|
+
const mainBranchOrder = config.mainBranchOrder;
|
|
28
|
+
return {
|
|
29
|
+
mainBranchName,
|
|
30
|
+
commits: /* @__PURE__ */ new Map(),
|
|
31
|
+
head: null,
|
|
32
|
+
branchConfig: /* @__PURE__ */ new Map([[mainBranchName, {
|
|
33
|
+
name: mainBranchName,
|
|
34
|
+
order: mainBranchOrder
|
|
35
|
+
}]]),
|
|
36
|
+
branches: /* @__PURE__ */ new Map([[mainBranchName, null]]),
|
|
37
|
+
currBranch: mainBranchName,
|
|
38
|
+
direction: "LR",
|
|
39
|
+
seq: 0,
|
|
40
|
+
options: {}
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
function getID() {
|
|
44
|
+
return random({ length: 7 });
|
|
45
|
+
}
|
|
46
|
+
__name(getID, "getID");
|
|
47
|
+
function uniqBy(list, fn) {
|
|
48
|
+
const recordMap = /* @__PURE__ */ Object.create(null);
|
|
49
|
+
return list.reduce((out, item) => {
|
|
50
|
+
const key = fn(item);
|
|
51
|
+
if (!recordMap[key]) {
|
|
52
|
+
recordMap[key] = true;
|
|
53
|
+
out.push(item);
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}, []);
|
|
57
|
+
}
|
|
58
|
+
__name(uniqBy, "uniqBy");
|
|
59
|
+
var setDirection = /* @__PURE__ */ __name(function(dir2) {
|
|
60
|
+
state.records.direction = dir2;
|
|
61
|
+
}, "setDirection");
|
|
62
|
+
var setOptions = /* @__PURE__ */ __name(function(rawOptString) {
|
|
63
|
+
log.debug("options str", rawOptString);
|
|
64
|
+
rawOptString = rawOptString?.trim();
|
|
65
|
+
rawOptString = rawOptString || "{}";
|
|
66
|
+
try {
|
|
67
|
+
state.records.options = JSON.parse(rawOptString);
|
|
68
|
+
} catch (e) {
|
|
69
|
+
log.error("error while parsing gitGraph options", e.message);
|
|
70
|
+
}
|
|
71
|
+
}, "setOptions");
|
|
72
|
+
var getOptions = /* @__PURE__ */ __name(function() {
|
|
73
|
+
return state.records.options;
|
|
74
|
+
}, "getOptions");
|
|
75
|
+
var commit = /* @__PURE__ */ __name(function(commitDB) {
|
|
76
|
+
let msg = commitDB.msg;
|
|
77
|
+
let id = commitDB.id;
|
|
78
|
+
const type = commitDB.type;
|
|
79
|
+
let tags = commitDB.tags;
|
|
80
|
+
log.info("commit", msg, id, type, tags);
|
|
81
|
+
log.debug("Entering commit:", msg, id, type, tags);
|
|
82
|
+
const config = getConfig3();
|
|
83
|
+
id = common_default.sanitizeText(id, config);
|
|
84
|
+
msg = common_default.sanitizeText(msg, config);
|
|
85
|
+
tags = tags?.map((tag) => common_default.sanitizeText(tag, config));
|
|
86
|
+
const newCommit = {
|
|
87
|
+
id: id ? id : state.records.seq + "-" + getID(),
|
|
88
|
+
message: msg,
|
|
89
|
+
seq: state.records.seq++,
|
|
90
|
+
type: type ?? commitType.NORMAL,
|
|
91
|
+
tags: tags ?? [],
|
|
92
|
+
parents: state.records.head == null ? [] : [state.records.head.id],
|
|
93
|
+
branch: state.records.currBranch
|
|
94
|
+
};
|
|
95
|
+
state.records.head = newCommit;
|
|
96
|
+
log.info("main branch", config.mainBranchName);
|
|
97
|
+
if (state.records.commits.has(newCommit.id)) log.warn(`Commit ID ${newCommit.id} already exists`);
|
|
98
|
+
state.records.commits.set(newCommit.id, newCommit);
|
|
99
|
+
state.records.branches.set(state.records.currBranch, newCommit.id);
|
|
100
|
+
log.debug("in pushCommit " + newCommit.id);
|
|
101
|
+
}, "commit");
|
|
102
|
+
var branch = /* @__PURE__ */ __name(function(branchDB) {
|
|
103
|
+
let name = branchDB.name;
|
|
104
|
+
const order = branchDB.order;
|
|
105
|
+
name = common_default.sanitizeText(name, getConfig3());
|
|
106
|
+
if (state.records.branches.has(name)) throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")`);
|
|
107
|
+
state.records.branches.set(name, state.records.head != null ? state.records.head.id : null);
|
|
108
|
+
state.records.branchConfig.set(name, {
|
|
109
|
+
name,
|
|
110
|
+
order
|
|
111
|
+
});
|
|
112
|
+
checkout(name);
|
|
113
|
+
log.debug("in createBranch");
|
|
114
|
+
}, "branch");
|
|
115
|
+
var merge = /* @__PURE__ */ __name((mergeDB) => {
|
|
116
|
+
let otherBranch = mergeDB.branch;
|
|
117
|
+
let customId = mergeDB.id;
|
|
118
|
+
const overrideType = mergeDB.type;
|
|
119
|
+
const customTags = mergeDB.tags;
|
|
120
|
+
const config = getConfig3();
|
|
121
|
+
otherBranch = common_default.sanitizeText(otherBranch, config);
|
|
122
|
+
if (customId) customId = common_default.sanitizeText(customId, config);
|
|
123
|
+
const currentBranchCheck = state.records.branches.get(state.records.currBranch);
|
|
124
|
+
const otherBranchCheck = state.records.branches.get(otherBranch);
|
|
125
|
+
const currentCommit = currentBranchCheck ? state.records.commits.get(currentBranchCheck) : void 0;
|
|
126
|
+
const otherCommit = otherBranchCheck ? state.records.commits.get(otherBranchCheck) : void 0;
|
|
127
|
+
if (currentCommit && otherCommit && currentCommit.branch === otherBranch) throw new Error(`Cannot merge branch '${otherBranch}' into itself.`);
|
|
128
|
+
if (state.records.currBranch === otherBranch) {
|
|
129
|
+
const error = /* @__PURE__ */ new Error("Incorrect usage of \"merge\". Cannot merge a branch to itself");
|
|
130
|
+
error.hash = {
|
|
131
|
+
text: `merge ${otherBranch}`,
|
|
132
|
+
token: `merge ${otherBranch}`,
|
|
133
|
+
expected: ["branch abc"]
|
|
134
|
+
};
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
if (currentCommit === void 0 || !currentCommit) {
|
|
138
|
+
const error = /* @__PURE__ */ new Error(`Incorrect usage of "merge". Current branch (${state.records.currBranch})has no commits`);
|
|
139
|
+
error.hash = {
|
|
140
|
+
text: `merge ${otherBranch}`,
|
|
141
|
+
token: `merge ${otherBranch}`,
|
|
142
|
+
expected: ["commit"]
|
|
143
|
+
};
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
if (!state.records.branches.has(otherBranch)) {
|
|
147
|
+
const error = /* @__PURE__ */ new Error("Incorrect usage of \"merge\". Branch to be merged (" + otherBranch + ") does not exist");
|
|
148
|
+
error.hash = {
|
|
149
|
+
text: `merge ${otherBranch}`,
|
|
150
|
+
token: `merge ${otherBranch}`,
|
|
151
|
+
expected: [`branch ${otherBranch}`]
|
|
152
|
+
};
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
if (otherCommit === void 0 || !otherCommit) {
|
|
156
|
+
const error = /* @__PURE__ */ new Error("Incorrect usage of \"merge\". Branch to be merged (" + otherBranch + ") has no commits");
|
|
157
|
+
error.hash = {
|
|
158
|
+
text: `merge ${otherBranch}`,
|
|
159
|
+
token: `merge ${otherBranch}`,
|
|
160
|
+
expected: ["\"commit\""]
|
|
161
|
+
};
|
|
162
|
+
throw error;
|
|
163
|
+
}
|
|
164
|
+
if (currentCommit === otherCommit) {
|
|
165
|
+
const error = /* @__PURE__ */ new Error("Incorrect usage of \"merge\". Both branches have same head");
|
|
166
|
+
error.hash = {
|
|
167
|
+
text: `merge ${otherBranch}`,
|
|
168
|
+
token: `merge ${otherBranch}`,
|
|
169
|
+
expected: ["branch abc"]
|
|
170
|
+
};
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
if (customId && state.records.commits.has(customId)) {
|
|
174
|
+
const error = /* @__PURE__ */ new Error("Incorrect usage of \"merge\". Commit with id:" + customId + " already exists, use different custom id");
|
|
175
|
+
error.hash = {
|
|
176
|
+
text: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
|
|
177
|
+
token: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
|
|
178
|
+
expected: [`merge ${otherBranch} ${customId}_UNIQUE ${overrideType} ${customTags?.join(" ")}`]
|
|
179
|
+
};
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
const verifiedBranch = otherBranchCheck ? otherBranchCheck : "";
|
|
183
|
+
const commit2 = {
|
|
184
|
+
id: customId || `${state.records.seq}-${getID()}`,
|
|
185
|
+
message: `merged branch ${otherBranch} into ${state.records.currBranch}`,
|
|
186
|
+
seq: state.records.seq++,
|
|
187
|
+
parents: state.records.head == null ? [] : [state.records.head.id, verifiedBranch],
|
|
188
|
+
branch: state.records.currBranch,
|
|
189
|
+
type: commitType.MERGE,
|
|
190
|
+
customType: overrideType,
|
|
191
|
+
customId: customId ? true : false,
|
|
192
|
+
tags: customTags ?? []
|
|
193
|
+
};
|
|
194
|
+
state.records.head = commit2;
|
|
195
|
+
state.records.commits.set(commit2.id, commit2);
|
|
196
|
+
state.records.branches.set(state.records.currBranch, commit2.id);
|
|
197
|
+
log.debug(state.records.branches);
|
|
198
|
+
log.debug("in mergeBranch");
|
|
199
|
+
}, "merge");
|
|
200
|
+
var cherryPick = /* @__PURE__ */ __name(function(cherryPickDB) {
|
|
201
|
+
let sourceId = cherryPickDB.id;
|
|
202
|
+
let targetId = cherryPickDB.targetId;
|
|
203
|
+
let tags = cherryPickDB.tags;
|
|
204
|
+
let parentCommitId = cherryPickDB.parent;
|
|
205
|
+
log.debug("Entering cherryPick:", sourceId, targetId, tags);
|
|
206
|
+
const config = getConfig3();
|
|
207
|
+
sourceId = common_default.sanitizeText(sourceId, config);
|
|
208
|
+
targetId = common_default.sanitizeText(targetId, config);
|
|
209
|
+
tags = tags?.map((tag) => common_default.sanitizeText(tag, config));
|
|
210
|
+
parentCommitId = common_default.sanitizeText(parentCommitId, config);
|
|
211
|
+
if (!sourceId || !state.records.commits.has(sourceId)) {
|
|
212
|
+
const error = /* @__PURE__ */ new Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
|
|
213
|
+
error.hash = {
|
|
214
|
+
text: `cherryPick ${sourceId} ${targetId}`,
|
|
215
|
+
token: `cherryPick ${sourceId} ${targetId}`,
|
|
216
|
+
expected: ["cherry-pick abc"]
|
|
217
|
+
};
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
const sourceCommit = state.records.commits.get(sourceId);
|
|
221
|
+
if (sourceCommit === void 0 || !sourceCommit) throw new Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
|
|
222
|
+
if (parentCommitId && !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) throw /* @__PURE__ */ new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");
|
|
223
|
+
const sourceCommitBranch = sourceCommit.branch;
|
|
224
|
+
if (sourceCommit.type === commitType.MERGE && !parentCommitId) throw /* @__PURE__ */ new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");
|
|
225
|
+
if (!targetId || !state.records.commits.has(targetId)) {
|
|
226
|
+
if (sourceCommitBranch === state.records.currBranch) {
|
|
227
|
+
const error = /* @__PURE__ */ new Error("Incorrect usage of \"cherryPick\". Source commit is already on current branch");
|
|
228
|
+
error.hash = {
|
|
229
|
+
text: `cherryPick ${sourceId} ${targetId}`,
|
|
230
|
+
token: `cherryPick ${sourceId} ${targetId}`,
|
|
231
|
+
expected: ["cherry-pick abc"]
|
|
232
|
+
};
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
235
|
+
const currentCommitId = state.records.branches.get(state.records.currBranch);
|
|
236
|
+
if (currentCommitId === void 0 || !currentCommitId) {
|
|
237
|
+
const error = /* @__PURE__ */ new Error(`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`);
|
|
238
|
+
error.hash = {
|
|
239
|
+
text: `cherryPick ${sourceId} ${targetId}`,
|
|
240
|
+
token: `cherryPick ${sourceId} ${targetId}`,
|
|
241
|
+
expected: ["cherry-pick abc"]
|
|
242
|
+
};
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
const currentCommit = state.records.commits.get(currentCommitId);
|
|
246
|
+
if (currentCommit === void 0 || !currentCommit) {
|
|
247
|
+
const error = /* @__PURE__ */ new Error(`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`);
|
|
248
|
+
error.hash = {
|
|
249
|
+
text: `cherryPick ${sourceId} ${targetId}`,
|
|
250
|
+
token: `cherryPick ${sourceId} ${targetId}`,
|
|
251
|
+
expected: ["cherry-pick abc"]
|
|
252
|
+
};
|
|
253
|
+
throw error;
|
|
254
|
+
}
|
|
255
|
+
const commit2 = {
|
|
256
|
+
id: state.records.seq + "-" + getID(),
|
|
257
|
+
message: `cherry-picked ${sourceCommit?.message} into ${state.records.currBranch}`,
|
|
258
|
+
seq: state.records.seq++,
|
|
259
|
+
parents: state.records.head == null ? [] : [state.records.head.id, sourceCommit.id],
|
|
260
|
+
branch: state.records.currBranch,
|
|
261
|
+
type: commitType.CHERRY_PICK,
|
|
262
|
+
tags: tags ? tags.filter(Boolean) : [`cherry-pick:${sourceCommit.id}${sourceCommit.type === commitType.MERGE ? `|parent:${parentCommitId}` : ""}`]
|
|
263
|
+
};
|
|
264
|
+
state.records.head = commit2;
|
|
265
|
+
state.records.commits.set(commit2.id, commit2);
|
|
266
|
+
state.records.branches.set(state.records.currBranch, commit2.id);
|
|
267
|
+
log.debug(state.records.branches);
|
|
268
|
+
log.debug("in cherryPick");
|
|
269
|
+
}
|
|
270
|
+
}, "cherryPick");
|
|
271
|
+
var checkout = /* @__PURE__ */ __name(function(branch2) {
|
|
272
|
+
branch2 = common_default.sanitizeText(branch2, getConfig3());
|
|
273
|
+
if (!state.records.branches.has(branch2)) {
|
|
274
|
+
const error = /* @__PURE__ */ new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${branch2}")`);
|
|
275
|
+
error.hash = {
|
|
276
|
+
text: `checkout ${branch2}`,
|
|
277
|
+
token: `checkout ${branch2}`,
|
|
278
|
+
expected: [`branch ${branch2}`]
|
|
279
|
+
};
|
|
280
|
+
throw error;
|
|
281
|
+
} else {
|
|
282
|
+
state.records.currBranch = branch2;
|
|
283
|
+
const id = state.records.branches.get(state.records.currBranch);
|
|
284
|
+
if (id === void 0 || !id) state.records.head = null;
|
|
285
|
+
else state.records.head = state.records.commits.get(id) ?? null;
|
|
286
|
+
}
|
|
287
|
+
}, "checkout");
|
|
288
|
+
function upsert(arr, key, newVal) {
|
|
289
|
+
const index = arr.indexOf(key);
|
|
290
|
+
if (index === -1) arr.push(newVal);
|
|
291
|
+
else arr.splice(index, 1, newVal);
|
|
292
|
+
}
|
|
293
|
+
__name(upsert, "upsert");
|
|
294
|
+
function prettyPrintCommitHistory(commitArr) {
|
|
295
|
+
const commit2 = commitArr.reduce((out, commit3) => {
|
|
296
|
+
if (out.seq > commit3.seq) return out;
|
|
297
|
+
return commit3;
|
|
298
|
+
}, commitArr[0]);
|
|
299
|
+
let line = "";
|
|
300
|
+
commitArr.forEach(function(c) {
|
|
301
|
+
if (c === commit2) line += " *";
|
|
302
|
+
else line += " |";
|
|
303
|
+
});
|
|
304
|
+
const label = [
|
|
305
|
+
line,
|
|
306
|
+
commit2.id,
|
|
307
|
+
commit2.seq
|
|
308
|
+
];
|
|
309
|
+
for (const branch2 in state.records.branches) if (state.records.branches.get(branch2) === commit2.id) label.push(branch2);
|
|
310
|
+
log.debug(label.join(" "));
|
|
311
|
+
if (commit2.parents && commit2.parents.length == 2 && commit2.parents[0] && commit2.parents[1]) {
|
|
312
|
+
const newCommit = state.records.commits.get(commit2.parents[0]);
|
|
313
|
+
upsert(commitArr, commit2, newCommit);
|
|
314
|
+
if (commit2.parents[1]) commitArr.push(state.records.commits.get(commit2.parents[1]));
|
|
315
|
+
} else if (commit2.parents.length == 0) return;
|
|
316
|
+
else if (commit2.parents[0]) {
|
|
317
|
+
const newCommit = state.records.commits.get(commit2.parents[0]);
|
|
318
|
+
upsert(commitArr, commit2, newCommit);
|
|
319
|
+
}
|
|
320
|
+
commitArr = uniqBy(commitArr, (c) => c.id);
|
|
321
|
+
prettyPrintCommitHistory(commitArr);
|
|
322
|
+
}
|
|
323
|
+
__name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
|
|
324
|
+
var prettyPrint = /* @__PURE__ */ __name(function() {
|
|
325
|
+
log.debug(state.records.commits);
|
|
326
|
+
const node = getCommitsArray()[0];
|
|
327
|
+
prettyPrintCommitHistory([node]);
|
|
328
|
+
}, "prettyPrint");
|
|
329
|
+
var clear2 = /* @__PURE__ */ __name(function() {
|
|
330
|
+
state.reset();
|
|
331
|
+
clear();
|
|
332
|
+
}, "clear");
|
|
333
|
+
var getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
|
|
334
|
+
return [...state.records.branchConfig.values()].map((branchConfig, i) => {
|
|
335
|
+
if (branchConfig.order !== null && branchConfig.order !== void 0) return branchConfig;
|
|
336
|
+
return {
|
|
337
|
+
...branchConfig,
|
|
338
|
+
order: parseFloat(`0.${i}`)
|
|
339
|
+
};
|
|
340
|
+
}).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map(({ name }) => ({ name }));
|
|
341
|
+
}, "getBranchesAsObjArray");
|
|
342
|
+
var getBranches = /* @__PURE__ */ __name(function() {
|
|
343
|
+
return state.records.branches;
|
|
344
|
+
}, "getBranches");
|
|
345
|
+
var getCommits = /* @__PURE__ */ __name(function() {
|
|
346
|
+
return state.records.commits;
|
|
347
|
+
}, "getCommits");
|
|
348
|
+
var getCommitsArray = /* @__PURE__ */ __name(function() {
|
|
349
|
+
const commitArr = [...state.records.commits.values()];
|
|
350
|
+
commitArr.forEach(function(o) {
|
|
351
|
+
log.debug(o.id);
|
|
352
|
+
});
|
|
353
|
+
commitArr.sort((a, b) => a.seq - b.seq);
|
|
354
|
+
return commitArr;
|
|
355
|
+
}, "getCommitsArray");
|
|
356
|
+
var db = {
|
|
357
|
+
commitType,
|
|
358
|
+
getConfig: getConfig3,
|
|
359
|
+
setDirection,
|
|
360
|
+
setOptions,
|
|
361
|
+
getOptions,
|
|
362
|
+
commit,
|
|
363
|
+
branch,
|
|
364
|
+
merge,
|
|
365
|
+
cherryPick,
|
|
366
|
+
checkout,
|
|
367
|
+
prettyPrint,
|
|
368
|
+
clear: clear2,
|
|
369
|
+
getBranchesAsObjArray,
|
|
370
|
+
getBranches,
|
|
371
|
+
getCommits,
|
|
372
|
+
getCommitsArray,
|
|
373
|
+
getCurrentBranch: /* @__PURE__ */ __name(function() {
|
|
374
|
+
return state.records.currBranch;
|
|
375
|
+
}, "getCurrentBranch"),
|
|
376
|
+
getDirection: /* @__PURE__ */ __name(function() {
|
|
377
|
+
return state.records.direction;
|
|
378
|
+
}, "getDirection"),
|
|
379
|
+
getHead: /* @__PURE__ */ __name(function() {
|
|
380
|
+
return state.records.head;
|
|
381
|
+
}, "getHead"),
|
|
382
|
+
setAccTitle,
|
|
383
|
+
getAccTitle,
|
|
384
|
+
getAccDescription,
|
|
385
|
+
setAccDescription,
|
|
386
|
+
setDiagramTitle,
|
|
387
|
+
getDiagramTitle
|
|
388
|
+
};
|
|
389
|
+
var populate = /* @__PURE__ */ __name((ast, db2) => {
|
|
390
|
+
populateCommonDb(ast, db2);
|
|
391
|
+
if (ast.dir) db2.setDirection(ast.dir);
|
|
392
|
+
for (const statement of ast.statements) parseStatement(statement, db2);
|
|
393
|
+
}, "populate");
|
|
394
|
+
var parseStatement = /* @__PURE__ */ __name((statement, db2) => {
|
|
395
|
+
const parser2 = {
|
|
396
|
+
Commit: /* @__PURE__ */ __name((stmt) => db2.commit(parseCommit(stmt)), "Commit"),
|
|
397
|
+
Branch: /* @__PURE__ */ __name((stmt) => db2.branch(parseBranch(stmt)), "Branch"),
|
|
398
|
+
Merge: /* @__PURE__ */ __name((stmt) => db2.merge(parseMerge(stmt)), "Merge"),
|
|
399
|
+
Checkout: /* @__PURE__ */ __name((stmt) => db2.checkout(parseCheckout(stmt)), "Checkout"),
|
|
400
|
+
CherryPicking: /* @__PURE__ */ __name((stmt) => db2.cherryPick(parseCherryPicking(stmt)), "CherryPicking")
|
|
401
|
+
}[statement.$type];
|
|
402
|
+
if (parser2) parser2(statement);
|
|
403
|
+
else log.error(`Unknown statement type: ${statement.$type}`);
|
|
404
|
+
}, "parseStatement");
|
|
405
|
+
var parseCommit = /* @__PURE__ */ __name((commit2) => {
|
|
406
|
+
return {
|
|
407
|
+
id: commit2.id,
|
|
408
|
+
msg: commit2.message ?? "",
|
|
409
|
+
type: commit2.type !== void 0 ? commitType[commit2.type] : commitType.NORMAL,
|
|
410
|
+
tags: commit2.tags ?? void 0
|
|
411
|
+
};
|
|
412
|
+
}, "parseCommit");
|
|
413
|
+
var parseBranch = /* @__PURE__ */ __name((branch2) => {
|
|
414
|
+
return {
|
|
415
|
+
name: branch2.name,
|
|
416
|
+
order: branch2.order ?? 0
|
|
417
|
+
};
|
|
418
|
+
}, "parseBranch");
|
|
419
|
+
var parseMerge = /* @__PURE__ */ __name((merge2) => {
|
|
420
|
+
return {
|
|
421
|
+
branch: merge2.branch,
|
|
422
|
+
id: merge2.id ?? "",
|
|
423
|
+
type: merge2.type !== void 0 ? commitType[merge2.type] : void 0,
|
|
424
|
+
tags: merge2.tags ?? void 0
|
|
425
|
+
};
|
|
426
|
+
}, "parseMerge");
|
|
427
|
+
var parseCheckout = /* @__PURE__ */ __name((checkout2) => {
|
|
428
|
+
return checkout2.branch;
|
|
429
|
+
}, "parseCheckout");
|
|
430
|
+
var parseCherryPicking = /* @__PURE__ */ __name((cherryPicking) => {
|
|
431
|
+
return {
|
|
432
|
+
id: cherryPicking.id,
|
|
433
|
+
targetId: "",
|
|
434
|
+
tags: cherryPicking.tags?.length === 0 ? void 0 : cherryPicking.tags,
|
|
435
|
+
parent: cherryPicking.parent
|
|
436
|
+
};
|
|
437
|
+
}, "parseCherryPicking");
|
|
438
|
+
var parser = { parse: /* @__PURE__ */ __name(async (input) => {
|
|
439
|
+
const ast = await parse("gitGraph", input);
|
|
440
|
+
log.debug(ast);
|
|
441
|
+
populate(ast, db);
|
|
442
|
+
}, "parse") };
|
|
443
|
+
var LAYOUT_OFFSET = 10;
|
|
444
|
+
var COMMIT_STEP = 40;
|
|
445
|
+
var PX = 4;
|
|
446
|
+
var PY = 2;
|
|
447
|
+
var THEME_COLOR_LIMIT = 8;
|
|
448
|
+
var REDUX_GEOMETRY_THEMES = /* @__PURE__ */ new Set([
|
|
449
|
+
"redux",
|
|
450
|
+
"redux-dark",
|
|
451
|
+
"redux-color",
|
|
452
|
+
"redux-dark-color"
|
|
453
|
+
]);
|
|
454
|
+
var REDUX_BRANCH_LABEL_PADDING_Y = 12;
|
|
455
|
+
var COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
|
|
456
|
+
var DARK_THEMES = /* @__PURE__ */ new Set([
|
|
457
|
+
"dark",
|
|
458
|
+
"redux-dark",
|
|
459
|
+
"redux-dark-color",
|
|
460
|
+
"neo-dark"
|
|
461
|
+
]);
|
|
462
|
+
var calcColorIndex = /* @__PURE__ */ __name((rawIndex, limit, avoidDefaultColor = false) => {
|
|
463
|
+
if (avoidDefaultColor && rawIndex > 0) return (rawIndex - 1) % (limit - 1) + 1;
|
|
464
|
+
return rawIndex % limit;
|
|
465
|
+
}, "calcColorIndex");
|
|
466
|
+
var branchPos = /* @__PURE__ */ new Map();
|
|
467
|
+
var commitPos = /* @__PURE__ */ new Map();
|
|
468
|
+
var defaultPos = 30;
|
|
469
|
+
var allCommitsDict = /* @__PURE__ */ new Map();
|
|
470
|
+
var lanes = [];
|
|
471
|
+
var maxPos = 0;
|
|
472
|
+
var dir = "LR";
|
|
473
|
+
var clear3 = /* @__PURE__ */ __name(() => {
|
|
474
|
+
branchPos.clear();
|
|
475
|
+
commitPos.clear();
|
|
476
|
+
allCommitsDict.clear();
|
|
477
|
+
maxPos = 0;
|
|
478
|
+
lanes = [];
|
|
479
|
+
dir = "LR";
|
|
480
|
+
}, "clear");
|
|
481
|
+
var drawText = /* @__PURE__ */ __name((txt) => {
|
|
482
|
+
const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
483
|
+
(typeof txt === "string" ? txt.split(/\\n|\n|<br\s*\/?>/gi) : txt).forEach((row) => {
|
|
484
|
+
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
485
|
+
tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
486
|
+
tspan.setAttribute("dy", "1em");
|
|
487
|
+
tspan.setAttribute("x", "0");
|
|
488
|
+
tspan.setAttribute("class", "row");
|
|
489
|
+
tspan.textContent = row.trim();
|
|
490
|
+
svgLabel.appendChild(tspan);
|
|
491
|
+
});
|
|
492
|
+
return svgLabel;
|
|
493
|
+
}, "drawText");
|
|
494
|
+
var findClosestParent = /* @__PURE__ */ __name((parents) => {
|
|
495
|
+
let closestParent;
|
|
496
|
+
let comparisonFunc;
|
|
497
|
+
let targetPosition;
|
|
498
|
+
if (dir === "BT") {
|
|
499
|
+
comparisonFunc = /* @__PURE__ */ __name((a, b) => a <= b, "comparisonFunc");
|
|
500
|
+
targetPosition = Infinity;
|
|
501
|
+
} else {
|
|
502
|
+
comparisonFunc = /* @__PURE__ */ __name((a, b) => a >= b, "comparisonFunc");
|
|
503
|
+
targetPosition = 0;
|
|
504
|
+
}
|
|
505
|
+
parents.forEach((parent) => {
|
|
506
|
+
const parentPosition = dir === "TB" || dir == "BT" ? commitPos.get(parent)?.y : commitPos.get(parent)?.x;
|
|
507
|
+
if (parentPosition !== void 0 && comparisonFunc(parentPosition, targetPosition)) {
|
|
508
|
+
closestParent = parent;
|
|
509
|
+
targetPosition = parentPosition;
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
return closestParent;
|
|
513
|
+
}, "findClosestParent");
|
|
514
|
+
var findClosestParentBT = /* @__PURE__ */ __name((parents) => {
|
|
515
|
+
let closestParent = "";
|
|
516
|
+
let maxPosition = Infinity;
|
|
517
|
+
parents.forEach((parent) => {
|
|
518
|
+
const parentPosition = commitPos.get(parent).y;
|
|
519
|
+
if (parentPosition <= maxPosition) {
|
|
520
|
+
closestParent = parent;
|
|
521
|
+
maxPosition = parentPosition;
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
return closestParent || void 0;
|
|
525
|
+
}, "findClosestParentBT");
|
|
526
|
+
var setParallelBTPos = /* @__PURE__ */ __name((sortedKeys, commits, defaultPos2) => {
|
|
527
|
+
let curPos = defaultPos2;
|
|
528
|
+
let maxPosition = defaultPos2;
|
|
529
|
+
const roots = [];
|
|
530
|
+
sortedKeys.forEach((key) => {
|
|
531
|
+
const commit2 = commits.get(key);
|
|
532
|
+
if (!commit2) throw new Error(`Commit not found for key ${key}`);
|
|
533
|
+
if (commit2.parents.length) {
|
|
534
|
+
curPos = calculateCommitPosition(commit2);
|
|
535
|
+
maxPosition = Math.max(curPos, maxPosition);
|
|
536
|
+
} else roots.push(commit2);
|
|
537
|
+
setCommitPosition(commit2, curPos);
|
|
538
|
+
});
|
|
539
|
+
curPos = maxPosition;
|
|
540
|
+
roots.forEach((commit2) => {
|
|
541
|
+
setRootPosition(commit2, curPos, defaultPos2);
|
|
542
|
+
});
|
|
543
|
+
sortedKeys.forEach((key) => {
|
|
544
|
+
const commit2 = commits.get(key);
|
|
545
|
+
if (commit2?.parents.length) {
|
|
546
|
+
const closestParent = findClosestParentBT(commit2.parents);
|
|
547
|
+
curPos = commitPos.get(closestParent).y - COMMIT_STEP;
|
|
548
|
+
if (curPos <= maxPosition) maxPosition = curPos;
|
|
549
|
+
const x = branchPos.get(commit2.branch).pos;
|
|
550
|
+
const y = curPos - LAYOUT_OFFSET;
|
|
551
|
+
commitPos.set(commit2.id, {
|
|
552
|
+
x,
|
|
553
|
+
y
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
}, "setParallelBTPos");
|
|
558
|
+
var findClosestParentPos = /* @__PURE__ */ __name((commit2) => {
|
|
559
|
+
const closestParent = findClosestParent(commit2.parents.filter((p) => p !== null));
|
|
560
|
+
if (!closestParent) throw new Error(`Closest parent not found for commit ${commit2.id}`);
|
|
561
|
+
const closestParentPos = commitPos.get(closestParent)?.y;
|
|
562
|
+
if (closestParentPos === void 0) throw new Error(`Closest parent position not found for commit ${commit2.id}`);
|
|
563
|
+
return closestParentPos;
|
|
564
|
+
}, "findClosestParentPos");
|
|
565
|
+
var calculateCommitPosition = /* @__PURE__ */ __name((commit2) => {
|
|
566
|
+
return findClosestParentPos(commit2) + COMMIT_STEP;
|
|
567
|
+
}, "calculateCommitPosition");
|
|
568
|
+
var setCommitPosition = /* @__PURE__ */ __name((commit2, curPos) => {
|
|
569
|
+
const branch2 = branchPos.get(commit2.branch);
|
|
570
|
+
if (!branch2) throw new Error(`Branch not found for commit ${commit2.id}`);
|
|
571
|
+
const x = branch2.pos;
|
|
572
|
+
const y = curPos + LAYOUT_OFFSET;
|
|
573
|
+
commitPos.set(commit2.id, {
|
|
574
|
+
x,
|
|
575
|
+
y
|
|
576
|
+
});
|
|
577
|
+
return {
|
|
578
|
+
x,
|
|
579
|
+
y
|
|
580
|
+
};
|
|
581
|
+
}, "setCommitPosition");
|
|
582
|
+
var setRootPosition = /* @__PURE__ */ __name((commit2, curPos, defaultPos2) => {
|
|
583
|
+
const branch2 = branchPos.get(commit2.branch);
|
|
584
|
+
if (!branch2) throw new Error(`Branch not found for commit ${commit2.id}`);
|
|
585
|
+
const y = curPos + defaultPos2;
|
|
586
|
+
const x = branch2.pos;
|
|
587
|
+
commitPos.set(commit2.id, {
|
|
588
|
+
x,
|
|
589
|
+
y
|
|
590
|
+
});
|
|
591
|
+
}, "setRootPosition");
|
|
592
|
+
var drawCommitBullet = /* @__PURE__ */ __name((gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType) => {
|
|
593
|
+
const { theme } = getConfig2();
|
|
594
|
+
const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(theme ?? "");
|
|
595
|
+
const useColorTheme = COLOR_THEMES.has(theme ?? "");
|
|
596
|
+
const isDark = DARK_THEMES.has(theme ?? "");
|
|
597
|
+
if (commitSymbolType === commitType.HIGHLIGHT) {
|
|
598
|
+
gBullets.append("rect").attr("x", commitPosition.x - 10 + (useReduxGeometry ? 3 : 0)).attr("y", commitPosition.y - 10 + (useReduxGeometry ? 3 : 0)).attr("width", useReduxGeometry ? 14 : 20).attr("height", useReduxGeometry ? 14 : 20).attr("class", `commit ${commit2.id} commit-highlight${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)} ${typeClass}-outer`);
|
|
599
|
+
gBullets.append("rect").attr("x", commitPosition.x - 6 + (useReduxGeometry ? 2 : 0)).attr("y", commitPosition.y - 6 + (useReduxGeometry ? 2 : 0)).attr("width", useReduxGeometry ? 8 : 12).attr("height", useReduxGeometry ? 8 : 12).attr("class", `commit ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)} ${typeClass}-inner`);
|
|
600
|
+
} else if (commitSymbolType === commitType.CHERRY_PICK) {
|
|
601
|
+
gBullets.append("circle").attr("cx", commitPosition.x).attr("cy", commitPosition.y).attr("r", useReduxGeometry ? 7 : 10).attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
602
|
+
gBullets.append("circle").attr("cx", commitPosition.x - 3).attr("cy", commitPosition.y + 2).attr("r", useReduxGeometry ? 2.5 : 2.75).attr("fill", isDark ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
603
|
+
gBullets.append("circle").attr("cx", commitPosition.x + 3).attr("cy", commitPosition.y + 2).attr("r", useReduxGeometry ? 2.5 : 2.75).attr("fill", isDark ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
604
|
+
gBullets.append("line").attr("x1", commitPosition.x + 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", isDark ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
605
|
+
gBullets.append("line").attr("x1", commitPosition.x - 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", isDark ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
606
|
+
} else {
|
|
607
|
+
const circle = gBullets.append("circle");
|
|
608
|
+
circle.attr("cx", commitPosition.x);
|
|
609
|
+
circle.attr("cy", commitPosition.y);
|
|
610
|
+
circle.attr("r", useReduxGeometry ? 7 : 10);
|
|
611
|
+
circle.attr("class", `commit ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`);
|
|
612
|
+
if (commitSymbolType === commitType.MERGE) {
|
|
613
|
+
const circle2 = gBullets.append("circle");
|
|
614
|
+
circle2.attr("cx", commitPosition.x);
|
|
615
|
+
circle2.attr("cy", commitPosition.y);
|
|
616
|
+
circle2.attr("r", useReduxGeometry ? 5 : 6);
|
|
617
|
+
circle2.attr("class", `commit ${typeClass} ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`);
|
|
618
|
+
}
|
|
619
|
+
if (commitSymbolType === commitType.REVERSE) {
|
|
620
|
+
const cross = gBullets.append("path");
|
|
621
|
+
const constValue = useReduxGeometry ? 4 : 5;
|
|
622
|
+
cross.attr("d", `M ${commitPosition.x - constValue},${commitPosition.y - constValue}L${commitPosition.x + constValue},${commitPosition.y + constValue}M${commitPosition.x - constValue},${commitPosition.y + constValue}L${commitPosition.x + constValue},${commitPosition.y - constValue}`).attr("class", `commit ${typeClass} ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}, "drawCommitBullet");
|
|
626
|
+
var drawCommitLabel = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos, gitGraphConfig) => {
|
|
627
|
+
if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && gitGraphConfig.showCommitLabel) {
|
|
628
|
+
const wrapper = gLabels.append("g");
|
|
629
|
+
const labelBkg = wrapper.insert("rect").attr("class", "commit-label-bkg");
|
|
630
|
+
const text = wrapper.append("text").attr("x", pos).attr("y", commitPosition.y + 25).attr("class", "commit-label").text(commit2.id);
|
|
631
|
+
const bbox = text.node()?.getBBox();
|
|
632
|
+
if (bbox) {
|
|
633
|
+
labelBkg.attr("x", commitPosition.posWithOffset - bbox.width / 2 - PY).attr("y", commitPosition.y + 13.5).attr("width", bbox.width + 2 * PY).attr("height", bbox.height + 2 * PY);
|
|
634
|
+
if (dir === "TB" || dir === "BT") {
|
|
635
|
+
labelBkg.attr("x", commitPosition.x - (bbox.width + 4 * PX + 5)).attr("y", commitPosition.y - 12);
|
|
636
|
+
text.attr("x", commitPosition.x - (bbox.width + 4 * PX)).attr("y", commitPosition.y + bbox.height - 12);
|
|
637
|
+
} else text.attr("x", commitPosition.posWithOffset - bbox.width / 2);
|
|
638
|
+
if (gitGraphConfig.rotateCommitLabel) if (dir === "TB" || dir === "BT") {
|
|
639
|
+
text.attr("transform", "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")");
|
|
640
|
+
labelBkg.attr("transform", "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")");
|
|
641
|
+
} else {
|
|
642
|
+
const r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;
|
|
643
|
+
const r_y = 10 + bbox.width / 25 * 8.5;
|
|
644
|
+
wrapper.attr("transform", "translate(" + r_x + ", " + r_y + ") rotate(-45, " + pos + ", " + commitPosition.y + ")");
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}, "drawCommitLabel");
|
|
649
|
+
var drawCommitTags = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
|
|
650
|
+
if (commit2.tags.length > 0) {
|
|
651
|
+
let yOffset = 0;
|
|
652
|
+
let maxTagBboxWidth = 0;
|
|
653
|
+
let maxTagBboxHeight = 0;
|
|
654
|
+
const tagElements = [];
|
|
655
|
+
for (const tagValue of commit2.tags.reverse()) {
|
|
656
|
+
const rect = gLabels.insert("polygon");
|
|
657
|
+
const hole = gLabels.append("circle");
|
|
658
|
+
const tag = gLabels.append("text").attr("y", commitPosition.y - 16 - yOffset).attr("class", "tag-label").text(tagValue);
|
|
659
|
+
const tagBbox = tag.node()?.getBBox();
|
|
660
|
+
if (!tagBbox) throw new Error("Tag bbox not found");
|
|
661
|
+
maxTagBboxWidth = Math.max(maxTagBboxWidth, tagBbox.width);
|
|
662
|
+
maxTagBboxHeight = Math.max(maxTagBboxHeight, tagBbox.height);
|
|
663
|
+
tag.attr("x", commitPosition.posWithOffset - tagBbox.width / 2);
|
|
664
|
+
tagElements.push({
|
|
665
|
+
tag,
|
|
666
|
+
hole,
|
|
667
|
+
rect,
|
|
668
|
+
yOffset
|
|
669
|
+
});
|
|
670
|
+
yOffset += 20;
|
|
671
|
+
}
|
|
672
|
+
for (const { tag, hole, rect, yOffset: yOffset2 } of tagElements) {
|
|
673
|
+
const h2 = maxTagBboxHeight / 2;
|
|
674
|
+
const ly = commitPosition.y - 19.2 - yOffset2;
|
|
675
|
+
rect.attr("class", "tag-label-bkg").attr("points", `
|
|
676
|
+
${pos - maxTagBboxWidth / 2 - PX / 2},${ly + PY}
|
|
677
|
+
${pos - maxTagBboxWidth / 2 - PX / 2},${ly - PY}
|
|
678
|
+
${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly - h2 - PY}
|
|
679
|
+
${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly - h2 - PY}
|
|
680
|
+
${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly + h2 + PY}
|
|
681
|
+
${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly + h2 + PY}`);
|
|
682
|
+
hole.attr("cy", ly).attr("cx", pos - maxTagBboxWidth / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole");
|
|
683
|
+
if (dir === "TB" || dir === "BT") {
|
|
684
|
+
const yOrigin = pos + yOffset2;
|
|
685
|
+
rect.attr("class", "tag-label-bkg").attr("points", `
|
|
686
|
+
${commitPosition.x},${yOrigin + 2}
|
|
687
|
+
${commitPosition.x},${yOrigin - 2}
|
|
688
|
+
${commitPosition.x + LAYOUT_OFFSET},${yOrigin - h2 - 2}
|
|
689
|
+
${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin - h2 - 2}
|
|
690
|
+
${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin + h2 + 2}
|
|
691
|
+
${commitPosition.x + LAYOUT_OFFSET},${yOrigin + h2 + 2}`).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
692
|
+
hole.attr("cx", commitPosition.x + PX / 2).attr("cy", yOrigin).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
693
|
+
tag.attr("x", commitPosition.x + 5).attr("y", yOrigin + 3).attr("transform", "translate(14,14) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}, "drawCommitTags");
|
|
698
|
+
var getCommitClassType = /* @__PURE__ */ __name((commit2) => {
|
|
699
|
+
switch (commit2.customType ?? commit2.type) {
|
|
700
|
+
case commitType.NORMAL: return "commit-normal";
|
|
701
|
+
case commitType.REVERSE: return "commit-reverse";
|
|
702
|
+
case commitType.HIGHLIGHT: return "commit-highlight";
|
|
703
|
+
case commitType.MERGE: return "commit-merge";
|
|
704
|
+
case commitType.CHERRY_PICK: return "commit-cherry-pick";
|
|
705
|
+
default: return "commit-normal";
|
|
706
|
+
}
|
|
707
|
+
}, "getCommitClassType");
|
|
708
|
+
var calculatePosition = /* @__PURE__ */ __name((commit2, dir2, pos, commitPos2) => {
|
|
709
|
+
const defaultCommitPosition = {
|
|
710
|
+
x: 0,
|
|
711
|
+
y: 0
|
|
712
|
+
};
|
|
713
|
+
if (commit2.parents.length > 0) {
|
|
714
|
+
const closestParent = findClosestParent(commit2.parents);
|
|
715
|
+
if (closestParent) {
|
|
716
|
+
const parentPosition = commitPos2.get(closestParent) ?? defaultCommitPosition;
|
|
717
|
+
if (dir2 === "TB") return parentPosition.y + COMMIT_STEP;
|
|
718
|
+
else if (dir2 === "BT") return (commitPos2.get(commit2.id) ?? defaultCommitPosition).y - COMMIT_STEP;
|
|
719
|
+
else return parentPosition.x + COMMIT_STEP;
|
|
720
|
+
}
|
|
721
|
+
} else if (dir2 === "TB") return defaultPos;
|
|
722
|
+
else if (dir2 === "BT") return (commitPos2.get(commit2.id) ?? defaultCommitPosition).y - COMMIT_STEP;
|
|
723
|
+
else return 0;
|
|
724
|
+
return 0;
|
|
725
|
+
}, "calculatePosition");
|
|
726
|
+
var getCommitPosition = /* @__PURE__ */ __name((commit2, pos, isParallelCommits) => {
|
|
727
|
+
const posWithOffset = dir === "BT" && isParallelCommits ? pos : pos + LAYOUT_OFFSET;
|
|
728
|
+
const branchY = branchPos.get(commit2.branch)?.pos;
|
|
729
|
+
const x = dir === "TB" || dir === "BT" ? branchPos.get(commit2.branch)?.pos : posWithOffset;
|
|
730
|
+
if (x === void 0 || branchY === void 0) throw new Error(`Position were undefined for commit ${commit2.id}`);
|
|
731
|
+
const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(getConfig2().theme ?? "");
|
|
732
|
+
return {
|
|
733
|
+
x,
|
|
734
|
+
y: dir === "TB" || dir === "BT" ? posWithOffset : branchY + (useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : -2),
|
|
735
|
+
posWithOffset
|
|
736
|
+
};
|
|
737
|
+
}, "getCommitPosition");
|
|
738
|
+
var drawCommits = /* @__PURE__ */ __name((svg, commits, modifyGraph, gitGraphConfig) => {
|
|
739
|
+
const gBullets = svg.append("g").attr("class", "commit-bullets");
|
|
740
|
+
const gLabels = svg.append("g").attr("class", "commit-labels");
|
|
741
|
+
let pos = dir === "TB" || dir === "BT" ? defaultPos : 0;
|
|
742
|
+
const keys = [...commits.keys()];
|
|
743
|
+
const isParallelCommits = gitGraphConfig.parallelCommits ?? false;
|
|
744
|
+
const sortKeys = /* @__PURE__ */ __name((a, b) => {
|
|
745
|
+
const seqA = commits.get(a)?.seq;
|
|
746
|
+
const seqB = commits.get(b)?.seq;
|
|
747
|
+
return seqA !== void 0 && seqB !== void 0 ? seqA - seqB : 0;
|
|
748
|
+
}, "sortKeys");
|
|
749
|
+
let sortedKeys = keys.sort(sortKeys);
|
|
750
|
+
if (dir === "BT") {
|
|
751
|
+
if (isParallelCommits) setParallelBTPos(sortedKeys, commits, pos);
|
|
752
|
+
sortedKeys = sortedKeys.reverse();
|
|
753
|
+
}
|
|
754
|
+
sortedKeys.forEach((key) => {
|
|
755
|
+
const commit2 = commits.get(key);
|
|
756
|
+
if (!commit2) throw new Error(`Commit not found for key ${key}`);
|
|
757
|
+
if (isParallelCommits) pos = calculatePosition(commit2, dir, pos, commitPos);
|
|
758
|
+
const commitPosition = getCommitPosition(commit2, pos, isParallelCommits);
|
|
759
|
+
if (modifyGraph) {
|
|
760
|
+
const typeClass = getCommitClassType(commit2);
|
|
761
|
+
const commitSymbolType = commit2.customType ?? commit2.type;
|
|
762
|
+
const branchIndex = branchPos.get(commit2.branch)?.index ?? 0;
|
|
763
|
+
drawCommitBullet(gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType);
|
|
764
|
+
drawCommitLabel(gLabels, commit2, commitPosition, pos, gitGraphConfig);
|
|
765
|
+
drawCommitTags(gLabels, commit2, commitPosition, pos);
|
|
766
|
+
}
|
|
767
|
+
if (dir === "TB" || dir === "BT") commitPos.set(commit2.id, {
|
|
768
|
+
x: commitPosition.x,
|
|
769
|
+
y: commitPosition.posWithOffset
|
|
770
|
+
});
|
|
771
|
+
else commitPos.set(commit2.id, {
|
|
772
|
+
x: commitPosition.posWithOffset,
|
|
773
|
+
y: commitPosition.y
|
|
774
|
+
});
|
|
775
|
+
pos = dir === "BT" && isParallelCommits ? pos + COMMIT_STEP : pos + COMMIT_STEP + LAYOUT_OFFSET;
|
|
776
|
+
if (pos > maxPos) maxPos = pos;
|
|
777
|
+
});
|
|
778
|
+
}, "drawCommits");
|
|
779
|
+
var shouldRerouteArrow = /* @__PURE__ */ __name((commitA, commitB, p1, p2, allCommits) => {
|
|
780
|
+
const branchToGetCurve = (dir === "TB" || dir === "BT" ? p1.x < p2.x : p1.y < p2.y) ? commitB.branch : commitA.branch;
|
|
781
|
+
const isOnBranchToGetCurve = /* @__PURE__ */ __name((x) => x.branch === branchToGetCurve, "isOnBranchToGetCurve");
|
|
782
|
+
const isBetweenCommits = /* @__PURE__ */ __name((x) => x.seq > commitA.seq && x.seq < commitB.seq, "isBetweenCommits");
|
|
783
|
+
return [...allCommits.values()].some((commitX) => {
|
|
784
|
+
return isBetweenCommits(commitX) && isOnBranchToGetCurve(commitX);
|
|
785
|
+
});
|
|
786
|
+
}, "shouldRerouteArrow");
|
|
787
|
+
var findLane = /* @__PURE__ */ __name((y1, y2, depth = 0) => {
|
|
788
|
+
const candidate = y1 + Math.abs(y1 - y2) / 2;
|
|
789
|
+
if (depth > 5) return candidate;
|
|
790
|
+
if (lanes.every((lane) => Math.abs(lane - candidate) >= 10)) {
|
|
791
|
+
lanes.push(candidate);
|
|
792
|
+
return candidate;
|
|
793
|
+
}
|
|
794
|
+
return findLane(y1, y2 - Math.abs(y1 - y2) / 5, depth + 1);
|
|
795
|
+
}, "findLane");
|
|
796
|
+
var drawArrow = /* @__PURE__ */ __name((svg, commitA, commitB, allCommits) => {
|
|
797
|
+
const { theme: arrowTheme } = getConfig2();
|
|
798
|
+
const useColorTheme = COLOR_THEMES.has(arrowTheme ?? "");
|
|
799
|
+
const p1 = commitPos.get(commitA.id);
|
|
800
|
+
const p2 = commitPos.get(commitB.id);
|
|
801
|
+
if (p1 === void 0 || p2 === void 0) throw new Error(`Commit positions not found for commits ${commitA.id} and ${commitB.id}`);
|
|
802
|
+
const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p2, allCommits);
|
|
803
|
+
let arc = "";
|
|
804
|
+
let arc2 = "";
|
|
805
|
+
let radius = 0;
|
|
806
|
+
let offset = 0;
|
|
807
|
+
let colorClassNum = branchPos.get(commitB.branch)?.index;
|
|
808
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
809
|
+
let lineDef;
|
|
810
|
+
if (arrowNeedsRerouting) {
|
|
811
|
+
arc = "A 10 10, 0, 0, 0,";
|
|
812
|
+
arc2 = "A 10 10, 0, 0, 1,";
|
|
813
|
+
radius = 10;
|
|
814
|
+
offset = 10;
|
|
815
|
+
const lineY = p1.y < p2.y ? findLane(p1.y, p2.y) : findLane(p2.y, p1.y);
|
|
816
|
+
const lineX = p1.x < p2.x ? findLane(p1.x, p2.x) : findLane(p2.x, p1.x);
|
|
817
|
+
if (dir === "TB") if (p1.x < p2.x) lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius} ${p1.y} ${arc2} ${lineX} ${p1.y + offset} L ${lineX} ${p2.y - radius} ${arc} ${lineX + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
818
|
+
else {
|
|
819
|
+
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
820
|
+
lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius} ${p1.y} ${arc} ${lineX} ${p1.y + offset} L ${lineX} ${p2.y - radius} ${arc2} ${lineX - offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
821
|
+
}
|
|
822
|
+
else if (dir === "BT") if (p1.x < p2.x) lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius} ${p1.y} ${arc} ${lineX} ${p1.y - offset} L ${lineX} ${p2.y + radius} ${arc2} ${lineX + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
823
|
+
else {
|
|
824
|
+
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
825
|
+
lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius} ${p1.y} ${arc2} ${lineX} ${p1.y - offset} L ${lineX} ${p2.y + radius} ${arc} ${lineX - offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
826
|
+
}
|
|
827
|
+
else if (p1.y < p2.y) lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY - radius} ${arc} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc2} ${p2.x} ${lineY + offset} L ${p2.x} ${p2.y}`;
|
|
828
|
+
else {
|
|
829
|
+
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
830
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY + radius} ${arc2} ${p1.x + offset} ${lineY} L ${p2.x - radius} ${lineY} ${arc} ${p2.x} ${lineY - offset} L ${p2.x} ${p2.y}`;
|
|
831
|
+
}
|
|
832
|
+
} else {
|
|
833
|
+
arc = "A 20 20, 0, 0, 0,";
|
|
834
|
+
arc2 = "A 20 20, 0, 0, 1,";
|
|
835
|
+
radius = 20;
|
|
836
|
+
offset = 20;
|
|
837
|
+
if (dir === "TB") {
|
|
838
|
+
if (p1.x < p2.x) if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
839
|
+
else lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
840
|
+
if (p1.x > p2.x) {
|
|
841
|
+
arc = "A 20 20, 0, 0, 0,";
|
|
842
|
+
arc2 = "A 20 20, 0, 0, 1,";
|
|
843
|
+
radius = 20;
|
|
844
|
+
offset = 20;
|
|
845
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc2} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
846
|
+
else lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
847
|
+
}
|
|
848
|
+
if (p1.x === p2.x) lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
849
|
+
} else if (dir === "BT") {
|
|
850
|
+
if (p1.x < p2.x) if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
851
|
+
else lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
852
|
+
if (p1.x > p2.x) {
|
|
853
|
+
arc = "A 20 20, 0, 0, 0,";
|
|
854
|
+
arc2 = "A 20 20, 0, 0, 1,";
|
|
855
|
+
radius = 20;
|
|
856
|
+
offset = 20;
|
|
857
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
858
|
+
else lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc2} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
859
|
+
}
|
|
860
|
+
if (p1.x === p2.x) lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
861
|
+
} else {
|
|
862
|
+
if (p1.y < p2.y) if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
863
|
+
else lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
864
|
+
if (p1.y > p2.y) if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
865
|
+
else lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
866
|
+
if (p1.y === p2.y) lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
if (lineDef === void 0) throw new Error("Line definition not found");
|
|
870
|
+
svg.append("path").attr("d", lineDef).attr("class", "arrow arrow" + calcColorIndex(colorClassNum, THEME_COLOR_LIMIT, useColorTheme));
|
|
871
|
+
}, "drawArrow");
|
|
872
|
+
var drawArrows = /* @__PURE__ */ __name((svg, commits) => {
|
|
873
|
+
const gArrows = svg.append("g").attr("class", "commit-arrows");
|
|
874
|
+
[...commits.keys()].forEach((key) => {
|
|
875
|
+
const commit2 = commits.get(key);
|
|
876
|
+
if (commit2.parents && commit2.parents.length > 0) commit2.parents.forEach((parent) => {
|
|
877
|
+
drawArrow(gArrows, commits.get(parent), commit2, commits);
|
|
878
|
+
});
|
|
879
|
+
});
|
|
880
|
+
}, "drawArrows");
|
|
881
|
+
var drawBranches = /* @__PURE__ */ __name((svg, branches, gitGraphConfig, id) => {
|
|
882
|
+
const { look, theme, themeVariables } = getConfig2();
|
|
883
|
+
const { dropShadow, THEME_COLOR_LIMIT: themeColorLimit } = themeVariables;
|
|
884
|
+
const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(theme ?? "");
|
|
885
|
+
const useColorTheme = COLOR_THEMES.has(theme ?? "");
|
|
886
|
+
const g = svg.append("g");
|
|
887
|
+
branches.forEach((branch2, index) => {
|
|
888
|
+
const adjustIndexForTheme = calcColorIndex(index, useReduxGeometry ? themeColorLimit : THEME_COLOR_LIMIT, useColorTheme);
|
|
889
|
+
const pos = branchPos.get(branch2.name)?.pos;
|
|
890
|
+
if (pos === void 0) throw new Error(`Position not found for branch ${branch2.name}`);
|
|
891
|
+
const spineY = dir === "TB" || dir === "BT" ? pos : useReduxGeometry ? pos + REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : pos - 2;
|
|
892
|
+
const line = g.append("line");
|
|
893
|
+
line.attr("x1", 0);
|
|
894
|
+
line.attr("y1", spineY);
|
|
895
|
+
line.attr("x2", maxPos);
|
|
896
|
+
line.attr("y2", spineY);
|
|
897
|
+
line.attr("class", "branch branch" + adjustIndexForTheme);
|
|
898
|
+
if (dir === "TB") {
|
|
899
|
+
line.attr("y1", defaultPos);
|
|
900
|
+
line.attr("x1", pos);
|
|
901
|
+
line.attr("y2", maxPos);
|
|
902
|
+
line.attr("x2", pos);
|
|
903
|
+
} else if (dir === "BT") {
|
|
904
|
+
line.attr("y1", maxPos);
|
|
905
|
+
line.attr("x1", pos);
|
|
906
|
+
line.attr("y2", defaultPos);
|
|
907
|
+
line.attr("x2", pos);
|
|
908
|
+
}
|
|
909
|
+
lanes.push(spineY);
|
|
910
|
+
const name = branch2.name;
|
|
911
|
+
const labelElement = drawText(name);
|
|
912
|
+
const bkg = g.insert("rect");
|
|
913
|
+
const label = g.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + adjustIndexForTheme);
|
|
914
|
+
label.node().appendChild(labelElement);
|
|
915
|
+
const bbox = labelElement.getBBox();
|
|
916
|
+
const borderRadius = useReduxGeometry ? 0 : 4;
|
|
917
|
+
const labelPaddingX = useReduxGeometry ? 16 : 0;
|
|
918
|
+
const labelPaddingY = useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y : 0;
|
|
919
|
+
if (look === "neo") bkg.attr("data-look", `neo`);
|
|
920
|
+
bkg.attr("class", "branchLabelBkg label" + adjustIndexForTheme).attr("style", look === "neo" ? `filter:${useReduxGeometry ? `url(#${id}-drop-shadow)` : dropShadow}` : "").attr("rx", borderRadius).attr("ry", borderRadius).attr("x", -bbox.width - 4 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)).attr("y", -bbox.height / 2 + 10).attr("width", bbox.width + 18 + labelPaddingX).attr("height", bbox.height + 4 + labelPaddingY);
|
|
921
|
+
label.attr("transform", "translate(" + (-bbox.width - 14 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0) + labelPaddingX / 2) + ", " + (spineY - bbox.height / 2 - 2) + ")");
|
|
922
|
+
if (dir === "TB") {
|
|
923
|
+
bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", 0);
|
|
924
|
+
label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", 0)");
|
|
925
|
+
if (useReduxGeometry) {
|
|
926
|
+
bkg.attr("transform", `translate(${-labelPaddingX / 2 - 3}, ${-labelPaddingY - 10})`);
|
|
927
|
+
label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + (-labelPaddingY * 2 + 7) + ")");
|
|
928
|
+
}
|
|
929
|
+
} else if (dir === "BT") {
|
|
930
|
+
bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", maxPos);
|
|
931
|
+
label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + maxPos + ")");
|
|
932
|
+
if (useReduxGeometry) {
|
|
933
|
+
bkg.attr("transform", `translate(${-labelPaddingX / 2 - 3}, ${labelPaddingY + 10})`);
|
|
934
|
+
label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + (maxPos + labelPaddingY * 2 + 4) + ")");
|
|
935
|
+
}
|
|
936
|
+
} else bkg.attr("transform", "translate(-19, " + (spineY - 12 - labelPaddingY / 2) + ")");
|
|
937
|
+
});
|
|
938
|
+
}, "drawBranches");
|
|
939
|
+
var setBranchPosition = /* @__PURE__ */ __name(function(name, pos, index, bbox, rotateCommitLabel) {
|
|
940
|
+
branchPos.set(name, {
|
|
941
|
+
pos,
|
|
942
|
+
index
|
|
943
|
+
});
|
|
944
|
+
pos += 50 + (rotateCommitLabel ? 40 : 0) + (dir === "TB" || dir === "BT" ? bbox.width / 2 : 0);
|
|
945
|
+
return pos;
|
|
946
|
+
}, "setBranchPosition");
|
|
947
|
+
var gitGraphRenderer_default = { draw: /* @__PURE__ */ __name(function(txt, id, ver, diagObj) {
|
|
948
|
+
clear3();
|
|
949
|
+
log.debug("in gitgraph renderer", txt + "\n", "id:", id, ver);
|
|
950
|
+
const db2 = diagObj.db;
|
|
951
|
+
if (!db2.getConfig) {
|
|
952
|
+
log.error("getConfig method is not available on db");
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
const gitGraphConfig = db2.getConfig();
|
|
956
|
+
const rotateCommitLabel = gitGraphConfig.rotateCommitLabel ?? false;
|
|
957
|
+
allCommitsDict = db2.getCommits();
|
|
958
|
+
const branches = db2.getBranchesAsObjArray();
|
|
959
|
+
dir = db2.getDirection();
|
|
960
|
+
const diagram2 = select_default(`[id="${id}"]`);
|
|
961
|
+
const { look, theme, themeVariables } = getConfig2();
|
|
962
|
+
const { useGradient, gradientStart, gradientStop, filterColor } = themeVariables;
|
|
963
|
+
if (useGradient) {
|
|
964
|
+
const gradient = diagram2.append("defs").append("linearGradient").attr("id", id + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
|
|
965
|
+
gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
|
|
966
|
+
gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
|
|
967
|
+
}
|
|
968
|
+
if (look === "neo" && REDUX_GEOMETRY_THEMES.has(theme ?? "")) diagram2.append("defs").append("filter").attr("id", id + "-drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", filterColor);
|
|
969
|
+
let pos = 0;
|
|
970
|
+
branches.forEach((branch2, index) => {
|
|
971
|
+
const labelElement = drawText(branch2.name);
|
|
972
|
+
const g = diagram2.append("g");
|
|
973
|
+
const branchLabel = g.insert("g").attr("class", "branchLabel");
|
|
974
|
+
const label = branchLabel.insert("g").attr("class", "label branch-label");
|
|
975
|
+
label.node()?.appendChild(labelElement);
|
|
976
|
+
const bbox = labelElement.getBBox();
|
|
977
|
+
pos = setBranchPosition(branch2.name, pos, index, bbox, rotateCommitLabel);
|
|
978
|
+
label.remove();
|
|
979
|
+
branchLabel.remove();
|
|
980
|
+
g.remove();
|
|
981
|
+
});
|
|
982
|
+
drawCommits(diagram2, allCommitsDict, false, gitGraphConfig);
|
|
983
|
+
if (gitGraphConfig.showBranches) drawBranches(diagram2, branches, gitGraphConfig, id);
|
|
984
|
+
drawArrows(diagram2, allCommitsDict);
|
|
985
|
+
drawCommits(diagram2, allCommitsDict, true, gitGraphConfig);
|
|
986
|
+
utils_default.insertTitle(diagram2, "gitTitleText", gitGraphConfig.titleTopMargin ?? 0, db2.getDiagramTitle());
|
|
987
|
+
setupGraphViewbox2(void 0, diagram2, gitGraphConfig.diagramPadding, gitGraphConfig.useMaxWidth);
|
|
988
|
+
}, "draw") };
|
|
989
|
+
var GIT_NAMED_COLOR_COUNT = 8;
|
|
990
|
+
var REDUX_GEOMETRY_THEMES2 = /* @__PURE__ */ new Set([
|
|
991
|
+
"redux",
|
|
992
|
+
"redux-dark",
|
|
993
|
+
"redux-color",
|
|
994
|
+
"redux-dark-color"
|
|
995
|
+
]);
|
|
996
|
+
var COLOR_THEMES2 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
|
|
997
|
+
var NEO_THEMES = /* @__PURE__ */ new Set(["neo", "neo-dark"]);
|
|
998
|
+
var DARK_THEMES2 = /* @__PURE__ */ new Set([
|
|
999
|
+
"dark",
|
|
1000
|
+
"redux-dark",
|
|
1001
|
+
"redux-dark-color",
|
|
1002
|
+
"neo-dark"
|
|
1003
|
+
]);
|
|
1004
|
+
var NEO_COLOR_GEN_THEMES = /* @__PURE__ */ new Set([
|
|
1005
|
+
"redux",
|
|
1006
|
+
"redux-dark",
|
|
1007
|
+
"redux-color",
|
|
1008
|
+
"redux-dark-color",
|
|
1009
|
+
"neo",
|
|
1010
|
+
"neo-dark"
|
|
1011
|
+
]);
|
|
1012
|
+
var genGitGraphGradient = /* @__PURE__ */ __name((options) => {
|
|
1013
|
+
const { svgId } = options;
|
|
1014
|
+
let sections = "";
|
|
1015
|
+
if (options.useGradient && svgId) for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) sections += `
|
|
1016
|
+
.label${i} { fill: ${options.mainBkg}; stroke: url(${svgId}-gradient); stroke-width: ${options.strokeWidth};}
|
|
1017
|
+
`;
|
|
1018
|
+
return sections;
|
|
1019
|
+
}, "genGitGraphGradient");
|
|
1020
|
+
var genColor = /* @__PURE__ */ __name((options) => {
|
|
1021
|
+
const { theme, themeVariables } = getConfig();
|
|
1022
|
+
const { borderColorArray } = themeVariables;
|
|
1023
|
+
const useReduxGeometry = REDUX_GEOMETRY_THEMES2.has(theme);
|
|
1024
|
+
if (NEO_THEMES.has(theme)) {
|
|
1025
|
+
let sections = "";
|
|
1026
|
+
for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) if (i === 0) sections += `
|
|
1027
|
+
.branch-label${i} { fill: ${options.nodeBorder};}
|
|
1028
|
+
.commit${i} { stroke: ${options.nodeBorder}; }
|
|
1029
|
+
.commit-highlight${i} { stroke: ${options.nodeBorder}; fill: ${options.nodeBorder}; }
|
|
1030
|
+
.arrow${i} { stroke: ${options.nodeBorder}; }
|
|
1031
|
+
.commit-bullets { fill: ${options.nodeBorder}; }
|
|
1032
|
+
.commit-cherry-pick${i} { stroke: ${options.nodeBorder}; }
|
|
1033
|
+
${genGitGraphGradient(options)}`;
|
|
1034
|
+
else {
|
|
1035
|
+
const ci = i % GIT_NAMED_COLOR_COUNT;
|
|
1036
|
+
sections += `
|
|
1037
|
+
.branch-label${i} { fill: ${options["gitBranchLabel" + ci]}; }
|
|
1038
|
+
.commit${i} { stroke: ${options["git" + ci]}; fill: ${options["git" + ci]}; }
|
|
1039
|
+
.commit-highlight${i} { stroke: ${options["gitInv" + ci]}; fill: ${options["gitInv" + ci]}; }
|
|
1040
|
+
.arrow${i} { stroke: ${options["git" + ci]}; }
|
|
1041
|
+
`;
|
|
1042
|
+
}
|
|
1043
|
+
return sections;
|
|
1044
|
+
} else if (!COLOR_THEMES2.has(theme)) {
|
|
1045
|
+
let sections = "";
|
|
1046
|
+
for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) sections += `
|
|
1047
|
+
.branch-label${i} { fill: ${options.nodeBorder}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""} }
|
|
1048
|
+
.commit${i} { stroke: ${options.nodeBorder}; }
|
|
1049
|
+
.commit-highlight${i} { stroke: ${options.nodeBorder}; fill: ${options.nodeBorder}; }
|
|
1050
|
+
.label${i} { fill: ${options.mainBkg}; stroke: ${options.nodeBorder}; stroke-width: ${options.strokeWidth}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""}}
|
|
1051
|
+
.arrow${i} { stroke: ${options.nodeBorder}; }
|
|
1052
|
+
.commit-bullets { fill: ${options.nodeBorder}; }
|
|
1053
|
+
.commit-cherry-pick${i} { stroke: ${options.nodeBorder}; }
|
|
1054
|
+
`;
|
|
1055
|
+
return sections;
|
|
1056
|
+
} else {
|
|
1057
|
+
let sections = "";
|
|
1058
|
+
for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) if (i === 0) sections += `
|
|
1059
|
+
.branch-label${i} { fill: ${options.nodeBorder}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""} }
|
|
1060
|
+
.commit${i} { stroke: ${options.nodeBorder}; }
|
|
1061
|
+
.commit-highlight${i} { stroke: ${options.nodeBorder}; fill: ${options.mainBkg}; }
|
|
1062
|
+
.label${i} { fill: ${options.mainBkg}; stroke: ${options.nodeBorder}; stroke-width: ${options.strokeWidth}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""} }
|
|
1063
|
+
.arrow${i} { stroke: ${options.nodeBorder}; }
|
|
1064
|
+
.commit-bullets { fill: ${options.nodeBorder}; }
|
|
1065
|
+
`;
|
|
1066
|
+
else {
|
|
1067
|
+
const colorIndex = i % borderColorArray.length;
|
|
1068
|
+
sections += `
|
|
1069
|
+
.branch-label${i} { fill: ${options.nodeBorder}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""} }
|
|
1070
|
+
.commit${i} { stroke: ${borderColorArray[colorIndex]}; fill: ${borderColorArray[colorIndex]}; }
|
|
1071
|
+
.commit-highlight${i} { stroke: ${borderColorArray[colorIndex]}; fill: ${borderColorArray[colorIndex]}; }
|
|
1072
|
+
.label${i} { fill: ${DARK_THEMES2.has(theme) ? options.mainBkg : borderColorArray[colorIndex]}; stroke: ${borderColorArray[colorIndex]}; stroke-width: ${options.strokeWidth}; }
|
|
1073
|
+
.arrow${i} { stroke: ${borderColorArray[colorIndex]}; }
|
|
1074
|
+
`;
|
|
1075
|
+
}
|
|
1076
|
+
return sections;
|
|
1077
|
+
}
|
|
1078
|
+
}, "genColor");
|
|
1079
|
+
var normalTheme = /* @__PURE__ */ __name((options) => {
|
|
1080
|
+
return `${Array.from({ length: options.THEME_COLOR_LIMIT }, (_, i) => i).map((i) => {
|
|
1081
|
+
const ci = i % GIT_NAMED_COLOR_COUNT;
|
|
1082
|
+
return `
|
|
1083
|
+
.branch-label${i} { fill: ${options["gitBranchLabel" + ci]}; }
|
|
1084
|
+
.commit${i} { stroke: ${options["git" + ci]}; fill: ${options["git" + ci]}; }
|
|
1085
|
+
.commit-highlight${i} { stroke: ${options["gitInv" + ci]}; fill: ${options["gitInv" + ci]}; }
|
|
1086
|
+
.label${i} { fill: ${options["git" + ci]}; }
|
|
1087
|
+
.arrow${i} { stroke: ${options["git" + ci]}; }
|
|
1088
|
+
`;
|
|
1089
|
+
}).join("\n")}`;
|
|
1090
|
+
}, "normalTheme");
|
|
1091
|
+
var diagram = {
|
|
1092
|
+
parser,
|
|
1093
|
+
db,
|
|
1094
|
+
renderer: gitGraphRenderer_default,
|
|
1095
|
+
styles: /* @__PURE__ */ __name((options) => {
|
|
1096
|
+
const { theme } = getConfig();
|
|
1097
|
+
const useNeoColorGen = NEO_COLOR_GEN_THEMES.has(theme);
|
|
1098
|
+
return `
|
|
1099
|
+
.commit-id,
|
|
1100
|
+
.commit-msg,
|
|
1101
|
+
.branch-label {
|
|
1102
|
+
fill: lightgrey;
|
|
1103
|
+
color: lightgrey;
|
|
1104
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
1105
|
+
font-family: var(--mermaid-font-family);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
${useNeoColorGen ? genColor(options) : normalTheme(options)}
|
|
1109
|
+
|
|
1110
|
+
.branch {
|
|
1111
|
+
stroke-width: ${options.strokeWidth};
|
|
1112
|
+
stroke: ${options.commitLineColor ?? options.lineColor};
|
|
1113
|
+
stroke-dasharray: ${useNeoColorGen ? "4 2" : "2"};
|
|
1114
|
+
}
|
|
1115
|
+
.commit-label { font-size: ${options.commitLabelFontSize}; fill: ${useNeoColorGen ? options.nodeBorder : options.commitLabelColor}; ${useNeoColorGen ? `font-weight:${options.noteFontWeight};` : ""}}
|
|
1116
|
+
.commit-label-bkg { font-size: ${options.commitLabelFontSize}; fill: ${useNeoColorGen ? "transparent" : options.commitLabelBackground}; opacity: ${useNeoColorGen ? "" : .5}; }
|
|
1117
|
+
.tag-label { font-size: ${options.tagLabelFontSize}; fill: ${options.tagLabelColor};}
|
|
1118
|
+
.tag-label-bkg { fill: ${useNeoColorGen ? options.mainBkg : options.tagLabelBackground}; stroke: ${useNeoColorGen ? options.nodeBorder : options.tagLabelBorder}; ${useNeoColorGen ? `filter:${options.dropShadow}` : ""} }
|
|
1119
|
+
.tag-hole { fill: ${options.textColor}; }
|
|
1120
|
+
|
|
1121
|
+
.commit-merge {
|
|
1122
|
+
stroke: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1123
|
+
fill: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1124
|
+
}
|
|
1125
|
+
.commit-reverse {
|
|
1126
|
+
stroke: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1127
|
+
fill: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1128
|
+
stroke-width: ${useNeoColorGen ? options.strokeWidth : 3};
|
|
1129
|
+
}
|
|
1130
|
+
.commit-highlight-outer {
|
|
1131
|
+
}
|
|
1132
|
+
.commit-highlight-inner {
|
|
1133
|
+
stroke: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1134
|
+
fill: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
.arrow {
|
|
1138
|
+
/* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
|
|
1139
|
+
stroke-width: ${REDUX_GEOMETRY_THEMES2.has(theme) ? options.strokeWidth : 8};
|
|
1140
|
+
stroke-linecap: round;
|
|
1141
|
+
fill: none
|
|
1142
|
+
}
|
|
1143
|
+
.gitTitleText {
|
|
1144
|
+
text-anchor: middle;
|
|
1145
|
+
font-size: 18px;
|
|
1146
|
+
fill: ${options.textColor};
|
|
1147
|
+
}
|
|
1148
|
+
`;
|
|
1149
|
+
}, "getStyles")
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
//#endregion
|
|
1153
|
+
export { diagram };
|