@aiderdesk/aiderdesk 0.87.0 → 0.89.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/out/renderer/assets/2DXBBFLN-DhlZjS3f.js +666 -0
- package/out/renderer/assets/46IJ22JX-C1e8pvI2.js +853 -0
- package/out/renderer/assets/4TTDE5I4-Bea_IXhu.js +501 -0
- package/out/renderer/assets/4UF3HTLV-CVqcE2iq.js +29 -0
- package/out/renderer/assets/5THPTBWS-2mBFupjU.js +21 -0
- package/out/renderer/assets/7WLXJQOR-C8MM6Bra.js +23 -0
- package/out/renderer/assets/AAXQQPKT-BVbjBycX.js +1130 -0
- package/out/renderer/assets/AKE5O7KZ-Dr4O6i9X.js +184 -0
- package/out/renderer/assets/{AgentSettings-Cp7VI6CM.js → AgentSettings-ByYnHHTv.js} +710 -255
- package/out/renderer/assets/BNMLP6AG-CHDGj3j_.js +804 -0
- package/out/renderer/assets/DKTLEL5E-Dj3316cp.js +42 -0
- package/out/renderer/assets/DR6PKOQU-C6a3Tq7K.js +301 -0
- package/out/renderer/assets/E4RJ7UJB-BQWgl9gv.js +441 -0
- package/out/renderer/assets/ELSXBIJH-CVPK3kX4.js +39 -0
- package/out/renderer/assets/ERTIBQVS-71_Ru0iJ.js +182 -0
- package/out/renderer/assets/F653G4FO-Dj2Ang6n.js +1497 -0
- package/out/renderer/assets/FKCDD66M-DCrQTwBi.js +205 -0
- package/out/renderer/assets/FP7KDXVC-DKVnH-En.js +221 -0
- package/out/renderer/assets/FT5I3RHX-hlTJy7Nw.js +243 -0
- package/out/renderer/assets/FTXIJQGB-BX14b7pN.js +13 -0
- package/out/renderer/assets/G3MDBVQH-qZ3yfAIw.js +25 -0
- package/out/renderer/assets/GY35JXOZ-cSi0MdIc.js +168 -0
- package/out/renderer/assets/H5EEJPP2-bpYW0xE8.js +353 -0
- package/out/renderer/assets/HWDLEDTA-uLGgs5fE.js +982 -0
- package/out/renderer/assets/{InfoIcon-DesJ60KC.js → InfoIcon-DI4teJbi.js} +1 -1
- package/out/renderer/assets/JZWSX6AR-B0pkfB2b.js +67 -0
- package/out/renderer/assets/KQOEJWJY-EQFQbIDt.js +84 -0
- package/out/renderer/assets/KS3BB3KE-DclWHpbY.js +138 -0
- package/out/renderer/assets/KXJRRZHI-CHoCRoQ4.js +502 -0
- package/out/renderer/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/out/renderer/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/out/renderer/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/out/renderer/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/out/renderer/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/out/renderer/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/out/renderer/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/out/renderer/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/out/renderer/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/out/renderer/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/out/renderer/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/out/renderer/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/out/renderer/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/out/renderer/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/out/renderer/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/out/renderer/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/out/renderer/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/out/renderer/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/out/renderer/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/out/renderer/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/out/renderer/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/out/renderer/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/out/renderer/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/out/renderer/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/out/renderer/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/out/renderer/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/out/renderer/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/out/renderer/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/out/renderer/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/out/renderer/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/out/renderer/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/out/renderer/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/out/renderer/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/out/renderer/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/out/renderer/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/out/renderer/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/out/renderer/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/out/renderer/assets/MFVI5XKI-TmPyVySZ.js +10 -0
- package/out/renderer/assets/MWY2J62P-BlVjis68.js +1102 -0
- package/out/renderer/assets/MXGNCBL2-HvKcixVr.js +216 -0
- package/out/renderer/assets/N6DAJLIZ-B0JHSPS3.js +120 -0
- package/out/renderer/assets/NU5M23IW-CWgVJ5o_.js +116 -0
- package/out/renderer/assets/NV4XNBIS-uOSoaYKk.js +1221 -0
- package/out/renderer/assets/OGLU4SIR-CiNpshB1.js +289 -0
- package/out/renderer/assets/OUNS5N76-C6p0zhvm.js +1064 -0
- package/out/renderer/assets/{Onboarding-B2h7iatR.js → Onboarding-Ct6-CF4Z.js} +4 -4
- package/out/renderer/assets/PU4ISKXV-BQc-2oYa.js +515 -0
- package/out/renderer/assets/PUZGS23X-Bf89SCAj.js +21 -0
- package/out/renderer/assets/{ProviderHeader-BvigqAWX.js → ProviderHeader-Buje398H.js} +2 -2
- package/out/renderer/assets/Q3IYVLG5-DbP4qs2C.js +500 -0
- package/out/renderer/assets/QYHQDLKZ-dANs6SeT.js +983 -0
- package/out/renderer/assets/RVARI57O-DMrXgtoB.js +10 -0
- package/out/renderer/assets/RZSVICHU-CeuX_9H4.js +263 -0
- package/out/renderer/assets/{SettingsPage-CBonY1bv.js → SettingsPage-CLpPKXG1.js} +978 -848
- package/out/renderer/assets/UEXXS2NB-Bmbum3yG.js +25 -0
- package/out/renderer/assets/UHTQJXKL-C2OuiQBx.js +134 -0
- package/out/renderer/assets/URA2L2QI-DJ2BF8fn.js +201 -0
- package/out/renderer/assets/UXCHDUKG-B6wMZRAn.js +173 -0
- package/out/renderer/assets/{UsageDashboard-DFgckoeT.js → UsageDashboard-ORnsHGxF.js} +9130 -6449
- package/out/renderer/assets/VKNV3BUX-BMK4lviM.js +277 -0
- package/out/renderer/assets/VMV7XPHP-CzHnUaWh.js +127 -0
- package/out/renderer/assets/WEVWDWVA-BYWYeLxq.js +57 -0
- package/out/renderer/assets/XRRJ35LF-DaeQ2kbN.js +119 -0
- package/out/renderer/assets/YFKBLVVN-DsXlM7HO.js +990 -0
- package/out/renderer/assets/YHRE5QGZ-nB9z3NP1.js +697 -0
- package/out/renderer/assets/ZF3OVT4B-Ctn5OOBd.js +420 -0
- package/out/renderer/assets/{index-BFhJk8dv.js → index-BCaQe4ny.js} +2 -2
- package/out/renderer/assets/{index-Dk4pOCFt.js → index-BD-JYQGT.js} +5 -5
- package/out/renderer/assets/{index-bNFXvWqr.js → index-BGR4ZXWZ.js} +2 -2
- package/out/renderer/assets/{index-BP0q4HOE.js → index-BZBhErKV.js} +2 -2
- package/out/renderer/assets/{index-x_iC3w5N.js → index-BcWszklu.js} +1 -1
- package/out/renderer/assets/{index-C8TOzJWw.js → index-BpNNugm2.js} +4 -4
- package/out/renderer/assets/{index-uAJ0Zw9K.js → index-BrgyIQaN.js} +2 -2
- package/out/renderer/assets/{index-CuQvDzzr.js → index-Bt1dN7k_.js} +1 -1
- package/out/renderer/assets/{index-BZmjwrvJ.js → index-Bxu6rqm3.js} +1 -1
- package/out/renderer/assets/{index-tNlkrDYM.js → index-C6mXHxX3.js} +1 -1
- package/out/renderer/assets/{index-Z71oMk_m.js → index-CCbq90uE.js} +1 -1
- package/out/renderer/assets/{index-DE2koGci.js → index-CCm3UXZP.js} +2 -2
- package/out/renderer/assets/{index-DKNYbwcH.js → index-CNkiGtsK.js} +3 -3
- package/out/renderer/assets/{index-D_o1aMFn.css → index-CWfnJXNI.css} +130 -0
- package/out/renderer/assets/{index-47ZLfCU8.js → index-Cc-He418.js} +72999 -82151
- package/out/renderer/assets/{index-Dx6kKrXY.js → index-Crdzxx6k.js} +19 -15
- package/out/renderer/assets/{index-B_PkNLqT.js → index-D30k3y98.js} +1 -1
- package/out/renderer/assets/{index-CasrGDb0.js → index-DAWoHfjM.js} +2 -2
- package/out/renderer/assets/{index-D-rE7YVD.js → index-DG5AIC6J.js} +3 -3
- package/out/renderer/assets/{index-BzOM6AUj.js → index-DSBgCNMv.js} +2 -2
- package/out/renderer/assets/{index-C1I2Idqy.js → index-DeRKeskE.js} +5 -5
- package/out/renderer/assets/{index-Bh4xfAPL.js → index-DgQEgdew.js} +2 -2
- package/out/renderer/assets/{index-BKmr7UTW.js → index-Dgdp4i2K.js} +1 -1
- package/out/renderer/assets/{index-Bbv79qeB.js → index-DnNK6R2g.js} +2 -2
- package/out/renderer/assets/{index-CiIr--kg.js → index-DrNutodm.js} +2 -2
- package/out/renderer/assets/{index-B2jZTTYL.js → index-FS3mY8Ct.js} +1 -1
- package/out/renderer/assets/{index-DvSWnCZD.js → index-KId2jLzt.js} +2 -2
- package/out/renderer/assets/{index-DWZF-uSf.js → index-PyRCX6hq.js} +5 -5
- package/out/renderer/assets/{index-J-dLn6uq.js → index-U8nE80jx.js} +2 -2
- package/out/renderer/assets/{index-cO9XeYPQ.js → index-Vw8jKJU_.js} +5 -5
- package/out/renderer/assets/{index-B9bf5T9j.js → index-_a6zbU-0.js} +1 -1
- package/out/renderer/assets/{index-CenYyetH.js → index-dsqlqRSG.js} +5 -5
- package/out/renderer/assets/{index-D4dhIRp1.js → index-rQL1hwaP.js} +5 -5
- package/out/renderer/assets/{jsx-dev-runtime-CtvYhMha.js → jsx-dev-runtime-Bwt8d4vP.js} +1 -1
- package/out/renderer/index.html +2 -2
- package/out/resources/prompts/system-prompt.hbs +11 -0
- package/out/resources/skills/extension-creator/SKILL.md +20 -1
- package/out/resources/skills/extension-creator/references/event-types.md +5 -3
- package/out/resources/skills/extension-creator/references/extension-interface.md +62 -1
- package/out/resources/skills/extension-creator/references/external-agent-providers.md +90 -0
- package/out/runner.js +2016 -615
- package/package.json +3 -3
- package/out/renderer/assets/abnfDiagram-N423BO3Z-DV7pjob8.js +0 -118
- package/out/renderer/assets/arc-C2NyJjKR.js +0 -131
- package/out/renderer/assets/architectureDiagram-T3A2C74G-BmG8PHmc.js +0 -8829
- package/out/renderer/assets/band-zXq5o_Ib.js +0 -77
- package/out/renderer/assets/blockDiagram-VBNYF7ZC-CJndPtzf.js +0 -3824
- package/out/renderer/assets/c4Diagram-5PPSVZJV-B9DY2Hnr.js +0 -2482
- package/out/renderer/assets/channel-CCPkBLnh.js +0 -7
- package/out/renderer/assets/chunk-2GRJ4B5K-Bt46bDfT.js +0 -116
- package/out/renderer/assets/chunk-2Q5K7J3B-DkQwfKC2.js +0 -19
- package/out/renderer/assets/chunk-5RXB4S5H-CFNEWvlR.js +0 -1988
- package/out/renderer/assets/chunk-5VM5RSS4-BNeZg_6d.js +0 -19
- package/out/renderer/assets/chunk-6Q2QTUOP-BU5gT8Us.js +0 -860
- package/out/renderer/assets/chunk-GF5L2VYU-BNML5JwJ.js +0 -2026
- package/out/renderer/assets/chunk-JWPE2WC7-Dvih3ku3.js +0 -16
- package/out/renderer/assets/chunk-KBJHAD2P-CMgAbRkQ.js +0 -24
- package/out/renderer/assets/chunk-RYQCIY6F-CAJ6Qldz.js +0 -474
- package/out/renderer/assets/chunk-XXDRQBXY-BDZJ-WFV.js +0 -13
- package/out/renderer/assets/classDiagram-JCYQIIEL-BJCilkUQ.js +0 -23
- package/out/renderer/assets/classDiagram-v2-OCEON4UE-BJCilkUQ.js +0 -23
- package/out/renderer/assets/cose-bilkent-JH36ORCC-D6MsqBP5.js +0 -4942
- package/out/renderer/assets/cynefin-VYW2F7L2-3kPlVPG0.js +0 -32093
- package/out/renderer/assets/cynefinDiagram-MW4NZA55-6BlkJqWN.js +0 -453
- package/out/renderer/assets/cytoscape.esm-Bx_1tVW-.js +0 -30332
- package/out/renderer/assets/dagre-VZM6K2ZE-Chj1W0as.js +0 -522
- package/out/renderer/assets/defaultLocale-B2RvLBDe.js +0 -206
- package/out/renderer/assets/diagram-7IWD3JNH-CHFj7vIm.js +0 -488
- package/out/renderer/assets/diagram-B4RE2ZJO-BqOMO30m.js +0 -632
- package/out/renderer/assets/diagram-LBJQPF4R-CkiuQM5K.js +0 -212
- package/out/renderer/assets/diagram-Q27KOJAE-WVbpb4Iq.js +0 -857
- package/out/renderer/assets/diagram-UB23O5K3-B9Q0wQI3.js +0 -311
- package/out/renderer/assets/ebnfDiagram-BXEA7PRR-BUhf1ZxU.js +0 -138
- package/out/renderer/assets/erDiagram-JOGREHBK-DGxWkssI.js +0 -1238
- package/out/renderer/assets/flowDiagram-UKHOOZJN-D3ul5aGG.js +0 -2348
- package/out/renderer/assets/ganttDiagram-PKOTCBZU-BD3VbhAZ.js +0 -2782
- package/out/renderer/assets/gitGraphDiagram-DS77QQ5N-x-7NMw7v.js +0 -1373
- package/out/renderer/assets/graph-BDbmSegI.js +0 -1308
- package/out/renderer/assets/infoDiagram-6WML65LV-BMwbA6CU.js +0 -31
- package/out/renderer/assets/init-CTO7spbL.js +0 -35
- package/out/renderer/assets/ishikawaDiagram-WSZJBQD7-Bx90Gz0s.js +0 -967
- package/out/renderer/assets/journeyDiagram-NVQOT4AX-Dh4pUAU5.js +0 -1255
- package/out/renderer/assets/kanban-definition-27J2QSJJ-BZ_lX-ko.js +0 -1052
- package/out/renderer/assets/katex-oVG3DVWa.js +0 -14499
- package/out/renderer/assets/layout-oaOUFeBM.js +0 -2326
- package/out/renderer/assets/linear-B2eGZpM_.js +0 -361
- package/out/renderer/assets/map-BijQCI9U.js +0 -299
- package/out/renderer/assets/mindmap-definition-FAOFIHXS-BeWZh5qg.js +0 -1153
- package/out/renderer/assets/ordinal-BD3Y6v77.js +0 -77
- package/out/renderer/assets/pegDiagram-VL7TDLO6-BA6NzzN6.js +0 -126
- package/out/renderer/assets/pieDiagram-7S7Q4E2Y-KJmT5t-P.js +0 -316
- package/out/renderer/assets/quadrantDiagram-CIZ2JOQS-BdFz_bQU.js +0 -1343
- package/out/renderer/assets/railroadDiagram-AXF67PYL-CbH2ZZ1S.js +0 -92
- package/out/renderer/assets/requirementDiagram-LRYGKXZP-BZXG5Vgf.js +0 -1204
- package/out/renderer/assets/sankeyDiagram-W5VNT64P-CV1Upv22.js +0 -1274
- package/out/renderer/assets/sequenceDiagram-SI44F4Z6-Csbi3ivi.js +0 -4514
- package/out/renderer/assets/sizeCapture-X5ZJPWSS-CaN4k1d3.js +0 -62
- package/out/renderer/assets/stateDiagram-OKZ733FA-DSo1KeOQ.js +0 -452
- package/out/renderer/assets/stateDiagram-v2-UEYNNEHI-BhXw89HT.js +0 -22
- package/out/renderer/assets/swimlanes-SLNWSIFB-p3GZ-wkU.js +0 -8557
- package/out/renderer/assets/swimlanesDiagram-ULZ7WXOC-DGBdyiqy.js +0 -20
- package/out/renderer/assets/time-4LaKa9ym.js +0 -985
- package/out/renderer/assets/timeline-definition-Z64GVDOM-DfY8hG5p.js +0 -1596
- package/out/renderer/assets/vennDiagram-T6HMQDX7-wp87GaTi.js +0 -2515
- package/out/renderer/assets/wardleyDiagram-T6FBY63Y-DNrC2vOI.js +0 -975
- package/out/renderer/assets/xychartDiagram-ELKLHX3M-Bn8J2SKt.js +0 -1943
|
@@ -1,1373 +0,0 @@
|
|
|
1
|
-
import { I as ImperativeState } from "./chunk-2Q5K7J3B-DkQwfKC2.js";
|
|
2
|
-
import { p as populateCommonDb } from "./chunk-JWPE2WC7-Dvih3ku3.js";
|
|
3
|
-
import { W as getDiagramTitle, V as setDiagramTitle, u as setAccDescription, v as getAccDescription, w as getAccTitle, x as setAccTitle, _ as __name, a3 as getConfig, A as log, z as select, y as getConfig2, a2 as utils_default, a4 as setupGraphViewbox2, X as clear, O as common_default, a5 as cleanAndMerge, a6 as defaultConfig_default, a7 as random } from "./index-47ZLfCU8.js";
|
|
4
|
-
import { p as parse } from "./cynefin-VYW2F7L2-3kPlVPG0.js";
|
|
5
|
-
var commitType = {
|
|
6
|
-
NORMAL: 0,
|
|
7
|
-
REVERSE: 1,
|
|
8
|
-
HIGHLIGHT: 2,
|
|
9
|
-
MERGE: 3,
|
|
10
|
-
CHERRY_PICK: 4
|
|
11
|
-
};
|
|
12
|
-
var DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph;
|
|
13
|
-
var getConfig3 = /* @__PURE__ */ __name(() => {
|
|
14
|
-
const config = cleanAndMerge({
|
|
15
|
-
...DEFAULT_GITGRAPH_CONFIG,
|
|
16
|
-
...getConfig().gitGraph
|
|
17
|
-
});
|
|
18
|
-
return config;
|
|
19
|
-
}, "getConfig");
|
|
20
|
-
var state = new ImperativeState(() => {
|
|
21
|
-
const config = getConfig3();
|
|
22
|
-
const mainBranchName = config.mainBranchName;
|
|
23
|
-
const mainBranchOrder = config.mainBranchOrder;
|
|
24
|
-
return {
|
|
25
|
-
mainBranchName,
|
|
26
|
-
commits: /* @__PURE__ */ new Map(),
|
|
27
|
-
head: null,
|
|
28
|
-
branchConfig: /* @__PURE__ */ new Map([[mainBranchName, { name: mainBranchName, order: mainBranchOrder }]]),
|
|
29
|
-
branches: /* @__PURE__ */ new Map([[mainBranchName, null]]),
|
|
30
|
-
currBranch: mainBranchName,
|
|
31
|
-
direction: "LR",
|
|
32
|
-
seq: 0,
|
|
33
|
-
options: {}
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
function getID() {
|
|
37
|
-
return random({ length: 7 });
|
|
38
|
-
}
|
|
39
|
-
__name(getID, "getID");
|
|
40
|
-
function uniqBy(list, fn) {
|
|
41
|
-
const recordMap = /* @__PURE__ */ Object.create(null);
|
|
42
|
-
return list.reduce((out, item) => {
|
|
43
|
-
const key = fn(item);
|
|
44
|
-
if (!recordMap[key]) {
|
|
45
|
-
recordMap[key] = true;
|
|
46
|
-
out.push(item);
|
|
47
|
-
}
|
|
48
|
-
return out;
|
|
49
|
-
}, []);
|
|
50
|
-
}
|
|
51
|
-
__name(uniqBy, "uniqBy");
|
|
52
|
-
var setDirection = /* @__PURE__ */ __name(function(dir2) {
|
|
53
|
-
state.records.direction = dir2;
|
|
54
|
-
}, "setDirection");
|
|
55
|
-
var setOptions = /* @__PURE__ */ __name(function(rawOptString) {
|
|
56
|
-
log.debug("options str", rawOptString);
|
|
57
|
-
rawOptString = rawOptString?.trim();
|
|
58
|
-
rawOptString = rawOptString || "{}";
|
|
59
|
-
try {
|
|
60
|
-
state.records.options = JSON.parse(rawOptString);
|
|
61
|
-
} catch (e) {
|
|
62
|
-
log.error("error while parsing gitGraph options", e.message);
|
|
63
|
-
}
|
|
64
|
-
}, "setOptions");
|
|
65
|
-
var getOptions = /* @__PURE__ */ __name(function() {
|
|
66
|
-
return state.records.options;
|
|
67
|
-
}, "getOptions");
|
|
68
|
-
var commit = /* @__PURE__ */ __name(function(commitDB) {
|
|
69
|
-
let msg = commitDB.msg;
|
|
70
|
-
let id = commitDB.id;
|
|
71
|
-
const type = commitDB.type;
|
|
72
|
-
let tags = commitDB.tags;
|
|
73
|
-
log.info("commit", msg, id, type, tags);
|
|
74
|
-
log.debug("Entering commit:", msg, id, type, tags);
|
|
75
|
-
const config = getConfig3();
|
|
76
|
-
id = common_default.sanitizeText(id, config);
|
|
77
|
-
msg = common_default.sanitizeText(msg, config);
|
|
78
|
-
tags = tags?.map((tag) => common_default.sanitizeText(tag, config));
|
|
79
|
-
const newCommit = {
|
|
80
|
-
id: id ? id : state.records.seq + "-" + getID(),
|
|
81
|
-
message: msg,
|
|
82
|
-
seq: state.records.seq++,
|
|
83
|
-
type: type ?? commitType.NORMAL,
|
|
84
|
-
tags: tags ?? [],
|
|
85
|
-
parents: state.records.head == null ? [] : [state.records.head.id],
|
|
86
|
-
branch: state.records.currBranch
|
|
87
|
-
};
|
|
88
|
-
state.records.head = newCommit;
|
|
89
|
-
log.info("main branch", config.mainBranchName);
|
|
90
|
-
if (state.records.commits.has(newCommit.id)) {
|
|
91
|
-
log.warn(`Commit ID ${newCommit.id} already exists`);
|
|
92
|
-
}
|
|
93
|
-
state.records.commits.set(newCommit.id, newCommit);
|
|
94
|
-
state.records.branches.set(state.records.currBranch, newCommit.id);
|
|
95
|
-
log.debug("in pushCommit " + newCommit.id);
|
|
96
|
-
}, "commit");
|
|
97
|
-
var branch = /* @__PURE__ */ __name(function(branchDB) {
|
|
98
|
-
let name = branchDB.name;
|
|
99
|
-
const order = branchDB.order;
|
|
100
|
-
name = common_default.sanitizeText(name, getConfig3());
|
|
101
|
-
if (state.records.branches.has(name)) {
|
|
102
|
-
throw new Error(
|
|
103
|
-
`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")`
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
state.records.branches.set(name, state.records.head != null ? state.records.head.id : null);
|
|
107
|
-
state.records.branchConfig.set(name, { name, order });
|
|
108
|
-
checkout(name);
|
|
109
|
-
log.debug("in createBranch");
|
|
110
|
-
}, "branch");
|
|
111
|
-
var merge = /* @__PURE__ */ __name((mergeDB) => {
|
|
112
|
-
let otherBranch = mergeDB.branch;
|
|
113
|
-
let customId = mergeDB.id;
|
|
114
|
-
const overrideType = mergeDB.type;
|
|
115
|
-
const customTags = mergeDB.tags;
|
|
116
|
-
const config = getConfig3();
|
|
117
|
-
otherBranch = common_default.sanitizeText(otherBranch, config);
|
|
118
|
-
if (customId) {
|
|
119
|
-
customId = common_default.sanitizeText(customId, config);
|
|
120
|
-
}
|
|
121
|
-
const currentBranchCheck = state.records.branches.get(state.records.currBranch);
|
|
122
|
-
const otherBranchCheck = state.records.branches.get(otherBranch);
|
|
123
|
-
const currentCommit = currentBranchCheck ? state.records.commits.get(currentBranchCheck) : void 0;
|
|
124
|
-
const otherCommit = otherBranchCheck ? state.records.commits.get(otherBranchCheck) : void 0;
|
|
125
|
-
if (currentCommit && otherCommit && currentCommit.branch === otherBranch) {
|
|
126
|
-
throw new Error(`Cannot merge branch '${otherBranch}' into itself.`);
|
|
127
|
-
}
|
|
128
|
-
if (state.records.currBranch === otherBranch) {
|
|
129
|
-
const error = 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 = new Error(
|
|
139
|
-
`Incorrect usage of "merge". Current branch (${state.records.currBranch})has no commits`
|
|
140
|
-
);
|
|
141
|
-
error.hash = {
|
|
142
|
-
text: `merge ${otherBranch}`,
|
|
143
|
-
token: `merge ${otherBranch}`,
|
|
144
|
-
expected: ["commit"]
|
|
145
|
-
};
|
|
146
|
-
throw error;
|
|
147
|
-
}
|
|
148
|
-
if (!state.records.branches.has(otherBranch)) {
|
|
149
|
-
const error = new Error(
|
|
150
|
-
'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") does not exist"
|
|
151
|
-
);
|
|
152
|
-
error.hash = {
|
|
153
|
-
text: `merge ${otherBranch}`,
|
|
154
|
-
token: `merge ${otherBranch}`,
|
|
155
|
-
expected: [`branch ${otherBranch}`]
|
|
156
|
-
};
|
|
157
|
-
throw error;
|
|
158
|
-
}
|
|
159
|
-
if (otherCommit === void 0 || !otherCommit) {
|
|
160
|
-
const error = new Error(
|
|
161
|
-
'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") has no commits"
|
|
162
|
-
);
|
|
163
|
-
error.hash = {
|
|
164
|
-
text: `merge ${otherBranch}`,
|
|
165
|
-
token: `merge ${otherBranch}`,
|
|
166
|
-
expected: ['"commit"']
|
|
167
|
-
};
|
|
168
|
-
throw error;
|
|
169
|
-
}
|
|
170
|
-
if (currentCommit === otherCommit) {
|
|
171
|
-
const error = new Error('Incorrect usage of "merge". Both branches have same head');
|
|
172
|
-
error.hash = {
|
|
173
|
-
text: `merge ${otherBranch}`,
|
|
174
|
-
token: `merge ${otherBranch}`,
|
|
175
|
-
expected: ["branch abc"]
|
|
176
|
-
};
|
|
177
|
-
throw error;
|
|
178
|
-
}
|
|
179
|
-
if (customId && state.records.commits.has(customId)) {
|
|
180
|
-
const error = new Error(
|
|
181
|
-
'Incorrect usage of "merge". Commit with id:' + customId + " already exists, use different custom id"
|
|
182
|
-
);
|
|
183
|
-
error.hash = {
|
|
184
|
-
text: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
|
|
185
|
-
token: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
|
|
186
|
-
expected: [
|
|
187
|
-
`merge ${otherBranch} ${customId}_UNIQUE ${overrideType} ${customTags?.join(" ")}`
|
|
188
|
-
]
|
|
189
|
-
};
|
|
190
|
-
throw error;
|
|
191
|
-
}
|
|
192
|
-
const verifiedBranch = otherBranchCheck ? otherBranchCheck : "";
|
|
193
|
-
const commit2 = {
|
|
194
|
-
id: customId || `${state.records.seq}-${getID()}`,
|
|
195
|
-
message: `merged branch ${otherBranch} into ${state.records.currBranch}`,
|
|
196
|
-
seq: state.records.seq++,
|
|
197
|
-
parents: state.records.head == null ? [] : [state.records.head.id, verifiedBranch],
|
|
198
|
-
branch: state.records.currBranch,
|
|
199
|
-
type: commitType.MERGE,
|
|
200
|
-
customType: overrideType,
|
|
201
|
-
customId: customId ? true : false,
|
|
202
|
-
tags: customTags ?? []
|
|
203
|
-
};
|
|
204
|
-
state.records.head = commit2;
|
|
205
|
-
state.records.commits.set(commit2.id, commit2);
|
|
206
|
-
state.records.branches.set(state.records.currBranch, commit2.id);
|
|
207
|
-
log.debug(state.records.branches);
|
|
208
|
-
log.debug("in mergeBranch");
|
|
209
|
-
}, "merge");
|
|
210
|
-
var cherryPick = /* @__PURE__ */ __name(function(cherryPickDB) {
|
|
211
|
-
let sourceId = cherryPickDB.id;
|
|
212
|
-
let targetId = cherryPickDB.targetId;
|
|
213
|
-
let tags = cherryPickDB.tags;
|
|
214
|
-
let parentCommitId = cherryPickDB.parent;
|
|
215
|
-
log.debug("Entering cherryPick:", sourceId, targetId, tags);
|
|
216
|
-
const config = getConfig3();
|
|
217
|
-
sourceId = common_default.sanitizeText(sourceId, config);
|
|
218
|
-
targetId = common_default.sanitizeText(targetId, config);
|
|
219
|
-
tags = tags?.map((tag) => common_default.sanitizeText(tag, config));
|
|
220
|
-
parentCommitId = common_default.sanitizeText(parentCommitId, config);
|
|
221
|
-
if (!sourceId || !state.records.commits.has(sourceId)) {
|
|
222
|
-
const error = new Error(
|
|
223
|
-
'Incorrect usage of "cherryPick". Source commit id should exist and provided'
|
|
224
|
-
);
|
|
225
|
-
error.hash = {
|
|
226
|
-
text: `cherryPick ${sourceId} ${targetId}`,
|
|
227
|
-
token: `cherryPick ${sourceId} ${targetId}`,
|
|
228
|
-
expected: ["cherry-pick abc"]
|
|
229
|
-
};
|
|
230
|
-
throw error;
|
|
231
|
-
}
|
|
232
|
-
const sourceCommit = state.records.commits.get(sourceId);
|
|
233
|
-
if (sourceCommit === void 0 || !sourceCommit) {
|
|
234
|
-
throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
|
|
235
|
-
}
|
|
236
|
-
if (parentCommitId && !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) {
|
|
237
|
-
const error = new Error(
|
|
238
|
-
"Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
|
|
239
|
-
);
|
|
240
|
-
throw error;
|
|
241
|
-
}
|
|
242
|
-
const sourceCommitBranch = sourceCommit.branch;
|
|
243
|
-
if (sourceCommit.type === commitType.MERGE && !parentCommitId) {
|
|
244
|
-
const error = new Error(
|
|
245
|
-
"Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
|
|
246
|
-
);
|
|
247
|
-
throw error;
|
|
248
|
-
}
|
|
249
|
-
if (!targetId || !state.records.commits.has(targetId)) {
|
|
250
|
-
if (sourceCommitBranch === state.records.currBranch) {
|
|
251
|
-
const error = new Error(
|
|
252
|
-
'Incorrect usage of "cherryPick". Source commit is already on current branch'
|
|
253
|
-
);
|
|
254
|
-
error.hash = {
|
|
255
|
-
text: `cherryPick ${sourceId} ${targetId}`,
|
|
256
|
-
token: `cherryPick ${sourceId} ${targetId}`,
|
|
257
|
-
expected: ["cherry-pick abc"]
|
|
258
|
-
};
|
|
259
|
-
throw error;
|
|
260
|
-
}
|
|
261
|
-
const currentCommitId = state.records.branches.get(state.records.currBranch);
|
|
262
|
-
if (currentCommitId === void 0 || !currentCommitId) {
|
|
263
|
-
const error = new Error(
|
|
264
|
-
`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`
|
|
265
|
-
);
|
|
266
|
-
error.hash = {
|
|
267
|
-
text: `cherryPick ${sourceId} ${targetId}`,
|
|
268
|
-
token: `cherryPick ${sourceId} ${targetId}`,
|
|
269
|
-
expected: ["cherry-pick abc"]
|
|
270
|
-
};
|
|
271
|
-
throw error;
|
|
272
|
-
}
|
|
273
|
-
const currentCommit = state.records.commits.get(currentCommitId);
|
|
274
|
-
if (currentCommit === void 0 || !currentCommit) {
|
|
275
|
-
const error = new Error(
|
|
276
|
-
`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`
|
|
277
|
-
);
|
|
278
|
-
error.hash = {
|
|
279
|
-
text: `cherryPick ${sourceId} ${targetId}`,
|
|
280
|
-
token: `cherryPick ${sourceId} ${targetId}`,
|
|
281
|
-
expected: ["cherry-pick abc"]
|
|
282
|
-
};
|
|
283
|
-
throw error;
|
|
284
|
-
}
|
|
285
|
-
const commit2 = {
|
|
286
|
-
id: state.records.seq + "-" + getID(),
|
|
287
|
-
message: `cherry-picked ${sourceCommit?.message} into ${state.records.currBranch}`,
|
|
288
|
-
seq: state.records.seq++,
|
|
289
|
-
parents: state.records.head == null ? [] : [state.records.head.id, sourceCommit.id],
|
|
290
|
-
branch: state.records.currBranch,
|
|
291
|
-
type: commitType.CHERRY_PICK,
|
|
292
|
-
tags: tags ? tags.filter(Boolean) : [
|
|
293
|
-
`cherry-pick:${sourceCommit.id}${sourceCommit.type === commitType.MERGE ? `|parent:${parentCommitId}` : ""}`
|
|
294
|
-
]
|
|
295
|
-
};
|
|
296
|
-
state.records.head = commit2;
|
|
297
|
-
state.records.commits.set(commit2.id, commit2);
|
|
298
|
-
state.records.branches.set(state.records.currBranch, commit2.id);
|
|
299
|
-
log.debug(state.records.branches);
|
|
300
|
-
log.debug("in cherryPick");
|
|
301
|
-
}
|
|
302
|
-
}, "cherryPick");
|
|
303
|
-
var checkout = /* @__PURE__ */ __name(function(branch2) {
|
|
304
|
-
branch2 = common_default.sanitizeText(branch2, getConfig3());
|
|
305
|
-
if (!state.records.branches.has(branch2)) {
|
|
306
|
-
const error = new Error(
|
|
307
|
-
`Trying to checkout branch which is not yet created. (Help try using "branch ${branch2}")`
|
|
308
|
-
);
|
|
309
|
-
error.hash = {
|
|
310
|
-
text: `checkout ${branch2}`,
|
|
311
|
-
token: `checkout ${branch2}`,
|
|
312
|
-
expected: [`branch ${branch2}`]
|
|
313
|
-
};
|
|
314
|
-
throw error;
|
|
315
|
-
} else {
|
|
316
|
-
state.records.currBranch = branch2;
|
|
317
|
-
const id = state.records.branches.get(state.records.currBranch);
|
|
318
|
-
if (id === void 0 || !id) {
|
|
319
|
-
state.records.head = null;
|
|
320
|
-
} else {
|
|
321
|
-
state.records.head = state.records.commits.get(id) ?? null;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}, "checkout");
|
|
325
|
-
function upsert(arr, key, newVal) {
|
|
326
|
-
const index = arr.indexOf(key);
|
|
327
|
-
if (index === -1) {
|
|
328
|
-
arr.push(newVal);
|
|
329
|
-
} else {
|
|
330
|
-
arr.splice(index, 1, newVal);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
__name(upsert, "upsert");
|
|
334
|
-
function prettyPrintCommitHistory(commitArr) {
|
|
335
|
-
const commit2 = commitArr.reduce((out, commit3) => {
|
|
336
|
-
if (out.seq > commit3.seq) {
|
|
337
|
-
return out;
|
|
338
|
-
}
|
|
339
|
-
return commit3;
|
|
340
|
-
}, commitArr[0]);
|
|
341
|
-
let line = "";
|
|
342
|
-
commitArr.forEach(function(c) {
|
|
343
|
-
if (c === commit2) {
|
|
344
|
-
line += " *";
|
|
345
|
-
} else {
|
|
346
|
-
line += " |";
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
const label = [line, commit2.id, commit2.seq];
|
|
350
|
-
for (const branch2 in state.records.branches) {
|
|
351
|
-
if (state.records.branches.get(branch2) === commit2.id) {
|
|
352
|
-
label.push(branch2);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
log.debug(label.join(" "));
|
|
356
|
-
if (commit2.parents && commit2.parents.length == 2 && commit2.parents[0] && commit2.parents[1]) {
|
|
357
|
-
const newCommit = state.records.commits.get(commit2.parents[0]);
|
|
358
|
-
upsert(commitArr, commit2, newCommit);
|
|
359
|
-
if (commit2.parents[1]) {
|
|
360
|
-
commitArr.push(state.records.commits.get(commit2.parents[1]));
|
|
361
|
-
}
|
|
362
|
-
} else if (commit2.parents.length == 0) {
|
|
363
|
-
return;
|
|
364
|
-
} else {
|
|
365
|
-
if (commit2.parents[0]) {
|
|
366
|
-
const newCommit = state.records.commits.get(commit2.parents[0]);
|
|
367
|
-
upsert(commitArr, commit2, newCommit);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
commitArr = uniqBy(commitArr, (c) => c.id);
|
|
371
|
-
prettyPrintCommitHistory(commitArr);
|
|
372
|
-
}
|
|
373
|
-
__name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
|
|
374
|
-
var prettyPrint = /* @__PURE__ */ __name(function() {
|
|
375
|
-
log.debug(state.records.commits);
|
|
376
|
-
const node = getCommitsArray()[0];
|
|
377
|
-
prettyPrintCommitHistory([node]);
|
|
378
|
-
}, "prettyPrint");
|
|
379
|
-
var clear2 = /* @__PURE__ */ __name(function() {
|
|
380
|
-
state.reset();
|
|
381
|
-
clear();
|
|
382
|
-
}, "clear");
|
|
383
|
-
var getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
|
|
384
|
-
const branchesArray = [...state.records.branchConfig.values()].map((branchConfig, i) => {
|
|
385
|
-
if (branchConfig.order !== null && branchConfig.order !== void 0) {
|
|
386
|
-
return branchConfig;
|
|
387
|
-
}
|
|
388
|
-
return {
|
|
389
|
-
...branchConfig,
|
|
390
|
-
order: parseFloat(`0.${i}`)
|
|
391
|
-
};
|
|
392
|
-
}).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map(({ name }) => ({ name }));
|
|
393
|
-
return branchesArray;
|
|
394
|
-
}, "getBranchesAsObjArray");
|
|
395
|
-
var getBranches = /* @__PURE__ */ __name(function() {
|
|
396
|
-
return state.records.branches;
|
|
397
|
-
}, "getBranches");
|
|
398
|
-
var getCommits = /* @__PURE__ */ __name(function() {
|
|
399
|
-
return state.records.commits;
|
|
400
|
-
}, "getCommits");
|
|
401
|
-
var getCommitsArray = /* @__PURE__ */ __name(function() {
|
|
402
|
-
const commitArr = [...state.records.commits.values()];
|
|
403
|
-
commitArr.forEach(function(o) {
|
|
404
|
-
log.debug(o.id);
|
|
405
|
-
});
|
|
406
|
-
commitArr.sort((a, b) => a.seq - b.seq);
|
|
407
|
-
return commitArr;
|
|
408
|
-
}, "getCommitsArray");
|
|
409
|
-
var getCurrentBranch = /* @__PURE__ */ __name(function() {
|
|
410
|
-
return state.records.currBranch;
|
|
411
|
-
}, "getCurrentBranch");
|
|
412
|
-
var getDirection = /* @__PURE__ */ __name(function() {
|
|
413
|
-
return state.records.direction;
|
|
414
|
-
}, "getDirection");
|
|
415
|
-
var getHead = /* @__PURE__ */ __name(function() {
|
|
416
|
-
return state.records.head;
|
|
417
|
-
}, "getHead");
|
|
418
|
-
var db = {
|
|
419
|
-
commitType,
|
|
420
|
-
getConfig: getConfig3,
|
|
421
|
-
setDirection,
|
|
422
|
-
setOptions,
|
|
423
|
-
getOptions,
|
|
424
|
-
commit,
|
|
425
|
-
branch,
|
|
426
|
-
merge,
|
|
427
|
-
cherryPick,
|
|
428
|
-
checkout,
|
|
429
|
-
//reset,
|
|
430
|
-
prettyPrint,
|
|
431
|
-
clear: clear2,
|
|
432
|
-
getBranchesAsObjArray,
|
|
433
|
-
getBranches,
|
|
434
|
-
getCommits,
|
|
435
|
-
getCommitsArray,
|
|
436
|
-
getCurrentBranch,
|
|
437
|
-
getDirection,
|
|
438
|
-
getHead,
|
|
439
|
-
setAccTitle,
|
|
440
|
-
getAccTitle,
|
|
441
|
-
getAccDescription,
|
|
442
|
-
setAccDescription,
|
|
443
|
-
setDiagramTitle,
|
|
444
|
-
getDiagramTitle
|
|
445
|
-
};
|
|
446
|
-
var populate = /* @__PURE__ */ __name((ast, db2) => {
|
|
447
|
-
populateCommonDb(ast, db2);
|
|
448
|
-
if (ast.dir) {
|
|
449
|
-
db2.setDirection(ast.dir);
|
|
450
|
-
}
|
|
451
|
-
for (const statement of ast.statements) {
|
|
452
|
-
parseStatement(statement, db2);
|
|
453
|
-
}
|
|
454
|
-
}, "populate");
|
|
455
|
-
var parseStatement = /* @__PURE__ */ __name((statement, db2) => {
|
|
456
|
-
const parsers = {
|
|
457
|
-
Commit: /* @__PURE__ */ __name((stmt) => db2.commit(parseCommit(stmt)), "Commit"),
|
|
458
|
-
Branch: /* @__PURE__ */ __name((stmt) => db2.branch(parseBranch(stmt)), "Branch"),
|
|
459
|
-
Merge: /* @__PURE__ */ __name((stmt) => db2.merge(parseMerge(stmt)), "Merge"),
|
|
460
|
-
Checkout: /* @__PURE__ */ __name((stmt) => db2.checkout(parseCheckout(stmt)), "Checkout"),
|
|
461
|
-
CherryPicking: /* @__PURE__ */ __name((stmt) => db2.cherryPick(parseCherryPicking(stmt)), "CherryPicking")
|
|
462
|
-
};
|
|
463
|
-
const parser2 = parsers[statement.$type];
|
|
464
|
-
if (parser2) {
|
|
465
|
-
parser2(statement);
|
|
466
|
-
} else {
|
|
467
|
-
log.error(`Unknown statement type: ${statement.$type}`);
|
|
468
|
-
}
|
|
469
|
-
}, "parseStatement");
|
|
470
|
-
var parseCommit = /* @__PURE__ */ __name((commit2) => {
|
|
471
|
-
const commitDB = {
|
|
472
|
-
id: commit2.id,
|
|
473
|
-
msg: commit2.message ?? "",
|
|
474
|
-
type: commit2.type !== void 0 ? commitType[commit2.type] : commitType.NORMAL,
|
|
475
|
-
tags: commit2.tags ?? void 0
|
|
476
|
-
};
|
|
477
|
-
return commitDB;
|
|
478
|
-
}, "parseCommit");
|
|
479
|
-
var parseBranch = /* @__PURE__ */ __name((branch2) => {
|
|
480
|
-
const branchDB = {
|
|
481
|
-
name: branch2.name,
|
|
482
|
-
order: branch2.order ?? 0
|
|
483
|
-
};
|
|
484
|
-
return branchDB;
|
|
485
|
-
}, "parseBranch");
|
|
486
|
-
var parseMerge = /* @__PURE__ */ __name((merge2) => {
|
|
487
|
-
const mergeDB = {
|
|
488
|
-
branch: merge2.branch,
|
|
489
|
-
id: merge2.id ?? "",
|
|
490
|
-
type: merge2.type !== void 0 ? commitType[merge2.type] : void 0,
|
|
491
|
-
tags: merge2.tags ?? void 0
|
|
492
|
-
};
|
|
493
|
-
return mergeDB;
|
|
494
|
-
}, "parseMerge");
|
|
495
|
-
var parseCheckout = /* @__PURE__ */ __name((checkout2) => {
|
|
496
|
-
const branch2 = checkout2.branch;
|
|
497
|
-
return branch2;
|
|
498
|
-
}, "parseCheckout");
|
|
499
|
-
var parseCherryPicking = /* @__PURE__ */ __name((cherryPicking) => {
|
|
500
|
-
const cherryPickDB = {
|
|
501
|
-
id: cherryPicking.id,
|
|
502
|
-
targetId: "",
|
|
503
|
-
tags: cherryPicking.tags?.length === 0 ? void 0 : cherryPicking.tags,
|
|
504
|
-
parent: cherryPicking.parent
|
|
505
|
-
};
|
|
506
|
-
return cherryPickDB;
|
|
507
|
-
}, "parseCherryPicking");
|
|
508
|
-
var parser = {
|
|
509
|
-
parse: /* @__PURE__ */ __name(async (input) => {
|
|
510
|
-
const ast = await parse("gitGraph", input);
|
|
511
|
-
log.debug(ast);
|
|
512
|
-
populate(ast, db);
|
|
513
|
-
}, "parse")
|
|
514
|
-
};
|
|
515
|
-
var LAYOUT_OFFSET = 10;
|
|
516
|
-
var COMMIT_STEP = 40;
|
|
517
|
-
var PX = 4;
|
|
518
|
-
var PY = 2;
|
|
519
|
-
var THEME_COLOR_LIMIT = 8;
|
|
520
|
-
var REDUX_GEOMETRY_THEMES = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]);
|
|
521
|
-
var REDUX_BRANCH_LABEL_PADDING_Y = 12;
|
|
522
|
-
var COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
|
|
523
|
-
var DARK_THEMES = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]);
|
|
524
|
-
var calcColorIndex = /* @__PURE__ */ __name((rawIndex, limit, avoidDefaultColor = false) => {
|
|
525
|
-
if (avoidDefaultColor && rawIndex > 0) {
|
|
526
|
-
return (rawIndex - 1) % (limit - 1) + 1;
|
|
527
|
-
}
|
|
528
|
-
return rawIndex % limit;
|
|
529
|
-
}, "calcColorIndex");
|
|
530
|
-
var branchPos = /* @__PURE__ */ new Map();
|
|
531
|
-
var commitPos = /* @__PURE__ */ new Map();
|
|
532
|
-
var defaultPos = 30;
|
|
533
|
-
var allCommitsDict = /* @__PURE__ */ new Map();
|
|
534
|
-
var lanes = [];
|
|
535
|
-
var maxPos = 0;
|
|
536
|
-
var dir = "LR";
|
|
537
|
-
var clear3 = /* @__PURE__ */ __name(() => {
|
|
538
|
-
branchPos.clear();
|
|
539
|
-
commitPos.clear();
|
|
540
|
-
allCommitsDict.clear();
|
|
541
|
-
maxPos = 0;
|
|
542
|
-
lanes = [];
|
|
543
|
-
dir = "LR";
|
|
544
|
-
}, "clear");
|
|
545
|
-
var drawText = /* @__PURE__ */ __name((txt) => {
|
|
546
|
-
const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
547
|
-
const rows = typeof txt === "string" ? txt.split(/\\n|\n|<br\s*\/?>/gi) : txt;
|
|
548
|
-
rows.forEach((row) => {
|
|
549
|
-
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
550
|
-
tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
551
|
-
tspan.setAttribute("dy", "1em");
|
|
552
|
-
tspan.setAttribute("x", "0");
|
|
553
|
-
tspan.setAttribute("class", "row");
|
|
554
|
-
tspan.textContent = row.trim();
|
|
555
|
-
svgLabel.appendChild(tspan);
|
|
556
|
-
});
|
|
557
|
-
return svgLabel;
|
|
558
|
-
}, "drawText");
|
|
559
|
-
var findClosestParent = /* @__PURE__ */ __name((parents) => {
|
|
560
|
-
let closestParent;
|
|
561
|
-
let comparisonFunc;
|
|
562
|
-
let targetPosition;
|
|
563
|
-
if (dir === "BT") {
|
|
564
|
-
comparisonFunc = /* @__PURE__ */ __name((a, b) => a <= b, "comparisonFunc");
|
|
565
|
-
targetPosition = Infinity;
|
|
566
|
-
} else {
|
|
567
|
-
comparisonFunc = /* @__PURE__ */ __name((a, b) => a >= b, "comparisonFunc");
|
|
568
|
-
targetPosition = 0;
|
|
569
|
-
}
|
|
570
|
-
parents.forEach((parent) => {
|
|
571
|
-
const parentPosition = dir === "TB" || dir == "BT" ? commitPos.get(parent)?.y : commitPos.get(parent)?.x;
|
|
572
|
-
if (parentPosition !== void 0 && comparisonFunc(parentPosition, targetPosition)) {
|
|
573
|
-
closestParent = parent;
|
|
574
|
-
targetPosition = parentPosition;
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
return closestParent;
|
|
578
|
-
}, "findClosestParent");
|
|
579
|
-
var findClosestParentBT = /* @__PURE__ */ __name((parents) => {
|
|
580
|
-
let closestParent = "";
|
|
581
|
-
let maxPosition = Infinity;
|
|
582
|
-
parents.forEach((parent) => {
|
|
583
|
-
const parentPosition = commitPos.get(parent).y;
|
|
584
|
-
if (parentPosition <= maxPosition) {
|
|
585
|
-
closestParent = parent;
|
|
586
|
-
maxPosition = parentPosition;
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
return closestParent || void 0;
|
|
590
|
-
}, "findClosestParentBT");
|
|
591
|
-
var setParallelBTPos = /* @__PURE__ */ __name((sortedKeys, commits, defaultPos2) => {
|
|
592
|
-
let curPos = defaultPos2;
|
|
593
|
-
let maxPosition = defaultPos2;
|
|
594
|
-
const roots = [];
|
|
595
|
-
sortedKeys.forEach((key) => {
|
|
596
|
-
const commit2 = commits.get(key);
|
|
597
|
-
if (!commit2) {
|
|
598
|
-
throw new Error(`Commit not found for key ${key}`);
|
|
599
|
-
}
|
|
600
|
-
if (commit2.parents.length) {
|
|
601
|
-
curPos = calculateCommitPosition(commit2);
|
|
602
|
-
maxPosition = Math.max(curPos, maxPosition);
|
|
603
|
-
} else {
|
|
604
|
-
roots.push(commit2);
|
|
605
|
-
}
|
|
606
|
-
setCommitPosition(commit2, curPos);
|
|
607
|
-
});
|
|
608
|
-
curPos = maxPosition;
|
|
609
|
-
roots.forEach((commit2) => {
|
|
610
|
-
setRootPosition(commit2, curPos, defaultPos2);
|
|
611
|
-
});
|
|
612
|
-
sortedKeys.forEach((key) => {
|
|
613
|
-
const commit2 = commits.get(key);
|
|
614
|
-
if (commit2?.parents.length) {
|
|
615
|
-
const closestParent = findClosestParentBT(commit2.parents);
|
|
616
|
-
curPos = commitPos.get(closestParent).y - COMMIT_STEP;
|
|
617
|
-
if (curPos <= maxPosition) {
|
|
618
|
-
maxPosition = curPos;
|
|
619
|
-
}
|
|
620
|
-
const x = branchPos.get(commit2.branch).pos;
|
|
621
|
-
const y = curPos - LAYOUT_OFFSET;
|
|
622
|
-
commitPos.set(commit2.id, { x, y });
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
}, "setParallelBTPos");
|
|
626
|
-
var findClosestParentPos = /* @__PURE__ */ __name((commit2) => {
|
|
627
|
-
const closestParent = findClosestParent(commit2.parents.filter((p) => p !== null));
|
|
628
|
-
if (!closestParent) {
|
|
629
|
-
throw new Error(`Closest parent not found for commit ${commit2.id}`);
|
|
630
|
-
}
|
|
631
|
-
const closestParentPos = commitPos.get(closestParent)?.y;
|
|
632
|
-
if (closestParentPos === void 0) {
|
|
633
|
-
throw new Error(`Closest parent position not found for commit ${commit2.id}`);
|
|
634
|
-
}
|
|
635
|
-
return closestParentPos;
|
|
636
|
-
}, "findClosestParentPos");
|
|
637
|
-
var calculateCommitPosition = /* @__PURE__ */ __name((commit2) => {
|
|
638
|
-
const closestParentPos = findClosestParentPos(commit2);
|
|
639
|
-
return closestParentPos + COMMIT_STEP;
|
|
640
|
-
}, "calculateCommitPosition");
|
|
641
|
-
var setCommitPosition = /* @__PURE__ */ __name((commit2, curPos) => {
|
|
642
|
-
const branch2 = branchPos.get(commit2.branch);
|
|
643
|
-
if (!branch2) {
|
|
644
|
-
throw new Error(`Branch not found for commit ${commit2.id}`);
|
|
645
|
-
}
|
|
646
|
-
const x = branch2.pos;
|
|
647
|
-
const y = curPos + LAYOUT_OFFSET;
|
|
648
|
-
commitPos.set(commit2.id, { x, y });
|
|
649
|
-
return { x, y };
|
|
650
|
-
}, "setCommitPosition");
|
|
651
|
-
var setRootPosition = /* @__PURE__ */ __name((commit2, curPos, defaultPos2) => {
|
|
652
|
-
const branch2 = branchPos.get(commit2.branch);
|
|
653
|
-
if (!branch2) {
|
|
654
|
-
throw new Error(`Branch not found for commit ${commit2.id}`);
|
|
655
|
-
}
|
|
656
|
-
const y = curPos + defaultPos2;
|
|
657
|
-
const x = branch2.pos;
|
|
658
|
-
commitPos.set(commit2.id, { x, y });
|
|
659
|
-
}, "setRootPosition");
|
|
660
|
-
var drawCommitBullet = /* @__PURE__ */ __name((gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType) => {
|
|
661
|
-
const { theme } = getConfig2();
|
|
662
|
-
const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(theme ?? "");
|
|
663
|
-
const useColorTheme = COLOR_THEMES.has(theme ?? "");
|
|
664
|
-
const isDark = DARK_THEMES.has(theme ?? "");
|
|
665
|
-
if (commitSymbolType === commitType.HIGHLIGHT) {
|
|
666
|
-
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(
|
|
667
|
-
"class",
|
|
668
|
-
`commit ${commit2.id} commit-highlight${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)} ${typeClass}-outer`
|
|
669
|
-
);
|
|
670
|
-
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(
|
|
671
|
-
"class",
|
|
672
|
-
`commit ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)} ${typeClass}-inner`
|
|
673
|
-
);
|
|
674
|
-
} else if (commitSymbolType === commitType.CHERRY_PICK) {
|
|
675
|
-
gBullets.append("circle").attr("cx", commitPosition.x).attr("cy", commitPosition.y).attr("r", useReduxGeometry ? 7 : 10).attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
676
|
-
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}`);
|
|
677
|
-
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}`);
|
|
678
|
-
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}`);
|
|
679
|
-
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}`);
|
|
680
|
-
} else {
|
|
681
|
-
const circle = gBullets.append("circle");
|
|
682
|
-
circle.attr("cx", commitPosition.x);
|
|
683
|
-
circle.attr("cy", commitPosition.y);
|
|
684
|
-
circle.attr("r", useReduxGeometry ? 7 : 10);
|
|
685
|
-
circle.attr(
|
|
686
|
-
"class",
|
|
687
|
-
`commit ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`
|
|
688
|
-
);
|
|
689
|
-
if (commitSymbolType === commitType.MERGE) {
|
|
690
|
-
const circle2 = gBullets.append("circle");
|
|
691
|
-
circle2.attr("cx", commitPosition.x);
|
|
692
|
-
circle2.attr("cy", commitPosition.y);
|
|
693
|
-
circle2.attr("r", useReduxGeometry ? 5 : 6);
|
|
694
|
-
circle2.attr(
|
|
695
|
-
"class",
|
|
696
|
-
`commit ${typeClass} ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`
|
|
697
|
-
);
|
|
698
|
-
}
|
|
699
|
-
if (commitSymbolType === commitType.REVERSE) {
|
|
700
|
-
const cross = gBullets.append("path");
|
|
701
|
-
const constValue = useReduxGeometry ? 4 : 5;
|
|
702
|
-
cross.attr(
|
|
703
|
-
"d",
|
|
704
|
-
`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}`
|
|
705
|
-
).attr(
|
|
706
|
-
"class",
|
|
707
|
-
`commit ${typeClass} ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}`
|
|
708
|
-
);
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}, "drawCommitBullet");
|
|
712
|
-
var drawCommitLabel = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos, gitGraphConfig) => {
|
|
713
|
-
if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && gitGraphConfig.showCommitLabel) {
|
|
714
|
-
const wrapper = gLabels.append("g");
|
|
715
|
-
const labelBkg = wrapper.insert("rect").attr("class", "commit-label-bkg");
|
|
716
|
-
const text = wrapper.append("text").attr("x", pos).attr("y", commitPosition.y + 25).attr("class", "commit-label").text(commit2.id);
|
|
717
|
-
const bbox = text.node()?.getBBox();
|
|
718
|
-
if (bbox) {
|
|
719
|
-
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);
|
|
720
|
-
if (dir === "TB" || dir === "BT") {
|
|
721
|
-
labelBkg.attr("x", commitPosition.x - (bbox.width + 4 * PX + 5)).attr("y", commitPosition.y - 12);
|
|
722
|
-
text.attr("x", commitPosition.x - (bbox.width + 4 * PX)).attr("y", commitPosition.y + bbox.height - 12);
|
|
723
|
-
} else {
|
|
724
|
-
text.attr("x", commitPosition.posWithOffset - bbox.width / 2);
|
|
725
|
-
}
|
|
726
|
-
if (gitGraphConfig.rotateCommitLabel) {
|
|
727
|
-
if (dir === "TB" || dir === "BT") {
|
|
728
|
-
text.attr(
|
|
729
|
-
"transform",
|
|
730
|
-
"rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
|
|
731
|
-
);
|
|
732
|
-
labelBkg.attr(
|
|
733
|
-
"transform",
|
|
734
|
-
"rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
|
|
735
|
-
);
|
|
736
|
-
} else {
|
|
737
|
-
const r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;
|
|
738
|
-
const r_y = 10 + bbox.width / 25 * 8.5;
|
|
739
|
-
wrapper.attr(
|
|
740
|
-
"transform",
|
|
741
|
-
"translate(" + r_x + ", " + r_y + ") rotate(-45, " + pos + ", " + commitPosition.y + ")"
|
|
742
|
-
);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
}, "drawCommitLabel");
|
|
748
|
-
var drawCommitTags = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
|
|
749
|
-
if (commit2.tags.length > 0) {
|
|
750
|
-
let yOffset = 0;
|
|
751
|
-
let maxTagBboxWidth = 0;
|
|
752
|
-
let maxTagBboxHeight = 0;
|
|
753
|
-
const tagElements = [];
|
|
754
|
-
for (const tagValue of commit2.tags.reverse()) {
|
|
755
|
-
const rect = gLabels.insert("polygon");
|
|
756
|
-
const hole = gLabels.append("circle");
|
|
757
|
-
const tag = gLabels.append("text").attr("y", commitPosition.y - 16 - yOffset).attr("class", "tag-label").text(tagValue);
|
|
758
|
-
const tagBbox = tag.node()?.getBBox();
|
|
759
|
-
if (!tagBbox) {
|
|
760
|
-
throw new Error("Tag bbox not found");
|
|
761
|
-
}
|
|
762
|
-
maxTagBboxWidth = Math.max(maxTagBboxWidth, tagBbox.width);
|
|
763
|
-
maxTagBboxHeight = Math.max(maxTagBboxHeight, tagBbox.height);
|
|
764
|
-
tag.attr("x", commitPosition.posWithOffset - tagBbox.width / 2);
|
|
765
|
-
tagElements.push({
|
|
766
|
-
tag,
|
|
767
|
-
hole,
|
|
768
|
-
rect,
|
|
769
|
-
yOffset
|
|
770
|
-
});
|
|
771
|
-
yOffset += 20;
|
|
772
|
-
}
|
|
773
|
-
for (const { tag, hole, rect, yOffset: yOffset2 } of tagElements) {
|
|
774
|
-
const h2 = maxTagBboxHeight / 2;
|
|
775
|
-
const ly = commitPosition.y - 19.2 - yOffset2;
|
|
776
|
-
rect.attr("class", "tag-label-bkg").attr(
|
|
777
|
-
"points",
|
|
778
|
-
`
|
|
779
|
-
${pos - maxTagBboxWidth / 2 - PX / 2},${ly + PY}
|
|
780
|
-
${pos - maxTagBboxWidth / 2 - PX / 2},${ly - PY}
|
|
781
|
-
${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly - h2 - PY}
|
|
782
|
-
${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly - h2 - PY}
|
|
783
|
-
${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly + h2 + PY}
|
|
784
|
-
${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly + h2 + PY}`
|
|
785
|
-
);
|
|
786
|
-
hole.attr("cy", ly).attr("cx", pos - maxTagBboxWidth / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole");
|
|
787
|
-
if (dir === "TB" || dir === "BT") {
|
|
788
|
-
const yOrigin = pos + yOffset2;
|
|
789
|
-
rect.attr("class", "tag-label-bkg").attr(
|
|
790
|
-
"points",
|
|
791
|
-
`
|
|
792
|
-
${commitPosition.x},${yOrigin + 2}
|
|
793
|
-
${commitPosition.x},${yOrigin - 2}
|
|
794
|
-
${commitPosition.x + LAYOUT_OFFSET},${yOrigin - h2 - 2}
|
|
795
|
-
${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin - h2 - 2}
|
|
796
|
-
${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin + h2 + 2}
|
|
797
|
-
${commitPosition.x + LAYOUT_OFFSET},${yOrigin + h2 + 2}`
|
|
798
|
-
).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
799
|
-
hole.attr("cx", commitPosition.x + PX / 2).attr("cy", yOrigin).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
800
|
-
tag.attr("x", commitPosition.x + 5).attr("y", yOrigin + 3).attr("transform", "translate(14,14) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
}, "drawCommitTags");
|
|
805
|
-
var getCommitClassType = /* @__PURE__ */ __name((commit2) => {
|
|
806
|
-
const commitSymbolType = commit2.customType ?? commit2.type;
|
|
807
|
-
switch (commitSymbolType) {
|
|
808
|
-
case commitType.NORMAL:
|
|
809
|
-
return "commit-normal";
|
|
810
|
-
case commitType.REVERSE:
|
|
811
|
-
return "commit-reverse";
|
|
812
|
-
case commitType.HIGHLIGHT:
|
|
813
|
-
return "commit-highlight";
|
|
814
|
-
case commitType.MERGE:
|
|
815
|
-
return "commit-merge";
|
|
816
|
-
case commitType.CHERRY_PICK:
|
|
817
|
-
return "commit-cherry-pick";
|
|
818
|
-
default:
|
|
819
|
-
return "commit-normal";
|
|
820
|
-
}
|
|
821
|
-
}, "getCommitClassType");
|
|
822
|
-
var calculatePosition = /* @__PURE__ */ __name((commit2, dir2, pos, commitPos2) => {
|
|
823
|
-
const defaultCommitPosition = { x: 0, y: 0 };
|
|
824
|
-
if (commit2.parents.length > 0) {
|
|
825
|
-
const closestParent = findClosestParent(commit2.parents);
|
|
826
|
-
if (closestParent) {
|
|
827
|
-
const parentPosition = commitPos2.get(closestParent) ?? defaultCommitPosition;
|
|
828
|
-
if (dir2 === "TB") {
|
|
829
|
-
return parentPosition.y + COMMIT_STEP;
|
|
830
|
-
} else if (dir2 === "BT") {
|
|
831
|
-
const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
|
|
832
|
-
return currentPosition.y - COMMIT_STEP;
|
|
833
|
-
} else {
|
|
834
|
-
return parentPosition.x + COMMIT_STEP;
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
} else {
|
|
838
|
-
if (dir2 === "TB") {
|
|
839
|
-
return defaultPos;
|
|
840
|
-
} else if (dir2 === "BT") {
|
|
841
|
-
const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
|
|
842
|
-
return currentPosition.y - COMMIT_STEP;
|
|
843
|
-
} else {
|
|
844
|
-
return 0;
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
return 0;
|
|
848
|
-
}, "calculatePosition");
|
|
849
|
-
var getCommitPosition = /* @__PURE__ */ __name((commit2, pos, isParallelCommits) => {
|
|
850
|
-
const posWithOffset = dir === "BT" && isParallelCommits ? pos : pos + LAYOUT_OFFSET;
|
|
851
|
-
const branchY = branchPos.get(commit2.branch)?.pos;
|
|
852
|
-
const x = dir === "TB" || dir === "BT" ? branchPos.get(commit2.branch)?.pos : posWithOffset;
|
|
853
|
-
if (x === void 0 || branchY === void 0) {
|
|
854
|
-
throw new Error(`Position were undefined for commit ${commit2.id}`);
|
|
855
|
-
}
|
|
856
|
-
const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(getConfig2().theme ?? "");
|
|
857
|
-
const y = dir === "TB" || dir === "BT" ? posWithOffset : branchY + (useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : -2);
|
|
858
|
-
return { x, y, posWithOffset };
|
|
859
|
-
}, "getCommitPosition");
|
|
860
|
-
var drawCommits = /* @__PURE__ */ __name((svg, commits, modifyGraph, gitGraphConfig) => {
|
|
861
|
-
const gBullets = svg.append("g").attr("class", "commit-bullets");
|
|
862
|
-
const gLabels = svg.append("g").attr("class", "commit-labels");
|
|
863
|
-
let pos = dir === "TB" || dir === "BT" ? defaultPos : 0;
|
|
864
|
-
const keys = [...commits.keys()];
|
|
865
|
-
const isParallelCommits = gitGraphConfig.parallelCommits ?? false;
|
|
866
|
-
const sortKeys = /* @__PURE__ */ __name((a, b) => {
|
|
867
|
-
const seqA = commits.get(a)?.seq;
|
|
868
|
-
const seqB = commits.get(b)?.seq;
|
|
869
|
-
return seqA !== void 0 && seqB !== void 0 ? seqA - seqB : 0;
|
|
870
|
-
}, "sortKeys");
|
|
871
|
-
let sortedKeys = keys.sort(sortKeys);
|
|
872
|
-
if (dir === "BT") {
|
|
873
|
-
if (isParallelCommits) {
|
|
874
|
-
setParallelBTPos(sortedKeys, commits, pos);
|
|
875
|
-
}
|
|
876
|
-
sortedKeys = sortedKeys.reverse();
|
|
877
|
-
}
|
|
878
|
-
sortedKeys.forEach((key) => {
|
|
879
|
-
const commit2 = commits.get(key);
|
|
880
|
-
if (!commit2) {
|
|
881
|
-
throw new Error(`Commit not found for key ${key}`);
|
|
882
|
-
}
|
|
883
|
-
if (isParallelCommits) {
|
|
884
|
-
pos = calculatePosition(commit2, dir, pos, commitPos);
|
|
885
|
-
}
|
|
886
|
-
const commitPosition = getCommitPosition(commit2, pos, isParallelCommits);
|
|
887
|
-
if (modifyGraph) {
|
|
888
|
-
const typeClass = getCommitClassType(commit2);
|
|
889
|
-
const commitSymbolType = commit2.customType ?? commit2.type;
|
|
890
|
-
const branchIndex = branchPos.get(commit2.branch)?.index ?? 0;
|
|
891
|
-
drawCommitBullet(gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType);
|
|
892
|
-
drawCommitLabel(gLabels, commit2, commitPosition, pos, gitGraphConfig);
|
|
893
|
-
drawCommitTags(gLabels, commit2, commitPosition, pos);
|
|
894
|
-
}
|
|
895
|
-
if (dir === "TB" || dir === "BT") {
|
|
896
|
-
commitPos.set(commit2.id, { x: commitPosition.x, y: commitPosition.posWithOffset });
|
|
897
|
-
} else {
|
|
898
|
-
commitPos.set(commit2.id, { x: commitPosition.posWithOffset, y: commitPosition.y });
|
|
899
|
-
}
|
|
900
|
-
pos = dir === "BT" && isParallelCommits ? pos + COMMIT_STEP : pos + COMMIT_STEP + LAYOUT_OFFSET;
|
|
901
|
-
if (pos > maxPos) {
|
|
902
|
-
maxPos = pos;
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
}, "drawCommits");
|
|
906
|
-
var shouldRerouteArrow = /* @__PURE__ */ __name((commitA, commitB, p1, p2, allCommits) => {
|
|
907
|
-
const commitBIsFurthest = dir === "TB" || dir === "BT" ? p1.x < p2.x : p1.y < p2.y;
|
|
908
|
-
const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch;
|
|
909
|
-
const isOnBranchToGetCurve = /* @__PURE__ */ __name((x) => x.branch === branchToGetCurve, "isOnBranchToGetCurve");
|
|
910
|
-
const isBetweenCommits = /* @__PURE__ */ __name((x) => x.seq > commitA.seq && x.seq < commitB.seq, "isBetweenCommits");
|
|
911
|
-
return [...allCommits.values()].some((commitX) => {
|
|
912
|
-
return isBetweenCommits(commitX) && isOnBranchToGetCurve(commitX);
|
|
913
|
-
});
|
|
914
|
-
}, "shouldRerouteArrow");
|
|
915
|
-
var findLane = /* @__PURE__ */ __name((y1, y2, depth = 0) => {
|
|
916
|
-
const candidate = y1 + Math.abs(y1 - y2) / 2;
|
|
917
|
-
if (depth > 5) {
|
|
918
|
-
return candidate;
|
|
919
|
-
}
|
|
920
|
-
const ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10);
|
|
921
|
-
if (ok) {
|
|
922
|
-
lanes.push(candidate);
|
|
923
|
-
return candidate;
|
|
924
|
-
}
|
|
925
|
-
const diff = Math.abs(y1 - y2);
|
|
926
|
-
return findLane(y1, y2 - diff / 5, depth + 1);
|
|
927
|
-
}, "findLane");
|
|
928
|
-
var drawArrow = /* @__PURE__ */ __name((svg, commitA, commitB, allCommits) => {
|
|
929
|
-
const { theme: arrowTheme } = getConfig2();
|
|
930
|
-
const useColorTheme = COLOR_THEMES.has(arrowTheme ?? "");
|
|
931
|
-
const p1 = commitPos.get(commitA.id);
|
|
932
|
-
const p2 = commitPos.get(commitB.id);
|
|
933
|
-
if (p1 === void 0 || p2 === void 0) {
|
|
934
|
-
throw new Error(`Commit positions not found for commits ${commitA.id} and ${commitB.id}`);
|
|
935
|
-
}
|
|
936
|
-
const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p2, allCommits);
|
|
937
|
-
let arc = "";
|
|
938
|
-
let arc2 = "";
|
|
939
|
-
let radius = 0;
|
|
940
|
-
let offset = 0;
|
|
941
|
-
let colorClassNum = branchPos.get(commitB.branch)?.index;
|
|
942
|
-
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
943
|
-
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
944
|
-
}
|
|
945
|
-
let lineDef;
|
|
946
|
-
if (arrowNeedsRerouting) {
|
|
947
|
-
arc = "A 10 10, 0, 0, 0,";
|
|
948
|
-
arc2 = "A 10 10, 0, 0, 1,";
|
|
949
|
-
radius = 10;
|
|
950
|
-
offset = 10;
|
|
951
|
-
const lineY = p1.y < p2.y ? findLane(p1.y, p2.y) : findLane(p2.y, p1.y);
|
|
952
|
-
const lineX = p1.x < p2.x ? findLane(p1.x, p2.x) : findLane(p2.x, p1.x);
|
|
953
|
-
if (dir === "TB") {
|
|
954
|
-
if (p1.x < p2.x) {
|
|
955
|
-
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}`;
|
|
956
|
-
} else {
|
|
957
|
-
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
958
|
-
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}`;
|
|
959
|
-
}
|
|
960
|
-
} else if (dir === "BT") {
|
|
961
|
-
if (p1.x < p2.x) {
|
|
962
|
-
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}`;
|
|
963
|
-
} else {
|
|
964
|
-
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
965
|
-
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}`;
|
|
966
|
-
}
|
|
967
|
-
} else {
|
|
968
|
-
if (p1.y < p2.y) {
|
|
969
|
-
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}`;
|
|
970
|
-
} else {
|
|
971
|
-
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
972
|
-
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}`;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
} else {
|
|
976
|
-
arc = "A 20 20, 0, 0, 0,";
|
|
977
|
-
arc2 = "A 20 20, 0, 0, 1,";
|
|
978
|
-
radius = 20;
|
|
979
|
-
offset = 20;
|
|
980
|
-
if (dir === "TB") {
|
|
981
|
-
if (p1.x < p2.x) {
|
|
982
|
-
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
983
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
984
|
-
} else {
|
|
985
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
if (p1.x > p2.x) {
|
|
989
|
-
arc = "A 20 20, 0, 0, 0,";
|
|
990
|
-
arc2 = "A 20 20, 0, 0, 1,";
|
|
991
|
-
radius = 20;
|
|
992
|
-
offset = 20;
|
|
993
|
-
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
994
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc2} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
995
|
-
} else {
|
|
996
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
if (p1.x === p2.x) {
|
|
1000
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
1001
|
-
}
|
|
1002
|
-
} else if (dir === "BT") {
|
|
1003
|
-
if (p1.x < p2.x) {
|
|
1004
|
-
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
1005
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
1006
|
-
} else {
|
|
1007
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
if (p1.x > p2.x) {
|
|
1011
|
-
arc = "A 20 20, 0, 0, 0,";
|
|
1012
|
-
arc2 = "A 20 20, 0, 0, 1,";
|
|
1013
|
-
radius = 20;
|
|
1014
|
-
offset = 20;
|
|
1015
|
-
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
1016
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
1017
|
-
} else {
|
|
1018
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc2} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
if (p1.x === p2.x) {
|
|
1022
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
1023
|
-
}
|
|
1024
|
-
} else {
|
|
1025
|
-
if (p1.y < p2.y) {
|
|
1026
|
-
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
1027
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
1028
|
-
} else {
|
|
1029
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
if (p1.y > p2.y) {
|
|
1033
|
-
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
1034
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
1035
|
-
} else {
|
|
1036
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
if (p1.y === p2.y) {
|
|
1040
|
-
lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
if (lineDef === void 0) {
|
|
1045
|
-
throw new Error("Line definition not found");
|
|
1046
|
-
}
|
|
1047
|
-
svg.append("path").attr("d", lineDef).attr(
|
|
1048
|
-
"class",
|
|
1049
|
-
"arrow arrow" + calcColorIndex(colorClassNum, THEME_COLOR_LIMIT, useColorTheme)
|
|
1050
|
-
);
|
|
1051
|
-
}, "drawArrow");
|
|
1052
|
-
var drawArrows = /* @__PURE__ */ __name((svg, commits) => {
|
|
1053
|
-
const gArrows = svg.append("g").attr("class", "commit-arrows");
|
|
1054
|
-
[...commits.keys()].forEach((key) => {
|
|
1055
|
-
const commit2 = commits.get(key);
|
|
1056
|
-
if (commit2.parents && commit2.parents.length > 0) {
|
|
1057
|
-
commit2.parents.forEach((parent) => {
|
|
1058
|
-
drawArrow(gArrows, commits.get(parent), commit2, commits);
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1062
|
-
}, "drawArrows");
|
|
1063
|
-
var drawBranches = /* @__PURE__ */ __name((svg, branches, gitGraphConfig, id) => {
|
|
1064
|
-
const { look, theme, themeVariables } = getConfig2();
|
|
1065
|
-
const { dropShadow, THEME_COLOR_LIMIT: themeColorLimit } = themeVariables;
|
|
1066
|
-
const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(theme ?? "");
|
|
1067
|
-
const useColorTheme = COLOR_THEMES.has(theme ?? "");
|
|
1068
|
-
const g = svg.append("g");
|
|
1069
|
-
branches.forEach((branch2, index) => {
|
|
1070
|
-
const adjustIndexForTheme = calcColorIndex(
|
|
1071
|
-
index,
|
|
1072
|
-
useReduxGeometry ? themeColorLimit : THEME_COLOR_LIMIT,
|
|
1073
|
-
useColorTheme
|
|
1074
|
-
);
|
|
1075
|
-
const pos = branchPos.get(branch2.name)?.pos;
|
|
1076
|
-
if (pos === void 0) {
|
|
1077
|
-
throw new Error(`Position not found for branch ${branch2.name}`);
|
|
1078
|
-
}
|
|
1079
|
-
const spineY = dir === "TB" || dir === "BT" ? pos : useReduxGeometry ? pos + REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : pos - 2;
|
|
1080
|
-
const line = g.append("line");
|
|
1081
|
-
line.attr("x1", 0);
|
|
1082
|
-
line.attr("y1", spineY);
|
|
1083
|
-
line.attr("x2", maxPos);
|
|
1084
|
-
line.attr("y2", spineY);
|
|
1085
|
-
line.attr("class", "branch branch" + adjustIndexForTheme);
|
|
1086
|
-
if (dir === "TB") {
|
|
1087
|
-
line.attr("y1", defaultPos);
|
|
1088
|
-
line.attr("x1", pos);
|
|
1089
|
-
line.attr("y2", maxPos);
|
|
1090
|
-
line.attr("x2", pos);
|
|
1091
|
-
} else if (dir === "BT") {
|
|
1092
|
-
line.attr("y1", maxPos);
|
|
1093
|
-
line.attr("x1", pos);
|
|
1094
|
-
line.attr("y2", defaultPos);
|
|
1095
|
-
line.attr("x2", pos);
|
|
1096
|
-
}
|
|
1097
|
-
lanes.push(spineY);
|
|
1098
|
-
const name = branch2.name;
|
|
1099
|
-
const labelElement = drawText(name);
|
|
1100
|
-
const bkg = g.insert("rect");
|
|
1101
|
-
const branchLabel = g.insert("g").attr("class", "branchLabel");
|
|
1102
|
-
const label = branchLabel.insert("g").attr("class", "label branch-label" + adjustIndexForTheme);
|
|
1103
|
-
label.node().appendChild(labelElement);
|
|
1104
|
-
const bbox = labelElement.getBBox();
|
|
1105
|
-
const borderRadius = useReduxGeometry ? 0 : 4;
|
|
1106
|
-
const labelPaddingX = useReduxGeometry ? 16 : 0;
|
|
1107
|
-
const labelPaddingY = useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y : 0;
|
|
1108
|
-
if (look === "neo") {
|
|
1109
|
-
bkg.attr("data-look", `neo`);
|
|
1110
|
-
}
|
|
1111
|
-
bkg.attr("class", "branchLabelBkg label" + adjustIndexForTheme).attr(
|
|
1112
|
-
"style",
|
|
1113
|
-
look === "neo" ? `filter:${useReduxGeometry ? `url(#${id}-drop-shadow)` : dropShadow}` : ""
|
|
1114
|
-
).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);
|
|
1115
|
-
label.attr(
|
|
1116
|
-
"transform",
|
|
1117
|
-
"translate(" + (-bbox.width - 14 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0) + labelPaddingX / 2) + ", " + (spineY - bbox.height / 2 - 2) + ")"
|
|
1118
|
-
);
|
|
1119
|
-
if (dir === "TB") {
|
|
1120
|
-
bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", 0);
|
|
1121
|
-
label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", 0)");
|
|
1122
|
-
if (useReduxGeometry) {
|
|
1123
|
-
bkg.attr("transform", `translate(${-labelPaddingX / 2 - 3}, ${-labelPaddingY - 10})`);
|
|
1124
|
-
label.attr(
|
|
1125
|
-
"transform",
|
|
1126
|
-
"translate(" + (pos - bbox.width / 2 - 5) + ", " + (-labelPaddingY * 2 + 7) + ")"
|
|
1127
|
-
);
|
|
1128
|
-
}
|
|
1129
|
-
} else if (dir === "BT") {
|
|
1130
|
-
bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", maxPos);
|
|
1131
|
-
label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + maxPos + ")");
|
|
1132
|
-
if (useReduxGeometry) {
|
|
1133
|
-
bkg.attr("transform", `translate(${-labelPaddingX / 2 - 3}, ${labelPaddingY + 10})`);
|
|
1134
|
-
label.attr(
|
|
1135
|
-
"transform",
|
|
1136
|
-
"translate(" + (pos - bbox.width / 2 - 5) + ", " + (maxPos + labelPaddingY * 2 + 4) + ")"
|
|
1137
|
-
);
|
|
1138
|
-
}
|
|
1139
|
-
} else {
|
|
1140
|
-
bkg.attr("transform", "translate(-19, " + (spineY - 12 - labelPaddingY / 2) + ")");
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1143
|
-
}, "drawBranches");
|
|
1144
|
-
var setBranchPosition = /* @__PURE__ */ __name(function(name, pos, index, bbox, rotateCommitLabel) {
|
|
1145
|
-
branchPos.set(name, { pos, index });
|
|
1146
|
-
pos += 50 + (rotateCommitLabel ? 40 : 0) + (dir === "TB" || dir === "BT" ? bbox.width / 2 : 0);
|
|
1147
|
-
return pos;
|
|
1148
|
-
}, "setBranchPosition");
|
|
1149
|
-
var draw = /* @__PURE__ */ __name(function(txt, id, ver, diagObj) {
|
|
1150
|
-
clear3();
|
|
1151
|
-
log.debug("in gitgraph renderer", txt + "\n", "id:", id, ver);
|
|
1152
|
-
const db2 = diagObj.db;
|
|
1153
|
-
if (!db2.getConfig) {
|
|
1154
|
-
log.error("getConfig method is not available on db");
|
|
1155
|
-
return;
|
|
1156
|
-
}
|
|
1157
|
-
const gitGraphConfig = db2.getConfig();
|
|
1158
|
-
const rotateCommitLabel = gitGraphConfig.rotateCommitLabel ?? false;
|
|
1159
|
-
allCommitsDict = db2.getCommits();
|
|
1160
|
-
const branches = db2.getBranchesAsObjArray();
|
|
1161
|
-
dir = db2.getDirection();
|
|
1162
|
-
const diagram2 = select(`[id="${id}"]`);
|
|
1163
|
-
const { look, theme, themeVariables } = getConfig2();
|
|
1164
|
-
const { useGradient, gradientStart, gradientStop, filterColor } = themeVariables;
|
|
1165
|
-
if (useGradient) {
|
|
1166
|
-
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%");
|
|
1167
|
-
gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1);
|
|
1168
|
-
gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1);
|
|
1169
|
-
}
|
|
1170
|
-
if (look === "neo" && REDUX_GEOMETRY_THEMES.has(theme ?? "")) {
|
|
1171
|
-
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);
|
|
1172
|
-
}
|
|
1173
|
-
let pos = 0;
|
|
1174
|
-
branches.forEach((branch2, index) => {
|
|
1175
|
-
const labelElement = drawText(branch2.name);
|
|
1176
|
-
const g = diagram2.append("g");
|
|
1177
|
-
const branchLabel = g.insert("g").attr("class", "branchLabel");
|
|
1178
|
-
const label = branchLabel.insert("g").attr("class", "label branch-label");
|
|
1179
|
-
label.node()?.appendChild(labelElement);
|
|
1180
|
-
const bbox = labelElement.getBBox();
|
|
1181
|
-
pos = setBranchPosition(branch2.name, pos, index, bbox, rotateCommitLabel);
|
|
1182
|
-
label.remove();
|
|
1183
|
-
branchLabel.remove();
|
|
1184
|
-
g.remove();
|
|
1185
|
-
});
|
|
1186
|
-
drawCommits(diagram2, allCommitsDict, false, gitGraphConfig);
|
|
1187
|
-
if (gitGraphConfig.showBranches) {
|
|
1188
|
-
drawBranches(diagram2, branches, gitGraphConfig, id);
|
|
1189
|
-
}
|
|
1190
|
-
drawArrows(diagram2, allCommitsDict);
|
|
1191
|
-
drawCommits(diagram2, allCommitsDict, true, gitGraphConfig);
|
|
1192
|
-
utils_default.insertTitle(
|
|
1193
|
-
diagram2,
|
|
1194
|
-
"gitTitleText",
|
|
1195
|
-
gitGraphConfig.titleTopMargin ?? 0,
|
|
1196
|
-
db2.getDiagramTitle()
|
|
1197
|
-
);
|
|
1198
|
-
setupGraphViewbox2(void 0, diagram2, gitGraphConfig.diagramPadding, gitGraphConfig.useMaxWidth);
|
|
1199
|
-
}, "draw");
|
|
1200
|
-
var gitGraphRenderer_default = {
|
|
1201
|
-
draw
|
|
1202
|
-
};
|
|
1203
|
-
var GIT_NAMED_COLOR_COUNT = 8;
|
|
1204
|
-
var REDUX_GEOMETRY_THEMES2 = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]);
|
|
1205
|
-
var COLOR_THEMES2 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]);
|
|
1206
|
-
var NEO_THEMES = /* @__PURE__ */ new Set(["neo", "neo-dark"]);
|
|
1207
|
-
var DARK_THEMES2 = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]);
|
|
1208
|
-
var NEO_COLOR_GEN_THEMES = /* @__PURE__ */ new Set([
|
|
1209
|
-
"redux",
|
|
1210
|
-
"redux-dark",
|
|
1211
|
-
"redux-color",
|
|
1212
|
-
"redux-dark-color",
|
|
1213
|
-
"neo",
|
|
1214
|
-
"neo-dark"
|
|
1215
|
-
]);
|
|
1216
|
-
var genGitGraphGradient = /* @__PURE__ */ __name((options) => {
|
|
1217
|
-
const { svgId } = options;
|
|
1218
|
-
let sections = "";
|
|
1219
|
-
if (options.useGradient && svgId) {
|
|
1220
|
-
for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
|
|
1221
|
-
sections += `
|
|
1222
|
-
.label${i} { fill: ${options.mainBkg}; stroke: url(${svgId}-gradient); stroke-width: ${options.strokeWidth};}
|
|
1223
|
-
`;
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
return sections;
|
|
1227
|
-
}, "genGitGraphGradient");
|
|
1228
|
-
var genColor = /* @__PURE__ */ __name((options) => {
|
|
1229
|
-
const config = getConfig();
|
|
1230
|
-
const { theme, themeVariables } = config;
|
|
1231
|
-
const { borderColorArray } = themeVariables;
|
|
1232
|
-
const useReduxGeometry = REDUX_GEOMETRY_THEMES2.has(theme);
|
|
1233
|
-
if (NEO_THEMES.has(theme)) {
|
|
1234
|
-
let sections = "";
|
|
1235
|
-
for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
|
|
1236
|
-
if (i === 0) {
|
|
1237
|
-
sections += `
|
|
1238
|
-
.branch-label${i} { fill: ${options.nodeBorder};}
|
|
1239
|
-
.commit${i} { stroke: ${options.nodeBorder}; }
|
|
1240
|
-
.commit-highlight${i} { stroke: ${options.nodeBorder}; fill: ${options.nodeBorder}; }
|
|
1241
|
-
.arrow${i} { stroke: ${options.nodeBorder}; }
|
|
1242
|
-
.commit-bullets { fill: ${options.nodeBorder}; }
|
|
1243
|
-
.commit-cherry-pick${i} { stroke: ${options.nodeBorder}; }
|
|
1244
|
-
${genGitGraphGradient(options)}`;
|
|
1245
|
-
} else {
|
|
1246
|
-
const ci = i % GIT_NAMED_COLOR_COUNT;
|
|
1247
|
-
sections += `
|
|
1248
|
-
.branch-label${i} { fill: ${options["gitBranchLabel" + ci]}; }
|
|
1249
|
-
.commit${i} { stroke: ${options["git" + ci]}; fill: ${options["git" + ci]}; }
|
|
1250
|
-
.commit-highlight${i} { stroke: ${options["gitInv" + ci]}; fill: ${options["gitInv" + ci]}; }
|
|
1251
|
-
.arrow${i} { stroke: ${options["git" + ci]}; }
|
|
1252
|
-
`;
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
return sections;
|
|
1256
|
-
} else if (!COLOR_THEMES2.has(theme)) {
|
|
1257
|
-
let sections = "";
|
|
1258
|
-
for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
|
|
1259
|
-
sections += `
|
|
1260
|
-
.branch-label${i} { fill: ${options.nodeBorder}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""} }
|
|
1261
|
-
.commit${i} { stroke: ${options.nodeBorder}; }
|
|
1262
|
-
.commit-highlight${i} { stroke: ${options.nodeBorder}; fill: ${options.nodeBorder}; }
|
|
1263
|
-
.label${i} { fill: ${options.mainBkg}; stroke: ${options.nodeBorder}; stroke-width: ${options.strokeWidth}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""}}
|
|
1264
|
-
.arrow${i} { stroke: ${options.nodeBorder}; }
|
|
1265
|
-
.commit-bullets { fill: ${options.nodeBorder}; }
|
|
1266
|
-
.commit-cherry-pick${i} { stroke: ${options.nodeBorder}; }
|
|
1267
|
-
`;
|
|
1268
|
-
}
|
|
1269
|
-
return sections;
|
|
1270
|
-
} else {
|
|
1271
|
-
let sections = "";
|
|
1272
|
-
for (let i = 0; i < options.THEME_COLOR_LIMIT; i++) {
|
|
1273
|
-
if (i === 0) {
|
|
1274
|
-
sections += `
|
|
1275
|
-
.branch-label${i} { fill: ${options.nodeBorder}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""} }
|
|
1276
|
-
.commit${i} { stroke: ${options.nodeBorder}; }
|
|
1277
|
-
.commit-highlight${i} { stroke: ${options.nodeBorder}; fill: ${options.mainBkg}; }
|
|
1278
|
-
.label${i} { fill: ${options.mainBkg}; stroke: ${options.nodeBorder}; stroke-width: ${options.strokeWidth}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""} }
|
|
1279
|
-
.arrow${i} { stroke: ${options.nodeBorder}; }
|
|
1280
|
-
.commit-bullets { fill: ${options.nodeBorder}; }
|
|
1281
|
-
`;
|
|
1282
|
-
} else {
|
|
1283
|
-
const colorIndex = i % borderColorArray.length;
|
|
1284
|
-
sections += `
|
|
1285
|
-
.branch-label${i} { fill: ${options.nodeBorder}; ${useReduxGeometry ? `font-weight:${options.noteFontWeight}` : ""} }
|
|
1286
|
-
.commit${i} { stroke: ${borderColorArray[colorIndex]}; fill: ${borderColorArray[colorIndex]}; }
|
|
1287
|
-
.commit-highlight${i} { stroke: ${borderColorArray[colorIndex]}; fill: ${borderColorArray[colorIndex]}; }
|
|
1288
|
-
.label${i} { fill: ${DARK_THEMES2.has(theme) ? options.mainBkg : borderColorArray[colorIndex]}; stroke: ${borderColorArray[colorIndex]}; stroke-width: ${options.strokeWidth}; }
|
|
1289
|
-
.arrow${i} { stroke: ${borderColorArray[colorIndex]}; }
|
|
1290
|
-
`;
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
return sections;
|
|
1294
|
-
}
|
|
1295
|
-
}, "genColor");
|
|
1296
|
-
var normalTheme = /* @__PURE__ */ __name((options) => {
|
|
1297
|
-
return `${Array.from({ length: options.THEME_COLOR_LIMIT }, (_, i) => i).map((i) => {
|
|
1298
|
-
const ci = i % GIT_NAMED_COLOR_COUNT;
|
|
1299
|
-
return `
|
|
1300
|
-
.branch-label${i} { fill: ${options["gitBranchLabel" + ci]}; }
|
|
1301
|
-
.commit${i} { stroke: ${options["git" + ci]}; fill: ${options["git" + ci]}; }
|
|
1302
|
-
.commit-highlight${i} { stroke: ${options["gitInv" + ci]}; fill: ${options["gitInv" + ci]}; }
|
|
1303
|
-
.label${i} { fill: ${options["git" + ci]}; }
|
|
1304
|
-
.arrow${i} { stroke: ${options["git" + ci]}; }
|
|
1305
|
-
`;
|
|
1306
|
-
}).join("\n")}`;
|
|
1307
|
-
}, "normalTheme");
|
|
1308
|
-
var getStyles = /* @__PURE__ */ __name((options) => {
|
|
1309
|
-
const config = getConfig();
|
|
1310
|
-
const { theme } = config;
|
|
1311
|
-
const useNeoColorGen = NEO_COLOR_GEN_THEMES.has(theme);
|
|
1312
|
-
return `
|
|
1313
|
-
.commit-id,
|
|
1314
|
-
.commit-msg,
|
|
1315
|
-
.branch-label {
|
|
1316
|
-
fill: lightgrey;
|
|
1317
|
-
color: lightgrey;
|
|
1318
|
-
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
1319
|
-
font-family: var(--mermaid-font-family);
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
${useNeoColorGen ? genColor(options) : normalTheme(options)}
|
|
1323
|
-
|
|
1324
|
-
.branch {
|
|
1325
|
-
stroke-width: ${options.strokeWidth};
|
|
1326
|
-
stroke: ${options.commitLineColor ?? options.lineColor};
|
|
1327
|
-
stroke-dasharray: ${useNeoColorGen ? "4 2" : "2"};
|
|
1328
|
-
}
|
|
1329
|
-
.commit-label { font-size: ${options.commitLabelFontSize}; fill: ${useNeoColorGen ? options.nodeBorder : options.commitLabelColor}; ${useNeoColorGen ? `font-weight:${options.noteFontWeight};` : ""}}
|
|
1330
|
-
.commit-label-bkg { font-size: ${options.commitLabelFontSize}; fill: ${useNeoColorGen ? "transparent" : options.commitLabelBackground}; opacity: ${useNeoColorGen ? "" : 0.5}; }
|
|
1331
|
-
.tag-label { font-size: ${options.tagLabelFontSize}; fill: ${options.tagLabelColor};}
|
|
1332
|
-
.tag-label-bkg { fill: ${useNeoColorGen ? options.mainBkg : options.tagLabelBackground}; stroke: ${useNeoColorGen ? options.nodeBorder : options.tagLabelBorder}; ${useNeoColorGen ? `filter:${options.dropShadow}` : ""} }
|
|
1333
|
-
.tag-hole { fill: ${options.textColor}; }
|
|
1334
|
-
|
|
1335
|
-
.commit-merge {
|
|
1336
|
-
stroke: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1337
|
-
fill: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1338
|
-
}
|
|
1339
|
-
.commit-reverse {
|
|
1340
|
-
stroke: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1341
|
-
fill: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1342
|
-
stroke-width: ${useNeoColorGen ? options.strokeWidth : 3};
|
|
1343
|
-
}
|
|
1344
|
-
.commit-highlight-outer {
|
|
1345
|
-
}
|
|
1346
|
-
.commit-highlight-inner {
|
|
1347
|
-
stroke: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1348
|
-
fill: ${useNeoColorGen ? options.mainBkg : options.primaryColor};
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
.arrow {
|
|
1352
|
-
/* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
|
|
1353
|
-
stroke-width: ${REDUX_GEOMETRY_THEMES2.has(theme) ? options.strokeWidth : 8};
|
|
1354
|
-
stroke-linecap: round;
|
|
1355
|
-
fill: none
|
|
1356
|
-
}
|
|
1357
|
-
.gitTitleText {
|
|
1358
|
-
text-anchor: middle;
|
|
1359
|
-
font-size: 18px;
|
|
1360
|
-
fill: ${options.textColor};
|
|
1361
|
-
}
|
|
1362
|
-
`;
|
|
1363
|
-
}, "getStyles");
|
|
1364
|
-
var styles_default = getStyles;
|
|
1365
|
-
var diagram = {
|
|
1366
|
-
parser,
|
|
1367
|
-
db,
|
|
1368
|
-
renderer: gitGraphRenderer_default,
|
|
1369
|
-
styles: styles_default
|
|
1370
|
-
};
|
|
1371
|
-
export {
|
|
1372
|
-
diagram
|
|
1373
|
-
};
|