dominds 0.1.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/LICENSE +157 -0
- package/README.md +250 -0
- package/README.zh.md +161 -0
- package/dist/access-control.js +253 -0
- package/dist/cli/create.js +263 -0
- package/dist/cli/read.js +84 -0
- package/dist/cli/tui.js +199 -0
- package/dist/cli/webui.js +169 -0
- package/dist/cli.js +227 -0
- package/dist/dialog-factory.js +53 -0
- package/dist/dialog-global-registry.js +68 -0
- package/dist/dialog-instance-registry.js +78 -0
- package/dist/dialog-run-state.js +198 -0
- package/dist/dialog.js +1024 -0
- package/dist/evt-registry.js +103 -0
- package/dist/index.js +8 -0
- package/dist/llm/client.js +69 -0
- package/dist/llm/defaults.yaml +386 -0
- package/dist/llm/driver.js +3214 -0
- package/dist/llm/gen/anthropic.js +611 -0
- package/dist/llm/gen/codex.js +375 -0
- package/dist/llm/gen/mock.js +326 -0
- package/dist/llm/gen/openai.js +470 -0
- package/dist/llm/gen/registry.js +26 -0
- package/dist/llm/gen.js +2 -0
- package/dist/llm/tools-projection.js +37 -0
- package/dist/log.js +228 -0
- package/dist/mcp/config.js +230 -0
- package/dist/mcp/sdk-client.js +129 -0
- package/dist/mcp/server-runtime.js +57 -0
- package/dist/mcp/stdio-client.js +280 -0
- package/dist/mcp/supervisor.js +979 -0
- package/dist/mcp/tool-names.js +109 -0
- package/dist/minds/builtin/cmdr/persona.md +3 -0
- package/dist/minds/builtin/dijiang/knowledge.md +287 -0
- package/dist/minds/builtin/dijiang/persona.md +7 -0
- package/dist/minds/builtin/fuxi/persona.en.md +59 -0
- package/dist/minds/builtin/fuxi/persona.zh.md +49 -0
- package/dist/minds/builtin/pangu/persona.en.md +78 -0
- package/dist/minds/builtin/pangu/persona.zh.md +71 -0
- package/dist/minds/load.js +617 -0
- package/dist/minds/minds-i18n.js +131 -0
- package/dist/minds/system-prompt.js +281 -0
- package/dist/persistence.js +3128 -0
- package/dist/problems.js +109 -0
- package/dist/server/api-routes.js +1031 -0
- package/dist/server/auth.js +180 -0
- package/dist/server/mime-types.js +32 -0
- package/dist/server/prompts-routes.js +543 -0
- package/dist/server/server-core.js +235 -0
- package/dist/server/setup-routes.js +697 -0
- package/dist/server/static-server.js +132 -0
- package/dist/server/websocket-handler.js +1011 -0
- package/dist/server.js +164 -0
- package/dist/shared/async-fifo-mutex.js +36 -0
- package/dist/shared/diligence.js +20 -0
- package/dist/shared/dotenv.js +144 -0
- package/dist/shared/evt.js +195 -0
- package/dist/shared/i18n/driver-messages.js +267 -0
- package/dist/shared/i18n/text.js +9 -0
- package/dist/shared/i18n/tool-result-messages.js +51 -0
- package/dist/shared/rtws-cli.js +73 -0
- package/dist/shared/runtime-language.js +47 -0
- package/dist/shared/team-mgmt-manual.js +116 -0
- package/dist/shared/types/context-health.js +2 -0
- package/dist/shared/types/dialog.js +11 -0
- package/dist/shared/types/i18n.js +2 -0
- package/dist/shared/types/index.js +26 -0
- package/dist/shared/types/language.js +40 -0
- package/dist/shared/types/problems.js +2 -0
- package/dist/shared/types/prompts.js +2 -0
- package/dist/shared/types/q4h.js +7 -0
- package/dist/shared/types/run-state.js +8 -0
- package/dist/shared/types/setup.js +2 -0
- package/dist/shared/types/storage.js +10 -0
- package/dist/shared/types/tellask.js +8 -0
- package/dist/shared/types/tools-registry.js +2 -0
- package/dist/shared/types/wire.js +12 -0
- package/dist/shared/utils/fmt.js +9 -0
- package/dist/shared/utils/html.js +20 -0
- package/dist/shared/utils/id.js +18 -0
- package/dist/shared/utils/inter-dialog-format.js +101 -0
- package/dist/shared/utils/time.js +13 -0
- package/dist/static/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/static/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/static/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/static/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/static/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/static/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/static/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/static/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/static/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/static/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/static/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/static/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/static/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/static/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/static/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/static/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/static/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/static/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/static/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/static/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/static/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/static/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/static/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/static/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/static/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/static/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/static/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/static/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/static/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/static/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/static/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/static/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/static/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/static/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/static/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/static/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/static/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/static/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/static/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/static/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/static/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/static/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/static/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/static/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/static/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/static/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/static/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/static/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/static/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/static/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/static/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/static/assets/_baseUniq-Crfl3d5Y.js +661 -0
- package/dist/static/assets/_baseUniq-Crfl3d5Y.js.map +1 -0
- package/dist/static/assets/arc-CbA_x9GD.js +132 -0
- package/dist/static/assets/arc-CbA_x9GD.js.map +1 -0
- package/dist/static/assets/architectureDiagram-VXUJARFQ-lcFS8ZQJ.js +8685 -0
- package/dist/static/assets/architectureDiagram-VXUJARFQ-lcFS8ZQJ.js.map +1 -0
- package/dist/static/assets/blockDiagram-VD42YOAC-B3Q36qRc.js +3608 -0
- package/dist/static/assets/blockDiagram-VD42YOAC-B3Q36qRc.js.map +1 -0
- package/dist/static/assets/c4Diagram-YG6GDRKO-Mt-aq3VH.js +2482 -0
- package/dist/static/assets/c4Diagram-YG6GDRKO-Mt-aq3VH.js.map +1 -0
- package/dist/static/assets/channel-BVr1Yke-.js +8 -0
- package/dist/static/assets/channel-BVr1Yke-.js.map +1 -0
- package/dist/static/assets/chunk-4BX2VUAB-qCIn5Iic.js +17 -0
- package/dist/static/assets/chunk-4BX2VUAB-qCIn5Iic.js.map +1 -0
- package/dist/static/assets/chunk-55IACEB6-q172NeCV.js +14 -0
- package/dist/static/assets/chunk-55IACEB6-q172NeCV.js.map +1 -0
- package/dist/static/assets/chunk-B4BG7PRW-CMJmtYzq.js +1827 -0
- package/dist/static/assets/chunk-B4BG7PRW-CMJmtYzq.js.map +1 -0
- package/dist/static/assets/chunk-DI55MBZ5-DiuwwZPL.js +1916 -0
- package/dist/static/assets/chunk-DI55MBZ5-DiuwwZPL.js.map +1 -0
- package/dist/static/assets/chunk-FMBD7UC4-06sqZTTn.js +20 -0
- package/dist/static/assets/chunk-FMBD7UC4-06sqZTTn.js.map +1 -0
- package/dist/static/assets/chunk-QN33PNHL-CnpBNkpP.js +25 -0
- package/dist/static/assets/chunk-QN33PNHL-CnpBNkpP.js.map +1 -0
- package/dist/static/assets/chunk-QZHKN3VN-CNgjMR-e.js +18 -0
- package/dist/static/assets/chunk-QZHKN3VN-CNgjMR-e.js.map +1 -0
- package/dist/static/assets/chunk-TZMSLE5B-BxtzW6--.js +109 -0
- package/dist/static/assets/chunk-TZMSLE5B-BxtzW6--.js.map +1 -0
- package/dist/static/assets/classDiagram-2ON5EDUG-29huvmn-.js +23 -0
- package/dist/static/assets/classDiagram-2ON5EDUG-29huvmn-.js.map +1 -0
- package/dist/static/assets/classDiagram-v2-WZHVMYZB-29huvmn-.js +23 -0
- package/dist/static/assets/classDiagram-v2-WZHVMYZB-29huvmn-.js.map +1 -0
- package/dist/static/assets/clone-D2OgLSSn.js +9 -0
- package/dist/static/assets/clone-D2OgLSSn.js.map +1 -0
- package/dist/static/assets/cose-bilkent-S5V4N54A-BNegDCxl.js +4943 -0
- package/dist/static/assets/cose-bilkent-S5V4N54A-BNegDCxl.js.map +1 -0
- package/dist/static/assets/cytoscape.esm-Bm8DJGmZ.js +30240 -0
- package/dist/static/assets/cytoscape.esm-Bm8DJGmZ.js.map +1 -0
- package/dist/static/assets/dagre-6UL2VRFP-f1XrTRSn.js +695 -0
- package/dist/static/assets/dagre-6UL2VRFP-f1XrTRSn.js.map +1 -0
- package/dist/static/assets/defaultLocale-DVr69WTU.js +207 -0
- package/dist/static/assets/defaultLocale-DVr69WTU.js.map +1 -0
- package/dist/static/assets/diagram-PSM6KHXK-8w1WbeDi.js +849 -0
- package/dist/static/assets/diagram-PSM6KHXK-8w1WbeDi.js.map +1 -0
- package/dist/static/assets/diagram-QEK2KX5R-CF4wtMmR.js +303 -0
- package/dist/static/assets/diagram-QEK2KX5R-CF4wtMmR.js.map +1 -0
- package/dist/static/assets/diagram-S2PKOQOG-8p3Avgn2.js +213 -0
- package/dist/static/assets/diagram-S2PKOQOG-8p3Avgn2.js.map +1 -0
- package/dist/static/assets/erDiagram-Q2GNP2WA-BMKLxlM9.js +1159 -0
- package/dist/static/assets/erDiagram-Q2GNP2WA-BMKLxlM9.js.map +1 -0
- package/dist/static/assets/favicon-Cmg5RbCj.svg +8 -0
- package/dist/static/assets/flowDiagram-NV44I4VS-CgEuPNK2.js +2332 -0
- package/dist/static/assets/flowDiagram-NV44I4VS-CgEuPNK2.js.map +1 -0
- package/dist/static/assets/ganttDiagram-JELNMOA3-bJkDCf-9.js +3681 -0
- package/dist/static/assets/ganttDiagram-JELNMOA3-bJkDCf-9.js.map +1 -0
- package/dist/static/assets/gitGraphDiagram-NY62KEGX-4QE9kesp.js +1206 -0
- package/dist/static/assets/gitGraphDiagram-NY62KEGX-4QE9kesp.js.map +1 -0
- package/dist/static/assets/graph-CS0Pmm7c.js +597 -0
- package/dist/static/assets/graph-CS0Pmm7c.js.map +1 -0
- package/dist/static/assets/index-BS6HnGzC.js +112303 -0
- package/dist/static/assets/index-BS6HnGzC.js.map +1 -0
- package/dist/static/assets/index-DaIsSzC_.css +483 -0
- package/dist/static/assets/infoDiagram-WHAUD3N6-ypBcKfUs.js +34 -0
- package/dist/static/assets/infoDiagram-WHAUD3N6-ypBcKfUs.js.map +1 -0
- package/dist/static/assets/init-ZxktEp_H.js +17 -0
- package/dist/static/assets/init-ZxktEp_H.js.map +1 -0
- package/dist/static/assets/journeyDiagram-XKPGCS4Q-QnrxDowJ.js +1255 -0
- package/dist/static/assets/journeyDiagram-XKPGCS4Q-QnrxDowJ.js.map +1 -0
- package/dist/static/assets/kanban-definition-3W4ZIXB7-CfvEc4z5.js +1048 -0
- package/dist/static/assets/kanban-definition-3W4ZIXB7-CfvEc4z5.js.map +1 -0
- package/dist/static/assets/layout-8TGxpm23.js +2218 -0
- package/dist/static/assets/layout-8TGxpm23.js.map +1 -0
- package/dist/static/assets/linear-BATBPQQv.js +341 -0
- package/dist/static/assets/linear-BATBPQQv.js.map +1 -0
- package/dist/static/assets/min-B3oVH3AC.js +42 -0
- package/dist/static/assets/min-B3oVH3AC.js.map +1 -0
- package/dist/static/assets/mindmap-definition-VGOIOE7T-L7VLwwF8.js +1127 -0
- package/dist/static/assets/mindmap-definition-VGOIOE7T-L7VLwwF8.js.map +1 -0
- package/dist/static/assets/ordinal-CxptdPJm.js +77 -0
- package/dist/static/assets/ordinal-CxptdPJm.js.map +1 -0
- package/dist/static/assets/pieDiagram-ADFJNKIX-CFW3zIhM.js +241 -0
- package/dist/static/assets/pieDiagram-ADFJNKIX-CFW3zIhM.js.map +1 -0
- package/dist/static/assets/quadrantDiagram-AYHSOK5B-B7ssen3E.js +1338 -0
- package/dist/static/assets/quadrantDiagram-AYHSOK5B-B7ssen3E.js.map +1 -0
- package/dist/static/assets/requirementDiagram-UZGBJVZJ-D0v5BArv.js +1162 -0
- package/dist/static/assets/requirementDiagram-UZGBJVZJ-D0v5BArv.js.map +1 -0
- package/dist/static/assets/sankeyDiagram-TZEHDZUN-B7slncJe.js +1195 -0
- package/dist/static/assets/sankeyDiagram-TZEHDZUN-B7slncJe.js.map +1 -0
- package/dist/static/assets/sequenceDiagram-WL72ISMW-oXU2lRh_.js +3875 -0
- package/dist/static/assets/sequenceDiagram-WL72ISMW-oXU2lRh_.js.map +1 -0
- package/dist/static/assets/stateDiagram-FKZM4ZOC-CFYsEd0x.js +452 -0
- package/dist/static/assets/stateDiagram-FKZM4ZOC-CFYsEd0x.js.map +1 -0
- package/dist/static/assets/stateDiagram-v2-4FDKWEC3-C0UWaNA7.js +22 -0
- package/dist/static/assets/stateDiagram-v2-4FDKWEC3-C0UWaNA7.js.map +1 -0
- package/dist/static/assets/timeline-definition-IT6M3QCI-C3KODUrh.js +1223 -0
- package/dist/static/assets/timeline-definition-IT6M3QCI-C3KODUrh.js.map +1 -0
- package/dist/static/assets/treemap-KMMF4GRG-DAGDLhj2.js +18753 -0
- package/dist/static/assets/treemap-KMMF4GRG-DAGDLhj2.js.map +1 -0
- package/dist/static/assets/xychartDiagram-PRI3JC2R-C0J9iwTO.js +1888 -0
- package/dist/static/assets/xychartDiagram-PRI3JC2R-C0J9iwTO.js.map +1 -0
- package/dist/static/index.html +71 -0
- package/dist/static/testing/dom-observation-utils.js +425 -0
- package/dist/static/testing/e2e-test-helper.js +3119 -0
- package/dist/team.js +1160 -0
- package/dist/tellask.js +431 -0
- package/dist/tool.js +150 -0
- package/dist/tools/apply-patch.js +542 -0
- package/dist/tools/builtins.js +196 -0
- package/dist/tools/context-health.js +177 -0
- package/dist/tools/ctrl.js +478 -0
- package/dist/tools/diag.js +583 -0
- package/dist/tools/env.js +184 -0
- package/dist/tools/fs.js +818 -0
- package/dist/tools/mcp.js +138 -0
- package/dist/tools/mem.js +349 -0
- package/dist/tools/os.js +751 -0
- package/dist/tools/prompts/team_mgmt.en.md +70 -0
- package/dist/tools/prompts/team_mgmt.zh.md +70 -0
- package/dist/tools/prompts/ws_mod.en.md +86 -0
- package/dist/tools/prompts/ws_mod.zh.md +87 -0
- package/dist/tools/registry-snapshot.js +31 -0
- package/dist/tools/registry.js +121 -0
- package/dist/tools/ripgrep.js +678 -0
- package/dist/tools/team-mgmt.js +3300 -0
- package/dist/tools/txt.js +3178 -0
- package/dist/utils/id.js +72 -0
- package/dist/utils/task-doc.js +236 -0
- package/dist/utils/task-package.js +522 -0
- package/dist/utils/taskdoc-search.js +280 -0
- package/dist/utils/taskdoc.js +400 -0
- package/package.json +69 -0
|
@@ -0,0 +1,1206 @@
|
|
|
1
|
+
import { p as populateCommonDb } from "./chunk-4BX2VUAB-qCIn5Iic.js";
|
|
2
|
+
import { I as ImperativeState } from "./chunk-QZHKN3VN-CNgjMR-e.js";
|
|
3
|
+
import { _ as __name, q as getDiagramTitle, p as setDiagramTitle, s as setAccDescription, g as getAccDescription, a as getAccTitle, b as setAccTitle, l as log, c as getConfig2, d as select, u as utils_default, C as setupGraphViewbox2, y as clear, k as common_default, D as cleanAndMerge, E as getConfig, F as defaultConfig_default, G as random } from "./index-BS6HnGzC.js";
|
|
4
|
+
import { p as parse } from "./treemap-KMMF4GRG-DAGDLhj2.js";
|
|
5
|
+
import "./min-B3oVH3AC.js";
|
|
6
|
+
import "./_baseUniq-Crfl3d5Y.js";
|
|
7
|
+
var commitType = {
|
|
8
|
+
NORMAL: 0,
|
|
9
|
+
REVERSE: 1,
|
|
10
|
+
HIGHLIGHT: 2,
|
|
11
|
+
MERGE: 3,
|
|
12
|
+
CHERRY_PICK: 4
|
|
13
|
+
};
|
|
14
|
+
var DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph;
|
|
15
|
+
var getConfig3 = /* @__PURE__ */ __name(() => {
|
|
16
|
+
const config = cleanAndMerge({
|
|
17
|
+
...DEFAULT_GITGRAPH_CONFIG,
|
|
18
|
+
...getConfig().gitGraph
|
|
19
|
+
});
|
|
20
|
+
return config;
|
|
21
|
+
}, "getConfig");
|
|
22
|
+
var state = new ImperativeState(() => {
|
|
23
|
+
const config = getConfig3();
|
|
24
|
+
const mainBranchName = config.mainBranchName;
|
|
25
|
+
const mainBranchOrder = config.mainBranchOrder;
|
|
26
|
+
return {
|
|
27
|
+
mainBranchName,
|
|
28
|
+
commits: /* @__PURE__ */ new Map(),
|
|
29
|
+
head: null,
|
|
30
|
+
branchConfig: /* @__PURE__ */ new Map([[mainBranchName, { name: mainBranchName, order: mainBranchOrder }]]),
|
|
31
|
+
branches: /* @__PURE__ */ new Map([[mainBranchName, null]]),
|
|
32
|
+
currBranch: mainBranchName,
|
|
33
|
+
direction: "LR",
|
|
34
|
+
seq: 0,
|
|
35
|
+
options: {}
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
function getID() {
|
|
39
|
+
return random({ length: 7 });
|
|
40
|
+
}
|
|
41
|
+
__name(getID, "getID");
|
|
42
|
+
function uniqBy(list, fn) {
|
|
43
|
+
const recordMap = /* @__PURE__ */ Object.create(null);
|
|
44
|
+
return list.reduce((out, item) => {
|
|
45
|
+
const key = fn(item);
|
|
46
|
+
if (!recordMap[key]) {
|
|
47
|
+
recordMap[key] = true;
|
|
48
|
+
out.push(item);
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}, []);
|
|
52
|
+
}
|
|
53
|
+
__name(uniqBy, "uniqBy");
|
|
54
|
+
var setDirection = /* @__PURE__ */ __name(function(dir2) {
|
|
55
|
+
state.records.direction = dir2;
|
|
56
|
+
}, "setDirection");
|
|
57
|
+
var setOptions = /* @__PURE__ */ __name(function(rawOptString) {
|
|
58
|
+
log.debug("options str", rawOptString);
|
|
59
|
+
rawOptString = rawOptString?.trim();
|
|
60
|
+
rawOptString = rawOptString || "{}";
|
|
61
|
+
try {
|
|
62
|
+
state.records.options = JSON.parse(rawOptString);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
log.error("error while parsing gitGraph options", e.message);
|
|
65
|
+
}
|
|
66
|
+
}, "setOptions");
|
|
67
|
+
var getOptions = /* @__PURE__ */ __name(function() {
|
|
68
|
+
return state.records.options;
|
|
69
|
+
}, "getOptions");
|
|
70
|
+
var commit = /* @__PURE__ */ __name(function(commitDB) {
|
|
71
|
+
let msg = commitDB.msg;
|
|
72
|
+
let id = commitDB.id;
|
|
73
|
+
const type = commitDB.type;
|
|
74
|
+
let tags = commitDB.tags;
|
|
75
|
+
log.info("commit", msg, id, type, tags);
|
|
76
|
+
log.debug("Entering commit:", msg, id, type, tags);
|
|
77
|
+
const config = getConfig3();
|
|
78
|
+
id = common_default.sanitizeText(id, config);
|
|
79
|
+
msg = common_default.sanitizeText(msg, config);
|
|
80
|
+
tags = tags?.map((tag) => common_default.sanitizeText(tag, config));
|
|
81
|
+
const newCommit = {
|
|
82
|
+
id: id ? id : state.records.seq + "-" + getID(),
|
|
83
|
+
message: msg,
|
|
84
|
+
seq: state.records.seq++,
|
|
85
|
+
type: type ?? commitType.NORMAL,
|
|
86
|
+
tags: tags ?? [],
|
|
87
|
+
parents: state.records.head == null ? [] : [state.records.head.id],
|
|
88
|
+
branch: state.records.currBranch
|
|
89
|
+
};
|
|
90
|
+
state.records.head = newCommit;
|
|
91
|
+
log.info("main branch", config.mainBranchName);
|
|
92
|
+
if (state.records.commits.has(newCommit.id)) {
|
|
93
|
+
log.warn(`Commit ID ${newCommit.id} already exists`);
|
|
94
|
+
}
|
|
95
|
+
state.records.commits.set(newCommit.id, newCommit);
|
|
96
|
+
state.records.branches.set(state.records.currBranch, newCommit.id);
|
|
97
|
+
log.debug("in pushCommit " + newCommit.id);
|
|
98
|
+
}, "commit");
|
|
99
|
+
var branch = /* @__PURE__ */ __name(function(branchDB) {
|
|
100
|
+
let name = branchDB.name;
|
|
101
|
+
const order = branchDB.order;
|
|
102
|
+
name = common_default.sanitizeText(name, getConfig3());
|
|
103
|
+
if (state.records.branches.has(name)) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
state.records.branches.set(name, state.records.head != null ? state.records.head.id : null);
|
|
109
|
+
state.records.branchConfig.set(name, { name, order });
|
|
110
|
+
checkout(name);
|
|
111
|
+
log.debug("in createBranch");
|
|
112
|
+
}, "branch");
|
|
113
|
+
var merge = /* @__PURE__ */ __name((mergeDB) => {
|
|
114
|
+
let otherBranch = mergeDB.branch;
|
|
115
|
+
let customId = mergeDB.id;
|
|
116
|
+
const overrideType = mergeDB.type;
|
|
117
|
+
const customTags = mergeDB.tags;
|
|
118
|
+
const config = getConfig3();
|
|
119
|
+
otherBranch = common_default.sanitizeText(otherBranch, config);
|
|
120
|
+
if (customId) {
|
|
121
|
+
customId = common_default.sanitizeText(customId, config);
|
|
122
|
+
}
|
|
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) {
|
|
128
|
+
throw new Error(`Cannot merge branch '${otherBranch}' into itself.`);
|
|
129
|
+
}
|
|
130
|
+
if (state.records.currBranch === otherBranch) {
|
|
131
|
+
const error = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
|
|
132
|
+
error.hash = {
|
|
133
|
+
text: `merge ${otherBranch}`,
|
|
134
|
+
token: `merge ${otherBranch}`,
|
|
135
|
+
expected: ["branch abc"]
|
|
136
|
+
};
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
if (currentCommit === void 0 || !currentCommit) {
|
|
140
|
+
const error = new Error(
|
|
141
|
+
`Incorrect usage of "merge". Current branch (${state.records.currBranch})has no commits`
|
|
142
|
+
);
|
|
143
|
+
error.hash = {
|
|
144
|
+
text: `merge ${otherBranch}`,
|
|
145
|
+
token: `merge ${otherBranch}`,
|
|
146
|
+
expected: ["commit"]
|
|
147
|
+
};
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
if (!state.records.branches.has(otherBranch)) {
|
|
151
|
+
const error = new Error(
|
|
152
|
+
'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") does not exist"
|
|
153
|
+
);
|
|
154
|
+
error.hash = {
|
|
155
|
+
text: `merge ${otherBranch}`,
|
|
156
|
+
token: `merge ${otherBranch}`,
|
|
157
|
+
expected: [`branch ${otherBranch}`]
|
|
158
|
+
};
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
if (otherCommit === void 0 || !otherCommit) {
|
|
162
|
+
const error = new Error(
|
|
163
|
+
'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") has no commits"
|
|
164
|
+
);
|
|
165
|
+
error.hash = {
|
|
166
|
+
text: `merge ${otherBranch}`,
|
|
167
|
+
token: `merge ${otherBranch}`,
|
|
168
|
+
expected: ['"commit"']
|
|
169
|
+
};
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
if (currentCommit === otherCommit) {
|
|
173
|
+
const error = new Error('Incorrect usage of "merge". Both branches have same head');
|
|
174
|
+
error.hash = {
|
|
175
|
+
text: `merge ${otherBranch}`,
|
|
176
|
+
token: `merge ${otherBranch}`,
|
|
177
|
+
expected: ["branch abc"]
|
|
178
|
+
};
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
if (customId && state.records.commits.has(customId)) {
|
|
182
|
+
const error = new Error(
|
|
183
|
+
'Incorrect usage of "merge". Commit with id:' + customId + " already exists, use different custom id"
|
|
184
|
+
);
|
|
185
|
+
error.hash = {
|
|
186
|
+
text: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
|
|
187
|
+
token: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`,
|
|
188
|
+
expected: [
|
|
189
|
+
`merge ${otherBranch} ${customId}_UNIQUE ${overrideType} ${customTags?.join(" ")}`
|
|
190
|
+
]
|
|
191
|
+
};
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
const verifiedBranch = otherBranchCheck ? otherBranchCheck : "";
|
|
195
|
+
const commit2 = {
|
|
196
|
+
id: customId || `${state.records.seq}-${getID()}`,
|
|
197
|
+
message: `merged branch ${otherBranch} into ${state.records.currBranch}`,
|
|
198
|
+
seq: state.records.seq++,
|
|
199
|
+
parents: state.records.head == null ? [] : [state.records.head.id, verifiedBranch],
|
|
200
|
+
branch: state.records.currBranch,
|
|
201
|
+
type: commitType.MERGE,
|
|
202
|
+
customType: overrideType,
|
|
203
|
+
customId: customId ? true : false,
|
|
204
|
+
tags: customTags ?? []
|
|
205
|
+
};
|
|
206
|
+
state.records.head = commit2;
|
|
207
|
+
state.records.commits.set(commit2.id, commit2);
|
|
208
|
+
state.records.branches.set(state.records.currBranch, commit2.id);
|
|
209
|
+
log.debug(state.records.branches);
|
|
210
|
+
log.debug("in mergeBranch");
|
|
211
|
+
}, "merge");
|
|
212
|
+
var cherryPick = /* @__PURE__ */ __name(function(cherryPickDB) {
|
|
213
|
+
let sourceId = cherryPickDB.id;
|
|
214
|
+
let targetId = cherryPickDB.targetId;
|
|
215
|
+
let tags = cherryPickDB.tags;
|
|
216
|
+
let parentCommitId = cherryPickDB.parent;
|
|
217
|
+
log.debug("Entering cherryPick:", sourceId, targetId, tags);
|
|
218
|
+
const config = getConfig3();
|
|
219
|
+
sourceId = common_default.sanitizeText(sourceId, config);
|
|
220
|
+
targetId = common_default.sanitizeText(targetId, config);
|
|
221
|
+
tags = tags?.map((tag) => common_default.sanitizeText(tag, config));
|
|
222
|
+
parentCommitId = common_default.sanitizeText(parentCommitId, config);
|
|
223
|
+
if (!sourceId || !state.records.commits.has(sourceId)) {
|
|
224
|
+
const error = new Error(
|
|
225
|
+
'Incorrect usage of "cherryPick". Source commit id should exist and provided'
|
|
226
|
+
);
|
|
227
|
+
error.hash = {
|
|
228
|
+
text: `cherryPick ${sourceId} ${targetId}`,
|
|
229
|
+
token: `cherryPick ${sourceId} ${targetId}`,
|
|
230
|
+
expected: ["cherry-pick abc"]
|
|
231
|
+
};
|
|
232
|
+
throw error;
|
|
233
|
+
}
|
|
234
|
+
const sourceCommit = state.records.commits.get(sourceId);
|
|
235
|
+
if (sourceCommit === void 0 || !sourceCommit) {
|
|
236
|
+
throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
|
|
237
|
+
}
|
|
238
|
+
if (parentCommitId && !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) {
|
|
239
|
+
const error = new Error(
|
|
240
|
+
"Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
|
|
241
|
+
);
|
|
242
|
+
throw error;
|
|
243
|
+
}
|
|
244
|
+
const sourceCommitBranch = sourceCommit.branch;
|
|
245
|
+
if (sourceCommit.type === commitType.MERGE && !parentCommitId) {
|
|
246
|
+
const error = new Error(
|
|
247
|
+
"Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
|
|
248
|
+
);
|
|
249
|
+
throw error;
|
|
250
|
+
}
|
|
251
|
+
if (!targetId || !state.records.commits.has(targetId)) {
|
|
252
|
+
if (sourceCommitBranch === state.records.currBranch) {
|
|
253
|
+
const error = new Error(
|
|
254
|
+
'Incorrect usage of "cherryPick". Source commit is already on current branch'
|
|
255
|
+
);
|
|
256
|
+
error.hash = {
|
|
257
|
+
text: `cherryPick ${sourceId} ${targetId}`,
|
|
258
|
+
token: `cherryPick ${sourceId} ${targetId}`,
|
|
259
|
+
expected: ["cherry-pick abc"]
|
|
260
|
+
};
|
|
261
|
+
throw error;
|
|
262
|
+
}
|
|
263
|
+
const currentCommitId = state.records.branches.get(state.records.currBranch);
|
|
264
|
+
if (currentCommitId === void 0 || !currentCommitId) {
|
|
265
|
+
const error = new Error(
|
|
266
|
+
`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`
|
|
267
|
+
);
|
|
268
|
+
error.hash = {
|
|
269
|
+
text: `cherryPick ${sourceId} ${targetId}`,
|
|
270
|
+
token: `cherryPick ${sourceId} ${targetId}`,
|
|
271
|
+
expected: ["cherry-pick abc"]
|
|
272
|
+
};
|
|
273
|
+
throw error;
|
|
274
|
+
}
|
|
275
|
+
const currentCommit = state.records.commits.get(currentCommitId);
|
|
276
|
+
if (currentCommit === void 0 || !currentCommit) {
|
|
277
|
+
const error = new Error(
|
|
278
|
+
`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`
|
|
279
|
+
);
|
|
280
|
+
error.hash = {
|
|
281
|
+
text: `cherryPick ${sourceId} ${targetId}`,
|
|
282
|
+
token: `cherryPick ${sourceId} ${targetId}`,
|
|
283
|
+
expected: ["cherry-pick abc"]
|
|
284
|
+
};
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
287
|
+
const commit2 = {
|
|
288
|
+
id: state.records.seq + "-" + getID(),
|
|
289
|
+
message: `cherry-picked ${sourceCommit?.message} into ${state.records.currBranch}`,
|
|
290
|
+
seq: state.records.seq++,
|
|
291
|
+
parents: state.records.head == null ? [] : [state.records.head.id, sourceCommit.id],
|
|
292
|
+
branch: state.records.currBranch,
|
|
293
|
+
type: commitType.CHERRY_PICK,
|
|
294
|
+
tags: tags ? tags.filter(Boolean) : [
|
|
295
|
+
`cherry-pick:${sourceCommit.id}${sourceCommit.type === commitType.MERGE ? `|parent:${parentCommitId}` : ""}`
|
|
296
|
+
]
|
|
297
|
+
};
|
|
298
|
+
state.records.head = commit2;
|
|
299
|
+
state.records.commits.set(commit2.id, commit2);
|
|
300
|
+
state.records.branches.set(state.records.currBranch, commit2.id);
|
|
301
|
+
log.debug(state.records.branches);
|
|
302
|
+
log.debug("in cherryPick");
|
|
303
|
+
}
|
|
304
|
+
}, "cherryPick");
|
|
305
|
+
var checkout = /* @__PURE__ */ __name(function(branch2) {
|
|
306
|
+
branch2 = common_default.sanitizeText(branch2, getConfig3());
|
|
307
|
+
if (!state.records.branches.has(branch2)) {
|
|
308
|
+
const error = new Error(
|
|
309
|
+
`Trying to checkout branch which is not yet created. (Help try using "branch ${branch2}")`
|
|
310
|
+
);
|
|
311
|
+
error.hash = {
|
|
312
|
+
text: `checkout ${branch2}`,
|
|
313
|
+
token: `checkout ${branch2}`,
|
|
314
|
+
expected: [`branch ${branch2}`]
|
|
315
|
+
};
|
|
316
|
+
throw error;
|
|
317
|
+
} else {
|
|
318
|
+
state.records.currBranch = branch2;
|
|
319
|
+
const id = state.records.branches.get(state.records.currBranch);
|
|
320
|
+
if (id === void 0 || !id) {
|
|
321
|
+
state.records.head = null;
|
|
322
|
+
} else {
|
|
323
|
+
state.records.head = state.records.commits.get(id) ?? null;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}, "checkout");
|
|
327
|
+
function upsert(arr, key, newVal) {
|
|
328
|
+
const index = arr.indexOf(key);
|
|
329
|
+
if (index === -1) {
|
|
330
|
+
arr.push(newVal);
|
|
331
|
+
} else {
|
|
332
|
+
arr.splice(index, 1, newVal);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
__name(upsert, "upsert");
|
|
336
|
+
function prettyPrintCommitHistory(commitArr) {
|
|
337
|
+
const commit2 = commitArr.reduce((out, commit3) => {
|
|
338
|
+
if (out.seq > commit3.seq) {
|
|
339
|
+
return out;
|
|
340
|
+
}
|
|
341
|
+
return commit3;
|
|
342
|
+
}, commitArr[0]);
|
|
343
|
+
let line = "";
|
|
344
|
+
commitArr.forEach(function(c) {
|
|
345
|
+
if (c === commit2) {
|
|
346
|
+
line += " *";
|
|
347
|
+
} else {
|
|
348
|
+
line += " |";
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
const label = [line, commit2.id, commit2.seq];
|
|
352
|
+
for (const branch2 in state.records.branches) {
|
|
353
|
+
if (state.records.branches.get(branch2) === commit2.id) {
|
|
354
|
+
label.push(branch2);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
log.debug(label.join(" "));
|
|
358
|
+
if (commit2.parents && commit2.parents.length == 2 && commit2.parents[0] && commit2.parents[1]) {
|
|
359
|
+
const newCommit = state.records.commits.get(commit2.parents[0]);
|
|
360
|
+
upsert(commitArr, commit2, newCommit);
|
|
361
|
+
if (commit2.parents[1]) {
|
|
362
|
+
commitArr.push(state.records.commits.get(commit2.parents[1]));
|
|
363
|
+
}
|
|
364
|
+
} else if (commit2.parents.length == 0) {
|
|
365
|
+
return;
|
|
366
|
+
} else {
|
|
367
|
+
if (commit2.parents[0]) {
|
|
368
|
+
const newCommit = state.records.commits.get(commit2.parents[0]);
|
|
369
|
+
upsert(commitArr, commit2, newCommit);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
commitArr = uniqBy(commitArr, (c) => c.id);
|
|
373
|
+
prettyPrintCommitHistory(commitArr);
|
|
374
|
+
}
|
|
375
|
+
__name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
|
|
376
|
+
var prettyPrint = /* @__PURE__ */ __name(function() {
|
|
377
|
+
log.debug(state.records.commits);
|
|
378
|
+
const node = getCommitsArray()[0];
|
|
379
|
+
prettyPrintCommitHistory([node]);
|
|
380
|
+
}, "prettyPrint");
|
|
381
|
+
var clear2 = /* @__PURE__ */ __name(function() {
|
|
382
|
+
state.reset();
|
|
383
|
+
clear();
|
|
384
|
+
}, "clear");
|
|
385
|
+
var getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
|
|
386
|
+
const branchesArray = [...state.records.branchConfig.values()].map((branchConfig, i) => {
|
|
387
|
+
if (branchConfig.order !== null && branchConfig.order !== void 0) {
|
|
388
|
+
return branchConfig;
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
...branchConfig,
|
|
392
|
+
order: parseFloat(`0.${i}`)
|
|
393
|
+
};
|
|
394
|
+
}).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)).map(({ name }) => ({ name }));
|
|
395
|
+
return branchesArray;
|
|
396
|
+
}, "getBranchesAsObjArray");
|
|
397
|
+
var getBranches = /* @__PURE__ */ __name(function() {
|
|
398
|
+
return state.records.branches;
|
|
399
|
+
}, "getBranches");
|
|
400
|
+
var getCommits = /* @__PURE__ */ __name(function() {
|
|
401
|
+
return state.records.commits;
|
|
402
|
+
}, "getCommits");
|
|
403
|
+
var getCommitsArray = /* @__PURE__ */ __name(function() {
|
|
404
|
+
const commitArr = [...state.records.commits.values()];
|
|
405
|
+
commitArr.forEach(function(o) {
|
|
406
|
+
log.debug(o.id);
|
|
407
|
+
});
|
|
408
|
+
commitArr.sort((a, b) => a.seq - b.seq);
|
|
409
|
+
return commitArr;
|
|
410
|
+
}, "getCommitsArray");
|
|
411
|
+
var getCurrentBranch = /* @__PURE__ */ __name(function() {
|
|
412
|
+
return state.records.currBranch;
|
|
413
|
+
}, "getCurrentBranch");
|
|
414
|
+
var getDirection = /* @__PURE__ */ __name(function() {
|
|
415
|
+
return state.records.direction;
|
|
416
|
+
}, "getDirection");
|
|
417
|
+
var getHead = /* @__PURE__ */ __name(function() {
|
|
418
|
+
return state.records.head;
|
|
419
|
+
}, "getHead");
|
|
420
|
+
var db = {
|
|
421
|
+
commitType,
|
|
422
|
+
getConfig: getConfig3,
|
|
423
|
+
setDirection,
|
|
424
|
+
setOptions,
|
|
425
|
+
getOptions,
|
|
426
|
+
commit,
|
|
427
|
+
branch,
|
|
428
|
+
merge,
|
|
429
|
+
cherryPick,
|
|
430
|
+
checkout,
|
|
431
|
+
//reset,
|
|
432
|
+
prettyPrint,
|
|
433
|
+
clear: clear2,
|
|
434
|
+
getBranchesAsObjArray,
|
|
435
|
+
getBranches,
|
|
436
|
+
getCommits,
|
|
437
|
+
getCommitsArray,
|
|
438
|
+
getCurrentBranch,
|
|
439
|
+
getDirection,
|
|
440
|
+
getHead,
|
|
441
|
+
setAccTitle,
|
|
442
|
+
getAccTitle,
|
|
443
|
+
getAccDescription,
|
|
444
|
+
setAccDescription,
|
|
445
|
+
setDiagramTitle,
|
|
446
|
+
getDiagramTitle
|
|
447
|
+
};
|
|
448
|
+
var populate = /* @__PURE__ */ __name((ast, db2) => {
|
|
449
|
+
populateCommonDb(ast, db2);
|
|
450
|
+
if (ast.dir) {
|
|
451
|
+
db2.setDirection(ast.dir);
|
|
452
|
+
}
|
|
453
|
+
for (const statement of ast.statements) {
|
|
454
|
+
parseStatement(statement, db2);
|
|
455
|
+
}
|
|
456
|
+
}, "populate");
|
|
457
|
+
var parseStatement = /* @__PURE__ */ __name((statement, db2) => {
|
|
458
|
+
const parsers = {
|
|
459
|
+
Commit: /* @__PURE__ */ __name((stmt) => db2.commit(parseCommit(stmt)), "Commit"),
|
|
460
|
+
Branch: /* @__PURE__ */ __name((stmt) => db2.branch(parseBranch(stmt)), "Branch"),
|
|
461
|
+
Merge: /* @__PURE__ */ __name((stmt) => db2.merge(parseMerge(stmt)), "Merge"),
|
|
462
|
+
Checkout: /* @__PURE__ */ __name((stmt) => db2.checkout(parseCheckout(stmt)), "Checkout"),
|
|
463
|
+
CherryPicking: /* @__PURE__ */ __name((stmt) => db2.cherryPick(parseCherryPicking(stmt)), "CherryPicking")
|
|
464
|
+
};
|
|
465
|
+
const parser2 = parsers[statement.$type];
|
|
466
|
+
if (parser2) {
|
|
467
|
+
parser2(statement);
|
|
468
|
+
} else {
|
|
469
|
+
log.error(`Unknown statement type: ${statement.$type}`);
|
|
470
|
+
}
|
|
471
|
+
}, "parseStatement");
|
|
472
|
+
var parseCommit = /* @__PURE__ */ __name((commit2) => {
|
|
473
|
+
const commitDB = {
|
|
474
|
+
id: commit2.id,
|
|
475
|
+
msg: commit2.message ?? "",
|
|
476
|
+
type: commit2.type !== void 0 ? commitType[commit2.type] : commitType.NORMAL,
|
|
477
|
+
tags: commit2.tags ?? void 0
|
|
478
|
+
};
|
|
479
|
+
return commitDB;
|
|
480
|
+
}, "parseCommit");
|
|
481
|
+
var parseBranch = /* @__PURE__ */ __name((branch2) => {
|
|
482
|
+
const branchDB = {
|
|
483
|
+
name: branch2.name,
|
|
484
|
+
order: branch2.order ?? 0
|
|
485
|
+
};
|
|
486
|
+
return branchDB;
|
|
487
|
+
}, "parseBranch");
|
|
488
|
+
var parseMerge = /* @__PURE__ */ __name((merge2) => {
|
|
489
|
+
const mergeDB = {
|
|
490
|
+
branch: merge2.branch,
|
|
491
|
+
id: merge2.id ?? "",
|
|
492
|
+
type: merge2.type !== void 0 ? commitType[merge2.type] : void 0,
|
|
493
|
+
tags: merge2.tags ?? void 0
|
|
494
|
+
};
|
|
495
|
+
return mergeDB;
|
|
496
|
+
}, "parseMerge");
|
|
497
|
+
var parseCheckout = /* @__PURE__ */ __name((checkout2) => {
|
|
498
|
+
const branch2 = checkout2.branch;
|
|
499
|
+
return branch2;
|
|
500
|
+
}, "parseCheckout");
|
|
501
|
+
var parseCherryPicking = /* @__PURE__ */ __name((cherryPicking) => {
|
|
502
|
+
const cherryPickDB = {
|
|
503
|
+
id: cherryPicking.id,
|
|
504
|
+
targetId: "",
|
|
505
|
+
tags: cherryPicking.tags?.length === 0 ? void 0 : cherryPicking.tags,
|
|
506
|
+
parent: cherryPicking.parent
|
|
507
|
+
};
|
|
508
|
+
return cherryPickDB;
|
|
509
|
+
}, "parseCherryPicking");
|
|
510
|
+
var parser = {
|
|
511
|
+
parse: /* @__PURE__ */ __name(async (input) => {
|
|
512
|
+
const ast = await parse("gitGraph", input);
|
|
513
|
+
log.debug(ast);
|
|
514
|
+
populate(ast, db);
|
|
515
|
+
}, "parse")
|
|
516
|
+
};
|
|
517
|
+
var DEFAULT_CONFIG = getConfig2();
|
|
518
|
+
var DEFAULT_GITGRAPH_CONFIG2 = DEFAULT_CONFIG?.gitGraph;
|
|
519
|
+
var LAYOUT_OFFSET = 10;
|
|
520
|
+
var COMMIT_STEP = 40;
|
|
521
|
+
var PX = 4;
|
|
522
|
+
var PY = 2;
|
|
523
|
+
var THEME_COLOR_LIMIT = 8;
|
|
524
|
+
var branchPos = /* @__PURE__ */ new Map();
|
|
525
|
+
var commitPos = /* @__PURE__ */ new Map();
|
|
526
|
+
var defaultPos = 30;
|
|
527
|
+
var allCommitsDict = /* @__PURE__ */ new Map();
|
|
528
|
+
var lanes = [];
|
|
529
|
+
var maxPos = 0;
|
|
530
|
+
var dir = "LR";
|
|
531
|
+
var clear3 = /* @__PURE__ */ __name(() => {
|
|
532
|
+
branchPos.clear();
|
|
533
|
+
commitPos.clear();
|
|
534
|
+
allCommitsDict.clear();
|
|
535
|
+
maxPos = 0;
|
|
536
|
+
lanes = [];
|
|
537
|
+
dir = "LR";
|
|
538
|
+
}, "clear");
|
|
539
|
+
var drawText = /* @__PURE__ */ __name((txt) => {
|
|
540
|
+
const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
541
|
+
const rows = typeof txt === "string" ? txt.split(/\\n|\n|<br\s*\/?>/gi) : txt;
|
|
542
|
+
rows.forEach((row) => {
|
|
543
|
+
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
544
|
+
tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
545
|
+
tspan.setAttribute("dy", "1em");
|
|
546
|
+
tspan.setAttribute("x", "0");
|
|
547
|
+
tspan.setAttribute("class", "row");
|
|
548
|
+
tspan.textContent = row.trim();
|
|
549
|
+
svgLabel.appendChild(tspan);
|
|
550
|
+
});
|
|
551
|
+
return svgLabel;
|
|
552
|
+
}, "drawText");
|
|
553
|
+
var findClosestParent = /* @__PURE__ */ __name((parents) => {
|
|
554
|
+
let closestParent;
|
|
555
|
+
let comparisonFunc;
|
|
556
|
+
let targetPosition;
|
|
557
|
+
if (dir === "BT") {
|
|
558
|
+
comparisonFunc = /* @__PURE__ */ __name((a, b) => a <= b, "comparisonFunc");
|
|
559
|
+
targetPosition = Infinity;
|
|
560
|
+
} else {
|
|
561
|
+
comparisonFunc = /* @__PURE__ */ __name((a, b) => a >= b, "comparisonFunc");
|
|
562
|
+
targetPosition = 0;
|
|
563
|
+
}
|
|
564
|
+
parents.forEach((parent) => {
|
|
565
|
+
const parentPosition = dir === "TB" || dir == "BT" ? commitPos.get(parent)?.y : commitPos.get(parent)?.x;
|
|
566
|
+
if (parentPosition !== void 0 && comparisonFunc(parentPosition, targetPosition)) {
|
|
567
|
+
closestParent = parent;
|
|
568
|
+
targetPosition = parentPosition;
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
return closestParent;
|
|
572
|
+
}, "findClosestParent");
|
|
573
|
+
var findClosestParentBT = /* @__PURE__ */ __name((parents) => {
|
|
574
|
+
let closestParent = "";
|
|
575
|
+
let maxPosition = Infinity;
|
|
576
|
+
parents.forEach((parent) => {
|
|
577
|
+
const parentPosition = commitPos.get(parent).y;
|
|
578
|
+
if (parentPosition <= maxPosition) {
|
|
579
|
+
closestParent = parent;
|
|
580
|
+
maxPosition = parentPosition;
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
return closestParent || void 0;
|
|
584
|
+
}, "findClosestParentBT");
|
|
585
|
+
var setParallelBTPos = /* @__PURE__ */ __name((sortedKeys, commits, defaultPos2) => {
|
|
586
|
+
let curPos = defaultPos2;
|
|
587
|
+
let maxPosition = defaultPos2;
|
|
588
|
+
const roots = [];
|
|
589
|
+
sortedKeys.forEach((key) => {
|
|
590
|
+
const commit2 = commits.get(key);
|
|
591
|
+
if (!commit2) {
|
|
592
|
+
throw new Error(`Commit not found for key ${key}`);
|
|
593
|
+
}
|
|
594
|
+
if (commit2.parents.length) {
|
|
595
|
+
curPos = calculateCommitPosition(commit2);
|
|
596
|
+
maxPosition = Math.max(curPos, maxPosition);
|
|
597
|
+
} else {
|
|
598
|
+
roots.push(commit2);
|
|
599
|
+
}
|
|
600
|
+
setCommitPosition(commit2, curPos);
|
|
601
|
+
});
|
|
602
|
+
curPos = maxPosition;
|
|
603
|
+
roots.forEach((commit2) => {
|
|
604
|
+
setRootPosition(commit2, curPos, defaultPos2);
|
|
605
|
+
});
|
|
606
|
+
sortedKeys.forEach((key) => {
|
|
607
|
+
const commit2 = commits.get(key);
|
|
608
|
+
if (commit2?.parents.length) {
|
|
609
|
+
const closestParent = findClosestParentBT(commit2.parents);
|
|
610
|
+
curPos = commitPos.get(closestParent).y - COMMIT_STEP;
|
|
611
|
+
if (curPos <= maxPosition) {
|
|
612
|
+
maxPosition = curPos;
|
|
613
|
+
}
|
|
614
|
+
const x = branchPos.get(commit2.branch).pos;
|
|
615
|
+
const y = curPos - LAYOUT_OFFSET;
|
|
616
|
+
commitPos.set(commit2.id, { x, y });
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
}, "setParallelBTPos");
|
|
620
|
+
var findClosestParentPos = /* @__PURE__ */ __name((commit2) => {
|
|
621
|
+
const closestParent = findClosestParent(commit2.parents.filter((p) => p !== null));
|
|
622
|
+
if (!closestParent) {
|
|
623
|
+
throw new Error(`Closest parent not found for commit ${commit2.id}`);
|
|
624
|
+
}
|
|
625
|
+
const closestParentPos = commitPos.get(closestParent)?.y;
|
|
626
|
+
if (closestParentPos === void 0) {
|
|
627
|
+
throw new Error(`Closest parent position not found for commit ${commit2.id}`);
|
|
628
|
+
}
|
|
629
|
+
return closestParentPos;
|
|
630
|
+
}, "findClosestParentPos");
|
|
631
|
+
var calculateCommitPosition = /* @__PURE__ */ __name((commit2) => {
|
|
632
|
+
const closestParentPos = findClosestParentPos(commit2);
|
|
633
|
+
return closestParentPos + COMMIT_STEP;
|
|
634
|
+
}, "calculateCommitPosition");
|
|
635
|
+
var setCommitPosition = /* @__PURE__ */ __name((commit2, curPos) => {
|
|
636
|
+
const branch2 = branchPos.get(commit2.branch);
|
|
637
|
+
if (!branch2) {
|
|
638
|
+
throw new Error(`Branch not found for commit ${commit2.id}`);
|
|
639
|
+
}
|
|
640
|
+
const x = branch2.pos;
|
|
641
|
+
const y = curPos + LAYOUT_OFFSET;
|
|
642
|
+
commitPos.set(commit2.id, { x, y });
|
|
643
|
+
return { x, y };
|
|
644
|
+
}, "setCommitPosition");
|
|
645
|
+
var setRootPosition = /* @__PURE__ */ __name((commit2, curPos, defaultPos2) => {
|
|
646
|
+
const branch2 = branchPos.get(commit2.branch);
|
|
647
|
+
if (!branch2) {
|
|
648
|
+
throw new Error(`Branch not found for commit ${commit2.id}`);
|
|
649
|
+
}
|
|
650
|
+
const y = curPos + defaultPos2;
|
|
651
|
+
const x = branch2.pos;
|
|
652
|
+
commitPos.set(commit2.id, { x, y });
|
|
653
|
+
}, "setRootPosition");
|
|
654
|
+
var drawCommitBullet = /* @__PURE__ */ __name((gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType) => {
|
|
655
|
+
if (commitSymbolType === commitType.HIGHLIGHT) {
|
|
656
|
+
gBullets.append("rect").attr("x", commitPosition.x - 10).attr("y", commitPosition.y - 10).attr("width", 20).attr("height", 20).attr(
|
|
657
|
+
"class",
|
|
658
|
+
`commit ${commit2.id} commit-highlight${branchIndex % THEME_COLOR_LIMIT} ${typeClass}-outer`
|
|
659
|
+
);
|
|
660
|
+
gBullets.append("rect").attr("x", commitPosition.x - 6).attr("y", commitPosition.y - 6).attr("width", 12).attr("height", 12).attr(
|
|
661
|
+
"class",
|
|
662
|
+
`commit ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT} ${typeClass}-inner`
|
|
663
|
+
);
|
|
664
|
+
} else if (commitSymbolType === commitType.CHERRY_PICK) {
|
|
665
|
+
gBullets.append("circle").attr("cx", commitPosition.x).attr("cy", commitPosition.y).attr("r", 10).attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
666
|
+
gBullets.append("circle").attr("cx", commitPosition.x - 3).attr("cy", commitPosition.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
667
|
+
gBullets.append("circle").attr("cx", commitPosition.x + 3).attr("cy", commitPosition.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
668
|
+
gBullets.append("line").attr("x1", commitPosition.x + 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
669
|
+
gBullets.append("line").attr("x1", commitPosition.x - 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", "#fff").attr("class", `commit ${commit2.id} ${typeClass}`);
|
|
670
|
+
} else {
|
|
671
|
+
const circle = gBullets.append("circle");
|
|
672
|
+
circle.attr("cx", commitPosition.x);
|
|
673
|
+
circle.attr("cy", commitPosition.y);
|
|
674
|
+
circle.attr("r", commit2.type === commitType.MERGE ? 9 : 10);
|
|
675
|
+
circle.attr("class", `commit ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`);
|
|
676
|
+
if (commitSymbolType === commitType.MERGE) {
|
|
677
|
+
const circle2 = gBullets.append("circle");
|
|
678
|
+
circle2.attr("cx", commitPosition.x);
|
|
679
|
+
circle2.attr("cy", commitPosition.y);
|
|
680
|
+
circle2.attr("r", 6);
|
|
681
|
+
circle2.attr(
|
|
682
|
+
"class",
|
|
683
|
+
`commit ${typeClass} ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
if (commitSymbolType === commitType.REVERSE) {
|
|
687
|
+
const cross = gBullets.append("path");
|
|
688
|
+
cross.attr(
|
|
689
|
+
"d",
|
|
690
|
+
`M ${commitPosition.x - 5},${commitPosition.y - 5}L${commitPosition.x + 5},${commitPosition.y + 5}M${commitPosition.x - 5},${commitPosition.y + 5}L${commitPosition.x + 5},${commitPosition.y - 5}`
|
|
691
|
+
).attr("class", `commit ${typeClass} ${commit2.id} commit${branchIndex % THEME_COLOR_LIMIT}`);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}, "drawCommitBullet");
|
|
695
|
+
var drawCommitLabel = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
|
|
696
|
+
if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && DEFAULT_GITGRAPH_CONFIG2?.showCommitLabel) {
|
|
697
|
+
const wrapper = gLabels.append("g");
|
|
698
|
+
const labelBkg = wrapper.insert("rect").attr("class", "commit-label-bkg");
|
|
699
|
+
const text = wrapper.append("text").attr("x", pos).attr("y", commitPosition.y + 25).attr("class", "commit-label").text(commit2.id);
|
|
700
|
+
const bbox = text.node()?.getBBox();
|
|
701
|
+
if (bbox) {
|
|
702
|
+
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);
|
|
703
|
+
if (dir === "TB" || dir === "BT") {
|
|
704
|
+
labelBkg.attr("x", commitPosition.x - (bbox.width + 4 * PX + 5)).attr("y", commitPosition.y - 12);
|
|
705
|
+
text.attr("x", commitPosition.x - (bbox.width + 4 * PX)).attr("y", commitPosition.y + bbox.height - 12);
|
|
706
|
+
} else {
|
|
707
|
+
text.attr("x", commitPosition.posWithOffset - bbox.width / 2);
|
|
708
|
+
}
|
|
709
|
+
if (DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel) {
|
|
710
|
+
if (dir === "TB" || dir === "BT") {
|
|
711
|
+
text.attr(
|
|
712
|
+
"transform",
|
|
713
|
+
"rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
|
|
714
|
+
);
|
|
715
|
+
labelBkg.attr(
|
|
716
|
+
"transform",
|
|
717
|
+
"rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")"
|
|
718
|
+
);
|
|
719
|
+
} else {
|
|
720
|
+
const r_x = -7.5 - (bbox.width + 10) / 25 * 9.5;
|
|
721
|
+
const r_y = 10 + bbox.width / 25 * 8.5;
|
|
722
|
+
wrapper.attr(
|
|
723
|
+
"transform",
|
|
724
|
+
"translate(" + r_x + ", " + r_y + ") rotate(-45, " + pos + ", " + commitPosition.y + ")"
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}, "drawCommitLabel");
|
|
731
|
+
var drawCommitTags = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => {
|
|
732
|
+
if (commit2.tags.length > 0) {
|
|
733
|
+
let yOffset = 0;
|
|
734
|
+
let maxTagBboxWidth = 0;
|
|
735
|
+
let maxTagBboxHeight = 0;
|
|
736
|
+
const tagElements = [];
|
|
737
|
+
for (const tagValue of commit2.tags.reverse()) {
|
|
738
|
+
const rect = gLabels.insert("polygon");
|
|
739
|
+
const hole = gLabels.append("circle");
|
|
740
|
+
const tag = gLabels.append("text").attr("y", commitPosition.y - 16 - yOffset).attr("class", "tag-label").text(tagValue);
|
|
741
|
+
const tagBbox = tag.node()?.getBBox();
|
|
742
|
+
if (!tagBbox) {
|
|
743
|
+
throw new Error("Tag bbox not found");
|
|
744
|
+
}
|
|
745
|
+
maxTagBboxWidth = Math.max(maxTagBboxWidth, tagBbox.width);
|
|
746
|
+
maxTagBboxHeight = Math.max(maxTagBboxHeight, tagBbox.height);
|
|
747
|
+
tag.attr("x", commitPosition.posWithOffset - tagBbox.width / 2);
|
|
748
|
+
tagElements.push({
|
|
749
|
+
tag,
|
|
750
|
+
hole,
|
|
751
|
+
rect,
|
|
752
|
+
yOffset
|
|
753
|
+
});
|
|
754
|
+
yOffset += 20;
|
|
755
|
+
}
|
|
756
|
+
for (const { tag, hole, rect, yOffset: yOffset2 } of tagElements) {
|
|
757
|
+
const h2 = maxTagBboxHeight / 2;
|
|
758
|
+
const ly = commitPosition.y - 19.2 - yOffset2;
|
|
759
|
+
rect.attr("class", "tag-label-bkg").attr(
|
|
760
|
+
"points",
|
|
761
|
+
`
|
|
762
|
+
${pos - maxTagBboxWidth / 2 - PX / 2},${ly + PY}
|
|
763
|
+
${pos - maxTagBboxWidth / 2 - PX / 2},${ly - PY}
|
|
764
|
+
${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly - h2 - PY}
|
|
765
|
+
${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly - h2 - PY}
|
|
766
|
+
${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly + h2 + PY}
|
|
767
|
+
${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly + h2 + PY}`
|
|
768
|
+
);
|
|
769
|
+
hole.attr("cy", ly).attr("cx", pos - maxTagBboxWidth / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole");
|
|
770
|
+
if (dir === "TB" || dir === "BT") {
|
|
771
|
+
const yOrigin = pos + yOffset2;
|
|
772
|
+
rect.attr("class", "tag-label-bkg").attr(
|
|
773
|
+
"points",
|
|
774
|
+
`
|
|
775
|
+
${commitPosition.x},${yOrigin + 2}
|
|
776
|
+
${commitPosition.x},${yOrigin - 2}
|
|
777
|
+
${commitPosition.x + LAYOUT_OFFSET},${yOrigin - h2 - 2}
|
|
778
|
+
${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin - h2 - 2}
|
|
779
|
+
${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin + h2 + 2}
|
|
780
|
+
${commitPosition.x + LAYOUT_OFFSET},${yOrigin + h2 + 2}`
|
|
781
|
+
).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
782
|
+
hole.attr("cx", commitPosition.x + PX / 2).attr("cy", yOrigin).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
783
|
+
tag.attr("x", commitPosition.x + 5).attr("y", yOrigin + 3).attr("transform", "translate(14,14) rotate(45, " + commitPosition.x + "," + pos + ")");
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}, "drawCommitTags");
|
|
788
|
+
var getCommitClassType = /* @__PURE__ */ __name((commit2) => {
|
|
789
|
+
const commitSymbolType = commit2.customType ?? commit2.type;
|
|
790
|
+
switch (commitSymbolType) {
|
|
791
|
+
case commitType.NORMAL:
|
|
792
|
+
return "commit-normal";
|
|
793
|
+
case commitType.REVERSE:
|
|
794
|
+
return "commit-reverse";
|
|
795
|
+
case commitType.HIGHLIGHT:
|
|
796
|
+
return "commit-highlight";
|
|
797
|
+
case commitType.MERGE:
|
|
798
|
+
return "commit-merge";
|
|
799
|
+
case commitType.CHERRY_PICK:
|
|
800
|
+
return "commit-cherry-pick";
|
|
801
|
+
default:
|
|
802
|
+
return "commit-normal";
|
|
803
|
+
}
|
|
804
|
+
}, "getCommitClassType");
|
|
805
|
+
var calculatePosition = /* @__PURE__ */ __name((commit2, dir2, pos, commitPos2) => {
|
|
806
|
+
const defaultCommitPosition = { x: 0, y: 0 };
|
|
807
|
+
if (commit2.parents.length > 0) {
|
|
808
|
+
const closestParent = findClosestParent(commit2.parents);
|
|
809
|
+
if (closestParent) {
|
|
810
|
+
const parentPosition = commitPos2.get(closestParent) ?? defaultCommitPosition;
|
|
811
|
+
if (dir2 === "TB") {
|
|
812
|
+
return parentPosition.y + COMMIT_STEP;
|
|
813
|
+
} else if (dir2 === "BT") {
|
|
814
|
+
const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
|
|
815
|
+
return currentPosition.y - COMMIT_STEP;
|
|
816
|
+
} else {
|
|
817
|
+
return parentPosition.x + COMMIT_STEP;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
} else {
|
|
821
|
+
if (dir2 === "TB") {
|
|
822
|
+
return defaultPos;
|
|
823
|
+
} else if (dir2 === "BT") {
|
|
824
|
+
const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition;
|
|
825
|
+
return currentPosition.y - COMMIT_STEP;
|
|
826
|
+
} else {
|
|
827
|
+
return 0;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
return 0;
|
|
831
|
+
}, "calculatePosition");
|
|
832
|
+
var getCommitPosition = /* @__PURE__ */ __name((commit2, pos, isParallelCommits) => {
|
|
833
|
+
const posWithOffset = dir === "BT" && isParallelCommits ? pos : pos + LAYOUT_OFFSET;
|
|
834
|
+
const y = dir === "TB" || dir === "BT" ? posWithOffset : branchPos.get(commit2.branch)?.pos;
|
|
835
|
+
const x = dir === "TB" || dir === "BT" ? branchPos.get(commit2.branch)?.pos : posWithOffset;
|
|
836
|
+
if (x === void 0 || y === void 0) {
|
|
837
|
+
throw new Error(`Position were undefined for commit ${commit2.id}`);
|
|
838
|
+
}
|
|
839
|
+
return { x, y, posWithOffset };
|
|
840
|
+
}, "getCommitPosition");
|
|
841
|
+
var drawCommits = /* @__PURE__ */ __name((svg, commits, modifyGraph) => {
|
|
842
|
+
if (!DEFAULT_GITGRAPH_CONFIG2) {
|
|
843
|
+
throw new Error("GitGraph config not found");
|
|
844
|
+
}
|
|
845
|
+
const gBullets = svg.append("g").attr("class", "commit-bullets");
|
|
846
|
+
const gLabels = svg.append("g").attr("class", "commit-labels");
|
|
847
|
+
let pos = dir === "TB" || dir === "BT" ? defaultPos : 0;
|
|
848
|
+
const keys = [...commits.keys()];
|
|
849
|
+
const isParallelCommits = DEFAULT_GITGRAPH_CONFIG2?.parallelCommits ?? false;
|
|
850
|
+
const sortKeys = /* @__PURE__ */ __name((a, b) => {
|
|
851
|
+
const seqA = commits.get(a)?.seq;
|
|
852
|
+
const seqB = commits.get(b)?.seq;
|
|
853
|
+
return seqA !== void 0 && seqB !== void 0 ? seqA - seqB : 0;
|
|
854
|
+
}, "sortKeys");
|
|
855
|
+
let sortedKeys = keys.sort(sortKeys);
|
|
856
|
+
if (dir === "BT") {
|
|
857
|
+
if (isParallelCommits) {
|
|
858
|
+
setParallelBTPos(sortedKeys, commits, pos);
|
|
859
|
+
}
|
|
860
|
+
sortedKeys = sortedKeys.reverse();
|
|
861
|
+
}
|
|
862
|
+
sortedKeys.forEach((key) => {
|
|
863
|
+
const commit2 = commits.get(key);
|
|
864
|
+
if (!commit2) {
|
|
865
|
+
throw new Error(`Commit not found for key ${key}`);
|
|
866
|
+
}
|
|
867
|
+
if (isParallelCommits) {
|
|
868
|
+
pos = calculatePosition(commit2, dir, pos, commitPos);
|
|
869
|
+
}
|
|
870
|
+
const commitPosition = getCommitPosition(commit2, pos, isParallelCommits);
|
|
871
|
+
if (modifyGraph) {
|
|
872
|
+
const typeClass = getCommitClassType(commit2);
|
|
873
|
+
const commitSymbolType = commit2.customType ?? commit2.type;
|
|
874
|
+
const branchIndex = branchPos.get(commit2.branch)?.index ?? 0;
|
|
875
|
+
drawCommitBullet(gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType);
|
|
876
|
+
drawCommitLabel(gLabels, commit2, commitPosition, pos);
|
|
877
|
+
drawCommitTags(gLabels, commit2, commitPosition, pos);
|
|
878
|
+
}
|
|
879
|
+
if (dir === "TB" || dir === "BT") {
|
|
880
|
+
commitPos.set(commit2.id, { x: commitPosition.x, y: commitPosition.posWithOffset });
|
|
881
|
+
} else {
|
|
882
|
+
commitPos.set(commit2.id, { x: commitPosition.posWithOffset, y: commitPosition.y });
|
|
883
|
+
}
|
|
884
|
+
pos = dir === "BT" && isParallelCommits ? pos + COMMIT_STEP : pos + COMMIT_STEP + LAYOUT_OFFSET;
|
|
885
|
+
if (pos > maxPos) {
|
|
886
|
+
maxPos = pos;
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
}, "drawCommits");
|
|
890
|
+
var shouldRerouteArrow = /* @__PURE__ */ __name((commitA, commitB, p1, p2, allCommits) => {
|
|
891
|
+
const commitBIsFurthest = dir === "TB" || dir === "BT" ? p1.x < p2.x : p1.y < p2.y;
|
|
892
|
+
const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch;
|
|
893
|
+
const isOnBranchToGetCurve = /* @__PURE__ */ __name((x) => x.branch === branchToGetCurve, "isOnBranchToGetCurve");
|
|
894
|
+
const isBetweenCommits = /* @__PURE__ */ __name((x) => x.seq > commitA.seq && x.seq < commitB.seq, "isBetweenCommits");
|
|
895
|
+
return [...allCommits.values()].some((commitX) => {
|
|
896
|
+
return isBetweenCommits(commitX) && isOnBranchToGetCurve(commitX);
|
|
897
|
+
});
|
|
898
|
+
}, "shouldRerouteArrow");
|
|
899
|
+
var findLane = /* @__PURE__ */ __name((y1, y2, depth = 0) => {
|
|
900
|
+
const candidate = y1 + Math.abs(y1 - y2) / 2;
|
|
901
|
+
if (depth > 5) {
|
|
902
|
+
return candidate;
|
|
903
|
+
}
|
|
904
|
+
const ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10);
|
|
905
|
+
if (ok) {
|
|
906
|
+
lanes.push(candidate);
|
|
907
|
+
return candidate;
|
|
908
|
+
}
|
|
909
|
+
const diff = Math.abs(y1 - y2);
|
|
910
|
+
return findLane(y1, y2 - diff / 5, depth + 1);
|
|
911
|
+
}, "findLane");
|
|
912
|
+
var drawArrow = /* @__PURE__ */ __name((svg, commitA, commitB, allCommits) => {
|
|
913
|
+
const p1 = commitPos.get(commitA.id);
|
|
914
|
+
const p2 = commitPos.get(commitB.id);
|
|
915
|
+
if (p1 === void 0 || p2 === void 0) {
|
|
916
|
+
throw new Error(`Commit positions not found for commits ${commitA.id} and ${commitB.id}`);
|
|
917
|
+
}
|
|
918
|
+
const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p2, allCommits);
|
|
919
|
+
let arc = "";
|
|
920
|
+
let arc2 = "";
|
|
921
|
+
let radius = 0;
|
|
922
|
+
let offset = 0;
|
|
923
|
+
let colorClassNum = branchPos.get(commitB.branch)?.index;
|
|
924
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
925
|
+
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
926
|
+
}
|
|
927
|
+
let lineDef;
|
|
928
|
+
if (arrowNeedsRerouting) {
|
|
929
|
+
arc = "A 10 10, 0, 0, 0,";
|
|
930
|
+
arc2 = "A 10 10, 0, 0, 1,";
|
|
931
|
+
radius = 10;
|
|
932
|
+
offset = 10;
|
|
933
|
+
const lineY = p1.y < p2.y ? findLane(p1.y, p2.y) : findLane(p2.y, p1.y);
|
|
934
|
+
const lineX = p1.x < p2.x ? findLane(p1.x, p2.x) : findLane(p2.x, p1.x);
|
|
935
|
+
if (dir === "TB") {
|
|
936
|
+
if (p1.x < p2.x) {
|
|
937
|
+
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}`;
|
|
938
|
+
} else {
|
|
939
|
+
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
940
|
+
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}`;
|
|
941
|
+
}
|
|
942
|
+
} else if (dir === "BT") {
|
|
943
|
+
if (p1.x < p2.x) {
|
|
944
|
+
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}`;
|
|
945
|
+
} else {
|
|
946
|
+
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
947
|
+
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}`;
|
|
948
|
+
}
|
|
949
|
+
} else {
|
|
950
|
+
if (p1.y < p2.y) {
|
|
951
|
+
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}`;
|
|
952
|
+
} else {
|
|
953
|
+
colorClassNum = branchPos.get(commitA.branch)?.index;
|
|
954
|
+
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}`;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
} else {
|
|
958
|
+
arc = "A 20 20, 0, 0, 0,";
|
|
959
|
+
arc2 = "A 20 20, 0, 0, 1,";
|
|
960
|
+
radius = 20;
|
|
961
|
+
offset = 20;
|
|
962
|
+
if (dir === "TB") {
|
|
963
|
+
if (p1.x < p2.x) {
|
|
964
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
965
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
966
|
+
} else {
|
|
967
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
if (p1.x > p2.x) {
|
|
971
|
+
arc = "A 20 20, 0, 0, 0,";
|
|
972
|
+
arc2 = "A 20 20, 0, 0, 1,";
|
|
973
|
+
radius = 20;
|
|
974
|
+
offset = 20;
|
|
975
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
976
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc2} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
977
|
+
} else {
|
|
978
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x + radius} ${p1.y} ${arc} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
if (p1.x === p2.x) {
|
|
982
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
983
|
+
}
|
|
984
|
+
} else if (dir === "BT") {
|
|
985
|
+
if (p1.x < p2.x) {
|
|
986
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
987
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
988
|
+
} else {
|
|
989
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
if (p1.x > p2.x) {
|
|
993
|
+
arc = "A 20 20, 0, 0, 0,";
|
|
994
|
+
arc2 = "A 20 20, 0, 0, 1,";
|
|
995
|
+
radius = 20;
|
|
996
|
+
offset = 20;
|
|
997
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
998
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc} ${p1.x - offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
999
|
+
} else {
|
|
1000
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
if (p1.x === p2.x) {
|
|
1004
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
1005
|
+
}
|
|
1006
|
+
} else {
|
|
1007
|
+
if (p1.y < p2.y) {
|
|
1008
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
1009
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc2} ${p2.x} ${p1.y + offset} L ${p2.x} ${p2.y}`;
|
|
1010
|
+
} else {
|
|
1011
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y - radius} ${arc} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
if (p1.y > p2.y) {
|
|
1015
|
+
if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) {
|
|
1016
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x - radius} ${p1.y} ${arc} ${p2.x} ${p1.y - offset} L ${p2.x} ${p2.y}`;
|
|
1017
|
+
} else {
|
|
1018
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p2.y + radius} ${arc2} ${p1.x + offset} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
if (p1.y === p2.y) {
|
|
1022
|
+
lineDef = `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
if (lineDef === void 0) {
|
|
1027
|
+
throw new Error("Line definition not found");
|
|
1028
|
+
}
|
|
1029
|
+
svg.append("path").attr("d", lineDef).attr("class", "arrow arrow" + colorClassNum % THEME_COLOR_LIMIT);
|
|
1030
|
+
}, "drawArrow");
|
|
1031
|
+
var drawArrows = /* @__PURE__ */ __name((svg, commits) => {
|
|
1032
|
+
const gArrows = svg.append("g").attr("class", "commit-arrows");
|
|
1033
|
+
[...commits.keys()].forEach((key) => {
|
|
1034
|
+
const commit2 = commits.get(key);
|
|
1035
|
+
if (commit2.parents && commit2.parents.length > 0) {
|
|
1036
|
+
commit2.parents.forEach((parent) => {
|
|
1037
|
+
drawArrow(gArrows, commits.get(parent), commit2, commits);
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
}, "drawArrows");
|
|
1042
|
+
var drawBranches = /* @__PURE__ */ __name((svg, branches) => {
|
|
1043
|
+
const g = svg.append("g");
|
|
1044
|
+
branches.forEach((branch2, index) => {
|
|
1045
|
+
const adjustIndexForTheme = index % THEME_COLOR_LIMIT;
|
|
1046
|
+
const pos = branchPos.get(branch2.name)?.pos;
|
|
1047
|
+
if (pos === void 0) {
|
|
1048
|
+
throw new Error(`Position not found for branch ${branch2.name}`);
|
|
1049
|
+
}
|
|
1050
|
+
const line = g.append("line");
|
|
1051
|
+
line.attr("x1", 0);
|
|
1052
|
+
line.attr("y1", pos);
|
|
1053
|
+
line.attr("x2", maxPos);
|
|
1054
|
+
line.attr("y2", pos);
|
|
1055
|
+
line.attr("class", "branch branch" + adjustIndexForTheme);
|
|
1056
|
+
if (dir === "TB") {
|
|
1057
|
+
line.attr("y1", defaultPos);
|
|
1058
|
+
line.attr("x1", pos);
|
|
1059
|
+
line.attr("y2", maxPos);
|
|
1060
|
+
line.attr("x2", pos);
|
|
1061
|
+
} else if (dir === "BT") {
|
|
1062
|
+
line.attr("y1", maxPos);
|
|
1063
|
+
line.attr("x1", pos);
|
|
1064
|
+
line.attr("y2", defaultPos);
|
|
1065
|
+
line.attr("x2", pos);
|
|
1066
|
+
}
|
|
1067
|
+
lanes.push(pos);
|
|
1068
|
+
const name = branch2.name;
|
|
1069
|
+
const labelElement = drawText(name);
|
|
1070
|
+
const bkg = g.insert("rect");
|
|
1071
|
+
const branchLabel = g.insert("g").attr("class", "branchLabel");
|
|
1072
|
+
const label = branchLabel.insert("g").attr("class", "label branch-label" + adjustIndexForTheme);
|
|
1073
|
+
label.node().appendChild(labelElement);
|
|
1074
|
+
const bbox = labelElement.getBBox();
|
|
1075
|
+
bkg.attr("class", "branchLabelBkg label" + adjustIndexForTheme).attr("rx", 4).attr("ry", 4).attr("x", -bbox.width - 4 - (DEFAULT_GITGRAPH_CONFIG2?.rotateCommitLabel === true ? 30 : 0)).attr("y", -bbox.height / 2 + 8).attr("width", bbox.width + 18).attr("height", bbox.height + 4);
|
|
1076
|
+
label.attr(
|
|
1077
|
+
"transform",
|
|
1078
|
+
"translate(" + (-bbox.width - 14 - (DEFAULT_GITGRAPH_CONFIG2?.rotateCommitLabel === true ? 30 : 0)) + ", " + (pos - bbox.height / 2 - 1) + ")"
|
|
1079
|
+
);
|
|
1080
|
+
if (dir === "TB") {
|
|
1081
|
+
bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", 0);
|
|
1082
|
+
label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", 0)");
|
|
1083
|
+
} else if (dir === "BT") {
|
|
1084
|
+
bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", maxPos);
|
|
1085
|
+
label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + maxPos + ")");
|
|
1086
|
+
} else {
|
|
1087
|
+
bkg.attr("transform", "translate(-19, " + (pos - bbox.height / 2) + ")");
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
}, "drawBranches");
|
|
1091
|
+
var setBranchPosition = /* @__PURE__ */ __name(function(name, pos, index, bbox, rotateCommitLabel) {
|
|
1092
|
+
branchPos.set(name, { pos, index });
|
|
1093
|
+
pos += 50 + (rotateCommitLabel ? 40 : 0) + (dir === "TB" || dir === "BT" ? bbox.width / 2 : 0);
|
|
1094
|
+
return pos;
|
|
1095
|
+
}, "setBranchPosition");
|
|
1096
|
+
var draw = /* @__PURE__ */ __name(function(txt, id, ver, diagObj) {
|
|
1097
|
+
clear3();
|
|
1098
|
+
log.debug("in gitgraph renderer", txt + "\n", "id:", id, ver);
|
|
1099
|
+
if (!DEFAULT_GITGRAPH_CONFIG2) {
|
|
1100
|
+
throw new Error("GitGraph config not found");
|
|
1101
|
+
}
|
|
1102
|
+
const rotateCommitLabel = DEFAULT_GITGRAPH_CONFIG2.rotateCommitLabel ?? false;
|
|
1103
|
+
const db2 = diagObj.db;
|
|
1104
|
+
allCommitsDict = db2.getCommits();
|
|
1105
|
+
const branches = db2.getBranchesAsObjArray();
|
|
1106
|
+
dir = db2.getDirection();
|
|
1107
|
+
const diagram2 = select(`[id="${id}"]`);
|
|
1108
|
+
let pos = 0;
|
|
1109
|
+
branches.forEach((branch2, index) => {
|
|
1110
|
+
const labelElement = drawText(branch2.name);
|
|
1111
|
+
const g = diagram2.append("g");
|
|
1112
|
+
const branchLabel = g.insert("g").attr("class", "branchLabel");
|
|
1113
|
+
const label = branchLabel.insert("g").attr("class", "label branch-label");
|
|
1114
|
+
label.node()?.appendChild(labelElement);
|
|
1115
|
+
const bbox = labelElement.getBBox();
|
|
1116
|
+
pos = setBranchPosition(branch2.name, pos, index, bbox, rotateCommitLabel);
|
|
1117
|
+
label.remove();
|
|
1118
|
+
branchLabel.remove();
|
|
1119
|
+
g.remove();
|
|
1120
|
+
});
|
|
1121
|
+
drawCommits(diagram2, allCommitsDict, false);
|
|
1122
|
+
if (DEFAULT_GITGRAPH_CONFIG2.showBranches) {
|
|
1123
|
+
drawBranches(diagram2, branches);
|
|
1124
|
+
}
|
|
1125
|
+
drawArrows(diagram2, allCommitsDict);
|
|
1126
|
+
drawCommits(diagram2, allCommitsDict, true);
|
|
1127
|
+
utils_default.insertTitle(
|
|
1128
|
+
diagram2,
|
|
1129
|
+
"gitTitleText",
|
|
1130
|
+
DEFAULT_GITGRAPH_CONFIG2.titleTopMargin ?? 0,
|
|
1131
|
+
db2.getDiagramTitle()
|
|
1132
|
+
);
|
|
1133
|
+
setupGraphViewbox2(
|
|
1134
|
+
void 0,
|
|
1135
|
+
diagram2,
|
|
1136
|
+
DEFAULT_GITGRAPH_CONFIG2.diagramPadding,
|
|
1137
|
+
DEFAULT_GITGRAPH_CONFIG2.useMaxWidth
|
|
1138
|
+
);
|
|
1139
|
+
}, "draw");
|
|
1140
|
+
var gitGraphRenderer_default = {
|
|
1141
|
+
draw
|
|
1142
|
+
};
|
|
1143
|
+
var getStyles = /* @__PURE__ */ __name((options) => `
|
|
1144
|
+
.commit-id,
|
|
1145
|
+
.commit-msg,
|
|
1146
|
+
.branch-label {
|
|
1147
|
+
fill: lightgrey;
|
|
1148
|
+
color: lightgrey;
|
|
1149
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
1150
|
+
font-family: var(--mermaid-font-family);
|
|
1151
|
+
}
|
|
1152
|
+
${[0, 1, 2, 3, 4, 5, 6, 7].map(
|
|
1153
|
+
(i) => `
|
|
1154
|
+
.branch-label${i} { fill: ${options["gitBranchLabel" + i]}; }
|
|
1155
|
+
.commit${i} { stroke: ${options["git" + i]}; fill: ${options["git" + i]}; }
|
|
1156
|
+
.commit-highlight${i} { stroke: ${options["gitInv" + i]}; fill: ${options["gitInv" + i]}; }
|
|
1157
|
+
.label${i} { fill: ${options["git" + i]}; }
|
|
1158
|
+
.arrow${i} { stroke: ${options["git" + i]}; }
|
|
1159
|
+
`
|
|
1160
|
+
).join("\n")}
|
|
1161
|
+
|
|
1162
|
+
.branch {
|
|
1163
|
+
stroke-width: 1;
|
|
1164
|
+
stroke: ${options.lineColor};
|
|
1165
|
+
stroke-dasharray: 2;
|
|
1166
|
+
}
|
|
1167
|
+
.commit-label { font-size: ${options.commitLabelFontSize}; fill: ${options.commitLabelColor};}
|
|
1168
|
+
.commit-label-bkg { font-size: ${options.commitLabelFontSize}; fill: ${options.commitLabelBackground}; opacity: 0.5; }
|
|
1169
|
+
.tag-label { font-size: ${options.tagLabelFontSize}; fill: ${options.tagLabelColor};}
|
|
1170
|
+
.tag-label-bkg { fill: ${options.tagLabelBackground}; stroke: ${options.tagLabelBorder}; }
|
|
1171
|
+
.tag-hole { fill: ${options.textColor}; }
|
|
1172
|
+
|
|
1173
|
+
.commit-merge {
|
|
1174
|
+
stroke: ${options.primaryColor};
|
|
1175
|
+
fill: ${options.primaryColor};
|
|
1176
|
+
}
|
|
1177
|
+
.commit-reverse {
|
|
1178
|
+
stroke: ${options.primaryColor};
|
|
1179
|
+
fill: ${options.primaryColor};
|
|
1180
|
+
stroke-width: 3;
|
|
1181
|
+
}
|
|
1182
|
+
.commit-highlight-outer {
|
|
1183
|
+
}
|
|
1184
|
+
.commit-highlight-inner {
|
|
1185
|
+
stroke: ${options.primaryColor};
|
|
1186
|
+
fill: ${options.primaryColor};
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
|
|
1190
|
+
.gitTitleText {
|
|
1191
|
+
text-anchor: middle;
|
|
1192
|
+
font-size: 18px;
|
|
1193
|
+
fill: ${options.textColor};
|
|
1194
|
+
}
|
|
1195
|
+
`, "getStyles");
|
|
1196
|
+
var styles_default = getStyles;
|
|
1197
|
+
var diagram = {
|
|
1198
|
+
parser,
|
|
1199
|
+
db,
|
|
1200
|
+
renderer: gitGraphRenderer_default,
|
|
1201
|
+
styles: styles_default
|
|
1202
|
+
};
|
|
1203
|
+
export {
|
|
1204
|
+
diagram
|
|
1205
|
+
};
|
|
1206
|
+
//# sourceMappingURL=gitGraphDiagram-NY62KEGX-4QE9kesp.js.map
|