@loopstack/loopstack-studio 0.25.0 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai-elements/message.js +2 -2
- package/dist/components/ai-elements/reasoning.js +9 -9
- package/dist/loopstack-studio.css +1 -1
- package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
- package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
- package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
- package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
- package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
- package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
- package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
- package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
- package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
- package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
- package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
- package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
- package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
- package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
- package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
- package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
- package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
- package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
- package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
- package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
- package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
- package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
- package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
- package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
- package/dist/node_modules/katex/dist/katex.js +1256 -1209
- package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
- package/dist/node_modules/lodash-es/_baseClone.js +2 -2
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
- package/dist/node_modules/lodash-es/_baseToString.js +1 -1
- package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
- package/dist/node_modules/lodash-es/_createSet.js +1 -1
- package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
- package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
- package/dist/node_modules/lodash-es/findIndex.js +2 -2
- package/dist/node_modules/lodash-es/flatMap.js +1 -1
- package/dist/node_modules/lodash-es/forEach.js +1 -1
- package/dist/node_modules/lodash-es/max.js +1 -1
- package/dist/node_modules/lodash-es/min.js +1 -1
- package/dist/node_modules/lodash-es/minBy.js +1 -1
- package/dist/node_modules/lodash-es/reduce.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
- package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
- package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
- package/dist/node_modules/remend/dist/index.js +333 -264
- package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
- package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
- package/dist/node_modules/streamdown/dist/index.js +1 -1
- package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
- package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
- package/dist/pages/DashboardPage.js +3 -3
- package/package.json +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
- package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
- package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
- package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
- package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
- package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
- package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
- package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
- package/dist/node_modules/lodash-es/_baseSome.js +0 -9
- package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
- package/dist/node_modules/lodash-es/assign.js +0 -14
- package/dist/node_modules/lodash-es/compact.js +0 -9
- package/dist/node_modules/lodash-es/difference.js +0 -8
- package/dist/node_modules/lodash-es/drop.js +0 -8
- package/dist/node_modules/lodash-es/dropRight.js +0 -8
- package/dist/node_modules/lodash-es/every.js +0 -11
- package/dist/node_modules/lodash-es/groupBy.js +0 -6
- package/dist/node_modules/lodash-es/head.js +0 -5
- package/dist/node_modules/lodash-es/includes.js +0 -13
- package/dist/node_modules/lodash-es/indexOf.js +0 -11
- package/dist/node_modules/lodash-es/isRegExp.js +0 -5
- package/dist/node_modules/lodash-es/negate.js +0 -16
- package/dist/node_modules/lodash-es/pickBy.js +0 -15
- package/dist/node_modules/lodash-es/reject.js +0 -10
- package/dist/node_modules/lodash-es/some.js +0 -11
- package/dist/node_modules/lodash-es/uniq.js +0 -6
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
- package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
- package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
- package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
import { __name, log } from "./chunk-AGHRB4JF.js";
|
|
2
|
+
import { clear, common_default, defaultConfig_default, getAccDescription, getAccTitle, getConfig, getConfig2, getDiagramTitle, setAccDescription, setAccTitle, setDiagramTitle, setupGraphViewbox2 } from "./chunk-ICPOFSXX.js";
|
|
3
|
+
import select_default from "../../../../d3-selection/src/select.js";
|
|
4
|
+
import "../../../../d3/src/index.js";
|
|
5
|
+
import { cleanAndMerge, random, utils_default } from "./chunk-5PVQY5BW.js";
|
|
6
|
+
import { populateCommonDb } from "./chunk-4BX2VUAB.js";
|
|
7
|
+
import { parse } from "../../../../@mermaid-js/parser/dist/mermaid-parser.core.js";
|
|
8
|
+
import { ImperativeState } from "./chunk-QZHKN3VN.js";
|
|
9
|
+
var commitType = {
|
|
10
|
+
NORMAL: 0,
|
|
11
|
+
REVERSE: 1,
|
|
12
|
+
HIGHLIGHT: 2,
|
|
13
|
+
MERGE: 3,
|
|
14
|
+
CHERRY_PICK: 4
|
|
15
|
+
}, DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph, getConfig3 = /* @__PURE__ */ __name(() => cleanAndMerge({
|
|
16
|
+
...DEFAULT_GITGRAPH_CONFIG,
|
|
17
|
+
...getConfig().gitGraph
|
|
18
|
+
}), "getConfig"), state = new ImperativeState(() => {
|
|
19
|
+
let i = getConfig3(), N = i.mainBranchName, P = i.mainBranchOrder;
|
|
20
|
+
return {
|
|
21
|
+
mainBranchName: N,
|
|
22
|
+
commits: /* @__PURE__ */ new Map(),
|
|
23
|
+
head: null,
|
|
24
|
+
branchConfig: /* @__PURE__ */ new Map([[N, {
|
|
25
|
+
name: N,
|
|
26
|
+
order: P
|
|
27
|
+
}]]),
|
|
28
|
+
branches: /* @__PURE__ */ new Map([[N, null]]),
|
|
29
|
+
currBranch: N,
|
|
30
|
+
direction: "LR",
|
|
31
|
+
seq: 0,
|
|
32
|
+
options: {}
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
function getID() {
|
|
36
|
+
return random({ length: 7 });
|
|
37
|
+
}
|
|
38
|
+
__name(getID, "getID");
|
|
39
|
+
function uniqBy(i, N) {
|
|
40
|
+
let P = /* @__PURE__ */ Object.create(null);
|
|
41
|
+
return i.reduce((i, F) => {
|
|
42
|
+
let I = N(F);
|
|
43
|
+
return P[I] || (P[I] = !0, i.push(F)), i;
|
|
44
|
+
}, []);
|
|
45
|
+
}
|
|
46
|
+
__name(uniqBy, "uniqBy");
|
|
47
|
+
var setDirection = /* @__PURE__ */ __name(function(i) {
|
|
48
|
+
state.records.direction = i;
|
|
49
|
+
}, "setDirection"), setOptions = /* @__PURE__ */ __name(function(i) {
|
|
50
|
+
log.debug("options str", i), i = i?.trim(), i ||= "{}";
|
|
51
|
+
try {
|
|
52
|
+
state.records.options = JSON.parse(i);
|
|
53
|
+
} catch (i) {
|
|
54
|
+
log.error("error while parsing gitGraph options", i.message);
|
|
55
|
+
}
|
|
56
|
+
}, "setOptions"), getOptions = /* @__PURE__ */ __name(function() {
|
|
57
|
+
return state.records.options;
|
|
58
|
+
}, "getOptions"), commit = /* @__PURE__ */ __name(function(i) {
|
|
59
|
+
let P = i.msg, I = i.id, L = i.type, R = i.tags;
|
|
60
|
+
log.info("commit", P, I, L, R), log.debug("Entering commit:", P, I, L, R);
|
|
61
|
+
let z = getConfig3();
|
|
62
|
+
I = common_default.sanitizeText(I, z), P = common_default.sanitizeText(P, z), R = R?.map((i) => common_default.sanitizeText(i, z));
|
|
63
|
+
let B = {
|
|
64
|
+
id: I || state.records.seq + "-" + getID(),
|
|
65
|
+
message: P,
|
|
66
|
+
seq: state.records.seq++,
|
|
67
|
+
type: L ?? commitType.NORMAL,
|
|
68
|
+
tags: R ?? [],
|
|
69
|
+
parents: state.records.head == null ? [] : [state.records.head.id],
|
|
70
|
+
branch: state.records.currBranch
|
|
71
|
+
};
|
|
72
|
+
state.records.head = B, log.info("main branch", z.mainBranchName), state.records.commits.has(B.id) && log.warn(`Commit ID ${B.id} already exists`), state.records.commits.set(B.id, B), state.records.branches.set(state.records.currBranch, B.id), log.debug("in pushCommit " + B.id);
|
|
73
|
+
}, "commit"), branch = /* @__PURE__ */ __name(function(i) {
|
|
74
|
+
let P = i.name, I = i.order;
|
|
75
|
+
if (P = common_default.sanitizeText(P, getConfig3()), state.records.branches.has(P)) throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${P}")`);
|
|
76
|
+
state.records.branches.set(P, state.records.head == null ? null : state.records.head.id), state.records.branchConfig.set(P, {
|
|
77
|
+
name: P,
|
|
78
|
+
order: I
|
|
79
|
+
}), checkout(P), log.debug("in createBranch");
|
|
80
|
+
}, "branch"), merge = /* @__PURE__ */ __name((i) => {
|
|
81
|
+
let P = i.branch, I = i.id, L = i.type, R = i.tags, z = getConfig3();
|
|
82
|
+
P = common_default.sanitizeText(P, z), I &&= common_default.sanitizeText(I, z);
|
|
83
|
+
let B = state.records.branches.get(state.records.currBranch), V = state.records.branches.get(P), H = B ? state.records.commits.get(B) : void 0, U = V ? state.records.commits.get(V) : void 0;
|
|
84
|
+
if (H && U && H.branch === P) throw Error(`Cannot merge branch '${P}' into itself.`);
|
|
85
|
+
if (state.records.currBranch === P) {
|
|
86
|
+
let i = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Cannot merge a branch to itself");
|
|
87
|
+
throw i.hash = {
|
|
88
|
+
text: `merge ${P}`,
|
|
89
|
+
token: `merge ${P}`,
|
|
90
|
+
expected: ["branch abc"]
|
|
91
|
+
}, i;
|
|
92
|
+
}
|
|
93
|
+
if (H === void 0 || !H) {
|
|
94
|
+
let i = /* @__PURE__ */ Error(`Incorrect usage of "merge". Current branch (${state.records.currBranch})has no commits`);
|
|
95
|
+
throw i.hash = {
|
|
96
|
+
text: `merge ${P}`,
|
|
97
|
+
token: `merge ${P}`,
|
|
98
|
+
expected: ["commit"]
|
|
99
|
+
}, i;
|
|
100
|
+
}
|
|
101
|
+
if (!state.records.branches.has(P)) {
|
|
102
|
+
let i = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Branch to be merged (" + P + ") does not exist");
|
|
103
|
+
throw i.hash = {
|
|
104
|
+
text: `merge ${P}`,
|
|
105
|
+
token: `merge ${P}`,
|
|
106
|
+
expected: [`branch ${P}`]
|
|
107
|
+
}, i;
|
|
108
|
+
}
|
|
109
|
+
if (U === void 0 || !U) {
|
|
110
|
+
let i = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Branch to be merged (" + P + ") has no commits");
|
|
111
|
+
throw i.hash = {
|
|
112
|
+
text: `merge ${P}`,
|
|
113
|
+
token: `merge ${P}`,
|
|
114
|
+
expected: ["\"commit\""]
|
|
115
|
+
}, i;
|
|
116
|
+
}
|
|
117
|
+
if (H === U) {
|
|
118
|
+
let i = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Both branches have same head");
|
|
119
|
+
throw i.hash = {
|
|
120
|
+
text: `merge ${P}`,
|
|
121
|
+
token: `merge ${P}`,
|
|
122
|
+
expected: ["branch abc"]
|
|
123
|
+
}, i;
|
|
124
|
+
}
|
|
125
|
+
if (I && state.records.commits.has(I)) {
|
|
126
|
+
let i = /* @__PURE__ */ Error("Incorrect usage of \"merge\". Commit with id:" + I + " already exists, use different custom id");
|
|
127
|
+
throw i.hash = {
|
|
128
|
+
text: `merge ${P} ${I} ${L} ${R?.join(" ")}`,
|
|
129
|
+
token: `merge ${P} ${I} ${L} ${R?.join(" ")}`,
|
|
130
|
+
expected: [`merge ${P} ${I}_UNIQUE ${L} ${R?.join(" ")}`]
|
|
131
|
+
}, i;
|
|
132
|
+
}
|
|
133
|
+
let W = V || "", G = {
|
|
134
|
+
id: I || `${state.records.seq}-${getID()}`,
|
|
135
|
+
message: `merged branch ${P} into ${state.records.currBranch}`,
|
|
136
|
+
seq: state.records.seq++,
|
|
137
|
+
parents: state.records.head == null ? [] : [state.records.head.id, W],
|
|
138
|
+
branch: state.records.currBranch,
|
|
139
|
+
type: commitType.MERGE,
|
|
140
|
+
customType: L,
|
|
141
|
+
customId: !!I,
|
|
142
|
+
tags: R ?? []
|
|
143
|
+
};
|
|
144
|
+
state.records.head = G, state.records.commits.set(G.id, G), state.records.branches.set(state.records.currBranch, G.id), log.debug(state.records.branches), log.debug("in mergeBranch");
|
|
145
|
+
}, "merge"), cherryPick = /* @__PURE__ */ __name(function(i) {
|
|
146
|
+
let P = i.id, I = i.targetId, L = i.tags, R = i.parent;
|
|
147
|
+
log.debug("Entering cherryPick:", P, I, L);
|
|
148
|
+
let z = getConfig3();
|
|
149
|
+
if (P = common_default.sanitizeText(P, z), I = common_default.sanitizeText(I, z), L = L?.map((i) => common_default.sanitizeText(i, z)), R = common_default.sanitizeText(R, z), !P || !state.records.commits.has(P)) {
|
|
150
|
+
let i = /* @__PURE__ */ Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
|
|
151
|
+
throw i.hash = {
|
|
152
|
+
text: `cherryPick ${P} ${I}`,
|
|
153
|
+
token: `cherryPick ${P} ${I}`,
|
|
154
|
+
expected: ["cherry-pick abc"]
|
|
155
|
+
}, i;
|
|
156
|
+
}
|
|
157
|
+
let B = state.records.commits.get(P);
|
|
158
|
+
if (B === void 0 || !B) throw Error("Incorrect usage of \"cherryPick\". Source commit id should exist and provided");
|
|
159
|
+
if (R && !(Array.isArray(B.parents) && B.parents.includes(R))) throw /* @__PURE__ */ Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");
|
|
160
|
+
let V = B.branch;
|
|
161
|
+
if (B.type === commitType.MERGE && !R) throw /* @__PURE__ */ Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");
|
|
162
|
+
if (!I || !state.records.commits.has(I)) {
|
|
163
|
+
if (V === state.records.currBranch) {
|
|
164
|
+
let i = /* @__PURE__ */ Error("Incorrect usage of \"cherryPick\". Source commit is already on current branch");
|
|
165
|
+
throw i.hash = {
|
|
166
|
+
text: `cherryPick ${P} ${I}`,
|
|
167
|
+
token: `cherryPick ${P} ${I}`,
|
|
168
|
+
expected: ["cherry-pick abc"]
|
|
169
|
+
}, i;
|
|
170
|
+
}
|
|
171
|
+
let i = state.records.branches.get(state.records.currBranch);
|
|
172
|
+
if (i === void 0 || !i) {
|
|
173
|
+
let i = /* @__PURE__ */ Error(`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`);
|
|
174
|
+
throw i.hash = {
|
|
175
|
+
text: `cherryPick ${P} ${I}`,
|
|
176
|
+
token: `cherryPick ${P} ${I}`,
|
|
177
|
+
expected: ["cherry-pick abc"]
|
|
178
|
+
}, i;
|
|
179
|
+
}
|
|
180
|
+
let F = state.records.commits.get(i);
|
|
181
|
+
if (F === void 0 || !F) {
|
|
182
|
+
let i = /* @__PURE__ */ Error(`Incorrect usage of "cherry-pick". Current branch (${state.records.currBranch})has no commits`);
|
|
183
|
+
throw i.hash = {
|
|
184
|
+
text: `cherryPick ${P} ${I}`,
|
|
185
|
+
token: `cherryPick ${P} ${I}`,
|
|
186
|
+
expected: ["cherry-pick abc"]
|
|
187
|
+
}, i;
|
|
188
|
+
}
|
|
189
|
+
let z = {
|
|
190
|
+
id: state.records.seq + "-" + getID(),
|
|
191
|
+
message: `cherry-picked ${B?.message} into ${state.records.currBranch}`,
|
|
192
|
+
seq: state.records.seq++,
|
|
193
|
+
parents: state.records.head == null ? [] : [state.records.head.id, B.id],
|
|
194
|
+
branch: state.records.currBranch,
|
|
195
|
+
type: commitType.CHERRY_PICK,
|
|
196
|
+
tags: L ? L.filter(Boolean) : [`cherry-pick:${B.id}${B.type === commitType.MERGE ? `|parent:${R}` : ""}`]
|
|
197
|
+
};
|
|
198
|
+
state.records.head = z, state.records.commits.set(z.id, z), state.records.branches.set(state.records.currBranch, z.id), log.debug(state.records.branches), log.debug("in cherryPick");
|
|
199
|
+
}
|
|
200
|
+
}, "cherryPick"), checkout = /* @__PURE__ */ __name(function(i) {
|
|
201
|
+
if (i = common_default.sanitizeText(i, getConfig3()), state.records.branches.has(i)) {
|
|
202
|
+
state.records.currBranch = i;
|
|
203
|
+
let N = state.records.branches.get(state.records.currBranch);
|
|
204
|
+
N === void 0 || !N ? state.records.head = null : state.records.head = state.records.commits.get(N) ?? null;
|
|
205
|
+
} else {
|
|
206
|
+
let N = /* @__PURE__ */ Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${i}")`);
|
|
207
|
+
throw N.hash = {
|
|
208
|
+
text: `checkout ${i}`,
|
|
209
|
+
token: `checkout ${i}`,
|
|
210
|
+
expected: [`branch ${i}`]
|
|
211
|
+
}, N;
|
|
212
|
+
}
|
|
213
|
+
}, "checkout");
|
|
214
|
+
function upsert(i, N, P) {
|
|
215
|
+
let F = i.indexOf(N);
|
|
216
|
+
F === -1 ? i.push(P) : i.splice(F, 1, P);
|
|
217
|
+
}
|
|
218
|
+
__name(upsert, "upsert");
|
|
219
|
+
function prettyPrintCommitHistory(i) {
|
|
220
|
+
let P = i.reduce((i, N) => i.seq > N.seq ? i : N, i[0]), F = "";
|
|
221
|
+
i.forEach(function(i) {
|
|
222
|
+
i === P ? F += " *" : F += " |";
|
|
223
|
+
});
|
|
224
|
+
let I = [
|
|
225
|
+
F,
|
|
226
|
+
P.id,
|
|
227
|
+
P.seq
|
|
228
|
+
];
|
|
229
|
+
for (let i in state.records.branches) state.records.branches.get(i) === P.id && I.push(i);
|
|
230
|
+
if (log.debug(I.join(" ")), P.parents && P.parents.length == 2 && P.parents[0] && P.parents[1]) {
|
|
231
|
+
let N = state.records.commits.get(P.parents[0]);
|
|
232
|
+
upsert(i, P, N), P.parents[1] && i.push(state.records.commits.get(P.parents[1]));
|
|
233
|
+
} else if (P.parents.length == 0) return;
|
|
234
|
+
else if (P.parents[0]) {
|
|
235
|
+
let N = state.records.commits.get(P.parents[0]);
|
|
236
|
+
upsert(i, P, N);
|
|
237
|
+
}
|
|
238
|
+
i = uniqBy(i, (i) => i.id), prettyPrintCommitHistory(i);
|
|
239
|
+
}
|
|
240
|
+
__name(prettyPrintCommitHistory, "prettyPrintCommitHistory");
|
|
241
|
+
var prettyPrint = /* @__PURE__ */ __name(function() {
|
|
242
|
+
log.debug(state.records.commits);
|
|
243
|
+
let i = getCommitsArray()[0];
|
|
244
|
+
prettyPrintCommitHistory([i]);
|
|
245
|
+
}, "prettyPrint"), clear2 = /* @__PURE__ */ __name(function() {
|
|
246
|
+
state.reset(), clear();
|
|
247
|
+
}, "clear"), getBranchesAsObjArray = /* @__PURE__ */ __name(function() {
|
|
248
|
+
return [...state.records.branchConfig.values()].map((i, N) => i.order !== null && i.order !== void 0 ? i : {
|
|
249
|
+
...i,
|
|
250
|
+
order: parseFloat(`0.${N}`)
|
|
251
|
+
}).sort((i, N) => (i.order ?? 0) - (N.order ?? 0)).map(({ name: i }) => ({ name: i }));
|
|
252
|
+
}, "getBranchesAsObjArray"), getBranches = /* @__PURE__ */ __name(function() {
|
|
253
|
+
return state.records.branches;
|
|
254
|
+
}, "getBranches"), getCommits = /* @__PURE__ */ __name(function() {
|
|
255
|
+
return state.records.commits;
|
|
256
|
+
}, "getCommits"), getCommitsArray = /* @__PURE__ */ __name(function() {
|
|
257
|
+
let i = [...state.records.commits.values()];
|
|
258
|
+
return i.forEach(function(i) {
|
|
259
|
+
log.debug(i.id);
|
|
260
|
+
}), i.sort((i, N) => i.seq - N.seq), i;
|
|
261
|
+
}, "getCommitsArray"), db = {
|
|
262
|
+
commitType,
|
|
263
|
+
getConfig: getConfig3,
|
|
264
|
+
setDirection,
|
|
265
|
+
setOptions,
|
|
266
|
+
getOptions,
|
|
267
|
+
commit,
|
|
268
|
+
branch,
|
|
269
|
+
merge,
|
|
270
|
+
cherryPick,
|
|
271
|
+
checkout,
|
|
272
|
+
prettyPrint,
|
|
273
|
+
clear: clear2,
|
|
274
|
+
getBranchesAsObjArray,
|
|
275
|
+
getBranches,
|
|
276
|
+
getCommits,
|
|
277
|
+
getCommitsArray,
|
|
278
|
+
getCurrentBranch: /* @__PURE__ */ __name(function() {
|
|
279
|
+
return state.records.currBranch;
|
|
280
|
+
}, "getCurrentBranch"),
|
|
281
|
+
getDirection: /* @__PURE__ */ __name(function() {
|
|
282
|
+
return state.records.direction;
|
|
283
|
+
}, "getDirection"),
|
|
284
|
+
getHead: /* @__PURE__ */ __name(function() {
|
|
285
|
+
return state.records.head;
|
|
286
|
+
}, "getHead"),
|
|
287
|
+
setAccTitle,
|
|
288
|
+
getAccTitle,
|
|
289
|
+
getAccDescription,
|
|
290
|
+
setAccDescription,
|
|
291
|
+
setDiagramTitle,
|
|
292
|
+
getDiagramTitle
|
|
293
|
+
}, populate = /* @__PURE__ */ __name((i, N) => {
|
|
294
|
+
populateCommonDb(i, N), i.dir && N.setDirection(i.dir);
|
|
295
|
+
for (let P of i.statements) parseStatement(P, N);
|
|
296
|
+
}, "populate"), parseStatement = /* @__PURE__ */ __name((P, F) => {
|
|
297
|
+
let I = {
|
|
298
|
+
Commit: /* @__PURE__ */ __name((i) => F.commit(parseCommit(i)), "Commit"),
|
|
299
|
+
Branch: /* @__PURE__ */ __name((i) => F.branch(parseBranch(i)), "Branch"),
|
|
300
|
+
Merge: /* @__PURE__ */ __name((i) => F.merge(parseMerge(i)), "Merge"),
|
|
301
|
+
Checkout: /* @__PURE__ */ __name((i) => F.checkout(parseCheckout(i)), "Checkout"),
|
|
302
|
+
CherryPicking: /* @__PURE__ */ __name((i) => F.cherryPick(parseCherryPicking(i)), "CherryPicking")
|
|
303
|
+
}[P.$type];
|
|
304
|
+
I ? I(P) : log.error(`Unknown statement type: ${P.$type}`);
|
|
305
|
+
}, "parseStatement"), parseCommit = /* @__PURE__ */ __name((i) => ({
|
|
306
|
+
id: i.id,
|
|
307
|
+
msg: i.message ?? "",
|
|
308
|
+
type: i.type === void 0 ? commitType.NORMAL : commitType[i.type],
|
|
309
|
+
tags: i.tags ?? void 0
|
|
310
|
+
}), "parseCommit"), parseBranch = /* @__PURE__ */ __name((i) => ({
|
|
311
|
+
name: i.name,
|
|
312
|
+
order: i.order ?? 0
|
|
313
|
+
}), "parseBranch"), parseMerge = /* @__PURE__ */ __name((i) => ({
|
|
314
|
+
branch: i.branch,
|
|
315
|
+
id: i.id ?? "",
|
|
316
|
+
type: i.type === void 0 ? void 0 : commitType[i.type],
|
|
317
|
+
tags: i.tags ?? void 0
|
|
318
|
+
}), "parseMerge"), parseCheckout = /* @__PURE__ */ __name((i) => i.branch, "parseCheckout"), parseCherryPicking = /* @__PURE__ */ __name((i) => ({
|
|
319
|
+
id: i.id,
|
|
320
|
+
targetId: "",
|
|
321
|
+
tags: i.tags?.length === 0 ? void 0 : i.tags,
|
|
322
|
+
parent: i.parent
|
|
323
|
+
}), "parseCherryPicking"), parser = { parse: /* @__PURE__ */ __name(async (i) => {
|
|
324
|
+
let P = await parse("gitGraph", i);
|
|
325
|
+
log.debug(P), populate(P, db);
|
|
326
|
+
}, "parse") }, LAYOUT_OFFSET = 10, COMMIT_STEP = 40, PX = 4, PY = 2, THEME_COLOR_LIMIT = 8, REDUX_GEOMETRY_THEMES = /* @__PURE__ */ new Set([
|
|
327
|
+
"redux",
|
|
328
|
+
"redux-dark",
|
|
329
|
+
"redux-color",
|
|
330
|
+
"redux-dark-color"
|
|
331
|
+
]), REDUX_BRANCH_LABEL_PADDING_Y = 12, COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), DARK_THEMES = /* @__PURE__ */ new Set([
|
|
332
|
+
"dark",
|
|
333
|
+
"redux-dark",
|
|
334
|
+
"redux-dark-color",
|
|
335
|
+
"neo-dark"
|
|
336
|
+
]), calcColorIndex = /* @__PURE__ */ __name((i, N, P = !1) => P && i > 0 ? (i - 1) % (N - 1) + 1 : i % N, "calcColorIndex"), branchPos = /* @__PURE__ */ new Map(), commitPos = /* @__PURE__ */ new Map(), defaultPos = 30, allCommitsDict = /* @__PURE__ */ new Map(), lanes = [], maxPos = 0, dir = "LR", clear3 = /* @__PURE__ */ __name(() => {
|
|
337
|
+
branchPos.clear(), commitPos.clear(), allCommitsDict.clear(), maxPos = 0, lanes = [], dir = "LR";
|
|
338
|
+
}, "clear"), drawText = /* @__PURE__ */ __name((i) => {
|
|
339
|
+
let N = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
340
|
+
return (typeof i == "string" ? i.split(/\\n|\n|<br\s*\/?>/gi) : i).forEach((i) => {
|
|
341
|
+
let P = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
342
|
+
P.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), P.setAttribute("dy", "1em"), P.setAttribute("x", "0"), P.setAttribute("class", "row"), P.textContent = i.trim(), N.appendChild(P);
|
|
343
|
+
}), N;
|
|
344
|
+
}, "drawText"), findClosestParent = /* @__PURE__ */ __name((N) => {
|
|
345
|
+
let P, F, I;
|
|
346
|
+
return dir === "BT" ? (F = /* @__PURE__ */ __name((i, N) => i <= N, "comparisonFunc"), I = Infinity) : (F = /* @__PURE__ */ __name((i, N) => i >= N, "comparisonFunc"), I = 0), N.forEach((i) => {
|
|
347
|
+
let N = dir === "TB" || dir == "BT" ? commitPos.get(i)?.y : commitPos.get(i)?.x;
|
|
348
|
+
N !== void 0 && F(N, I) && (P = i, I = N);
|
|
349
|
+
}), P;
|
|
350
|
+
}, "findClosestParent"), findClosestParentBT = /* @__PURE__ */ __name((i) => {
|
|
351
|
+
let N = "", P = Infinity;
|
|
352
|
+
return i.forEach((i) => {
|
|
353
|
+
let F = commitPos.get(i).y;
|
|
354
|
+
F <= P && (N = i, P = F);
|
|
355
|
+
}), N || void 0;
|
|
356
|
+
}, "findClosestParentBT"), setParallelBTPos = /* @__PURE__ */ __name((i, N, P) => {
|
|
357
|
+
let F = P, I = P, L = [];
|
|
358
|
+
i.forEach((i) => {
|
|
359
|
+
let P = N.get(i);
|
|
360
|
+
if (!P) throw Error(`Commit not found for key ${i}`);
|
|
361
|
+
P.parents.length ? (F = calculateCommitPosition(P), I = Math.max(F, I)) : L.push(P), setCommitPosition(P, F);
|
|
362
|
+
}), F = I, L.forEach((i) => {
|
|
363
|
+
setRootPosition(i, F, P);
|
|
364
|
+
}), i.forEach((i) => {
|
|
365
|
+
let P = N.get(i);
|
|
366
|
+
if (P?.parents.length) {
|
|
367
|
+
let i = findClosestParentBT(P.parents);
|
|
368
|
+
F = commitPos.get(i).y - COMMIT_STEP, F <= I && (I = F);
|
|
369
|
+
let N = branchPos.get(P.branch).pos, L = F - LAYOUT_OFFSET;
|
|
370
|
+
commitPos.set(P.id, {
|
|
371
|
+
x: N,
|
|
372
|
+
y: L
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}, "setParallelBTPos"), findClosestParentPos = /* @__PURE__ */ __name((i) => {
|
|
377
|
+
let N = findClosestParent(i.parents.filter((i) => i !== null));
|
|
378
|
+
if (!N) throw Error(`Closest parent not found for commit ${i.id}`);
|
|
379
|
+
let P = commitPos.get(N)?.y;
|
|
380
|
+
if (P === void 0) throw Error(`Closest parent position not found for commit ${i.id}`);
|
|
381
|
+
return P;
|
|
382
|
+
}, "findClosestParentPos"), calculateCommitPosition = /* @__PURE__ */ __name((i) => findClosestParentPos(i) + COMMIT_STEP, "calculateCommitPosition"), setCommitPosition = /* @__PURE__ */ __name((i, N) => {
|
|
383
|
+
let P = branchPos.get(i.branch);
|
|
384
|
+
if (!P) throw Error(`Branch not found for commit ${i.id}`);
|
|
385
|
+
let F = P.pos, I = N + LAYOUT_OFFSET;
|
|
386
|
+
return commitPos.set(i.id, {
|
|
387
|
+
x: F,
|
|
388
|
+
y: I
|
|
389
|
+
}), {
|
|
390
|
+
x: F,
|
|
391
|
+
y: I
|
|
392
|
+
};
|
|
393
|
+
}, "setCommitPosition"), setRootPosition = /* @__PURE__ */ __name((i, N, P) => {
|
|
394
|
+
let F = branchPos.get(i.branch);
|
|
395
|
+
if (!F) throw Error(`Branch not found for commit ${i.id}`);
|
|
396
|
+
let I = N + P, L = F.pos;
|
|
397
|
+
commitPos.set(i.id, {
|
|
398
|
+
x: L,
|
|
399
|
+
y: I
|
|
400
|
+
});
|
|
401
|
+
}, "setRootPosition"), drawCommitBullet = /* @__PURE__ */ __name((i, N, P, F, I, L) => {
|
|
402
|
+
let { theme: R } = getConfig2(), z = REDUX_GEOMETRY_THEMES.has(R ?? ""), V = COLOR_THEMES.has(R ?? ""), H = DARK_THEMES.has(R ?? "");
|
|
403
|
+
if (L === commitType.HIGHLIGHT) i.append("rect").attr("x", P.x - 10 + (z ? 3 : 0)).attr("y", P.y - 10 + (z ? 3 : 0)).attr("width", z ? 14 : 20).attr("height", z ? 14 : 20).attr("class", `commit ${N.id} commit-highlight${calcColorIndex(I, THEME_COLOR_LIMIT, V)} ${F}-outer`), i.append("rect").attr("x", P.x - 6 + (z ? 2 : 0)).attr("y", P.y - 6 + (z ? 2 : 0)).attr("width", z ? 8 : 12).attr("height", z ? 8 : 12).attr("class", `commit ${N.id} commit${calcColorIndex(I, THEME_COLOR_LIMIT, V)} ${F}-inner`);
|
|
404
|
+
else if (L === commitType.CHERRY_PICK) i.append("circle").attr("cx", P.x).attr("cy", P.y).attr("r", z ? 7 : 10).attr("class", `commit ${N.id} ${F}`), i.append("circle").attr("cx", P.x - 3).attr("cy", P.y + 2).attr("r", z ? 2.5 : 2.75).attr("fill", H ? "#000000" : "#fff").attr("class", `commit ${N.id} ${F}`), i.append("circle").attr("cx", P.x + 3).attr("cy", P.y + 2).attr("r", z ? 2.5 : 2.75).attr("fill", H ? "#000000" : "#fff").attr("class", `commit ${N.id} ${F}`), i.append("line").attr("x1", P.x + 3).attr("y1", P.y + 1).attr("x2", P.x).attr("y2", P.y - 5).attr("stroke", H ? "#000000" : "#fff").attr("class", `commit ${N.id} ${F}`), i.append("line").attr("x1", P.x - 3).attr("y1", P.y + 1).attr("x2", P.x).attr("y2", P.y - 5).attr("stroke", H ? "#000000" : "#fff").attr("class", `commit ${N.id} ${F}`);
|
|
405
|
+
else {
|
|
406
|
+
let R = i.append("circle");
|
|
407
|
+
if (R.attr("cx", P.x), R.attr("cy", P.y), R.attr("r", z ? 7 : 10), R.attr("class", `commit ${N.id} commit${calcColorIndex(I, THEME_COLOR_LIMIT, V)}`), L === commitType.MERGE) {
|
|
408
|
+
let L = i.append("circle");
|
|
409
|
+
L.attr("cx", P.x), L.attr("cy", P.y), L.attr("r", z ? 5 : 6), L.attr("class", `commit ${F} ${N.id} commit${calcColorIndex(I, THEME_COLOR_LIMIT, V)}`);
|
|
410
|
+
}
|
|
411
|
+
if (L === commitType.REVERSE) {
|
|
412
|
+
let L = i.append("path"), R = z ? 4 : 5;
|
|
413
|
+
L.attr("d", `M ${P.x - R},${P.y - R}L${P.x + R},${P.y + R}M${P.x - R},${P.y + R}L${P.x + R},${P.y - R}`).attr("class", `commit ${F} ${N.id} commit${calcColorIndex(I, THEME_COLOR_LIMIT, V)}`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}, "drawCommitBullet"), drawCommitLabel = /* @__PURE__ */ __name((i, N, P, F, I) => {
|
|
417
|
+
if (N.type !== commitType.CHERRY_PICK && (N.customId && N.type === commitType.MERGE || N.type !== commitType.MERGE) && I.showCommitLabel) {
|
|
418
|
+
let L = i.append("g"), R = L.insert("rect").attr("class", "commit-label-bkg"), z = L.append("text").attr("x", F).attr("y", P.y + 25).attr("class", "commit-label").text(N.id), B = z.node()?.getBBox();
|
|
419
|
+
if (B && (R.attr("x", P.posWithOffset - B.width / 2 - PY).attr("y", P.y + 13.5).attr("width", B.width + 2 * PY).attr("height", B.height + 2 * PY), dir === "TB" || dir === "BT" ? (R.attr("x", P.x - (B.width + 4 * PX + 5)).attr("y", P.y - 12), z.attr("x", P.x - (B.width + 4 * PX)).attr("y", P.y + B.height - 12)) : z.attr("x", P.posWithOffset - B.width / 2), I.rotateCommitLabel)) if (dir === "TB" || dir === "BT") z.attr("transform", "rotate(-45, " + P.x + ", " + P.y + ")"), R.attr("transform", "rotate(-45, " + P.x + ", " + P.y + ")");
|
|
420
|
+
else {
|
|
421
|
+
let i = -7.5 - (B.width + 10) / 25 * 9.5, N = 10 + B.width / 25 * 8.5;
|
|
422
|
+
L.attr("transform", "translate(" + i + ", " + N + ") rotate(-45, " + F + ", " + P.y + ")");
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}, "drawCommitLabel"), drawCommitTags = /* @__PURE__ */ __name((i, N, P, F) => {
|
|
426
|
+
if (N.tags.length > 0) {
|
|
427
|
+
let I = 0, L = 0, R = 0, z = [];
|
|
428
|
+
for (let F of N.tags.reverse()) {
|
|
429
|
+
let N = i.insert("polygon"), B = i.append("circle"), V = i.append("text").attr("y", P.y - 16 - I).attr("class", "tag-label").text(F), H = V.node()?.getBBox();
|
|
430
|
+
if (!H) throw Error("Tag bbox not found");
|
|
431
|
+
L = Math.max(L, H.width), R = Math.max(R, H.height), V.attr("x", P.posWithOffset - H.width / 2), z.push({
|
|
432
|
+
tag: V,
|
|
433
|
+
hole: B,
|
|
434
|
+
rect: N,
|
|
435
|
+
yOffset: I
|
|
436
|
+
}), I += 20;
|
|
437
|
+
}
|
|
438
|
+
for (let { tag: i, hole: N, rect: I, yOffset: B } of z) {
|
|
439
|
+
let z = R / 2, V = P.y - 19.2 - B;
|
|
440
|
+
if (I.attr("class", "tag-label-bkg").attr("points", `
|
|
441
|
+
${F - L / 2 - PX / 2},${V + PY}
|
|
442
|
+
${F - L / 2 - PX / 2},${V - PY}
|
|
443
|
+
${P.posWithOffset - L / 2 - PX},${V - z - PY}
|
|
444
|
+
${P.posWithOffset + L / 2 + PX},${V - z - PY}
|
|
445
|
+
${P.posWithOffset + L / 2 + PX},${V + z + PY}
|
|
446
|
+
${P.posWithOffset - L / 2 - PX},${V + z + PY}`), N.attr("cy", V).attr("cx", F - L / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole"), dir === "TB" || dir === "BT") {
|
|
447
|
+
let R = F + B;
|
|
448
|
+
I.attr("class", "tag-label-bkg").attr("points", `
|
|
449
|
+
${P.x},${R + 2}
|
|
450
|
+
${P.x},${R - 2}
|
|
451
|
+
${P.x + LAYOUT_OFFSET},${R - z - 2}
|
|
452
|
+
${P.x + LAYOUT_OFFSET + L + 4},${R - z - 2}
|
|
453
|
+
${P.x + LAYOUT_OFFSET + L + 4},${R + z + 2}
|
|
454
|
+
${P.x + LAYOUT_OFFSET},${R + z + 2}`).attr("transform", "translate(12,12) rotate(45, " + P.x + "," + F + ")"), N.attr("cx", P.x + PX / 2).attr("cy", R).attr("transform", "translate(12,12) rotate(45, " + P.x + "," + F + ")"), i.attr("x", P.x + 5).attr("y", R + 3).attr("transform", "translate(14,14) rotate(45, " + P.x + "," + F + ")");
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}, "drawCommitTags"), getCommitClassType = /* @__PURE__ */ __name((i) => {
|
|
459
|
+
switch (i.customType ?? i.type) {
|
|
460
|
+
case commitType.NORMAL: return "commit-normal";
|
|
461
|
+
case commitType.REVERSE: return "commit-reverse";
|
|
462
|
+
case commitType.HIGHLIGHT: return "commit-highlight";
|
|
463
|
+
case commitType.MERGE: return "commit-merge";
|
|
464
|
+
case commitType.CHERRY_PICK: return "commit-cherry-pick";
|
|
465
|
+
default: return "commit-normal";
|
|
466
|
+
}
|
|
467
|
+
}, "getCommitClassType"), calculatePosition = /* @__PURE__ */ __name((i, N, P, F) => {
|
|
468
|
+
let I = {
|
|
469
|
+
x: 0,
|
|
470
|
+
y: 0
|
|
471
|
+
};
|
|
472
|
+
if (i.parents.length > 0) {
|
|
473
|
+
let P = findClosestParent(i.parents);
|
|
474
|
+
if (P) {
|
|
475
|
+
let L = F.get(P) ?? I;
|
|
476
|
+
return N === "TB" ? L.y + COMMIT_STEP : N === "BT" ? (F.get(i.id) ?? I).y - COMMIT_STEP : L.x + COMMIT_STEP;
|
|
477
|
+
}
|
|
478
|
+
} else if (N === "TB") return defaultPos;
|
|
479
|
+
else if (N === "BT") return (F.get(i.id) ?? I).y - COMMIT_STEP;
|
|
480
|
+
else return 0;
|
|
481
|
+
return 0;
|
|
482
|
+
}, "calculatePosition"), getCommitPosition = /* @__PURE__ */ __name((i, N, P) => {
|
|
483
|
+
let F = dir === "BT" && P ? N : N + LAYOUT_OFFSET, I = branchPos.get(i.branch)?.pos, L = dir === "TB" || dir === "BT" ? branchPos.get(i.branch)?.pos : F;
|
|
484
|
+
if (L === void 0 || I === void 0) throw Error(`Position were undefined for commit ${i.id}`);
|
|
485
|
+
let R = REDUX_GEOMETRY_THEMES.has(getConfig2().theme ?? "");
|
|
486
|
+
return {
|
|
487
|
+
x: L,
|
|
488
|
+
y: dir === "TB" || dir === "BT" ? F : I + (R ? REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : -2),
|
|
489
|
+
posWithOffset: F
|
|
490
|
+
};
|
|
491
|
+
}, "getCommitPosition"), drawCommits = /* @__PURE__ */ __name((N, P, F, I) => {
|
|
492
|
+
let L = N.append("g").attr("class", "commit-bullets"), R = N.append("g").attr("class", "commit-labels"), z = dir === "TB" || dir === "BT" ? defaultPos : 0, B = [...P.keys()], V = I.parallelCommits ?? !1, H = /* @__PURE__ */ __name((i, N) => {
|
|
493
|
+
let F = P.get(i)?.seq, I = P.get(N)?.seq;
|
|
494
|
+
return F !== void 0 && I !== void 0 ? F - I : 0;
|
|
495
|
+
}, "sortKeys"), U = B.sort(H);
|
|
496
|
+
dir === "BT" && (V && setParallelBTPos(U, P, z), U = U.reverse()), U.forEach((i) => {
|
|
497
|
+
let N = P.get(i);
|
|
498
|
+
if (!N) throw Error(`Commit not found for key ${i}`);
|
|
499
|
+
V && (z = calculatePosition(N, dir, z, commitPos));
|
|
500
|
+
let B = getCommitPosition(N, z, V);
|
|
501
|
+
if (F) {
|
|
502
|
+
let i = getCommitClassType(N), P = N.customType ?? N.type;
|
|
503
|
+
drawCommitBullet(L, N, B, i, branchPos.get(N.branch)?.index ?? 0, P), drawCommitLabel(R, N, B, z, I), drawCommitTags(R, N, B, z);
|
|
504
|
+
}
|
|
505
|
+
dir === "TB" || dir === "BT" ? commitPos.set(N.id, {
|
|
506
|
+
x: B.x,
|
|
507
|
+
y: B.posWithOffset
|
|
508
|
+
}) : commitPos.set(N.id, {
|
|
509
|
+
x: B.posWithOffset,
|
|
510
|
+
y: B.y
|
|
511
|
+
}), z = dir === "BT" && V ? z + COMMIT_STEP : z + COMMIT_STEP + LAYOUT_OFFSET, z > maxPos && (maxPos = z);
|
|
512
|
+
});
|
|
513
|
+
}, "drawCommits"), shouldRerouteArrow = /* @__PURE__ */ __name((N, P, F, I, L) => {
|
|
514
|
+
let R = (dir === "TB" || dir === "BT" ? F.x < I.x : F.y < I.y) ? P.branch : N.branch, z = /* @__PURE__ */ __name((i) => i.branch === R, "isOnBranchToGetCurve"), B = /* @__PURE__ */ __name((i) => i.seq > N.seq && i.seq < P.seq, "isBetweenCommits");
|
|
515
|
+
return [...L.values()].some((i) => B(i) && z(i));
|
|
516
|
+
}, "shouldRerouteArrow"), findLane = /* @__PURE__ */ __name((i, N, P = 0) => {
|
|
517
|
+
let F = i + Math.abs(i - N) / 2;
|
|
518
|
+
return P > 5 ? F : lanes.every((i) => Math.abs(i - F) >= 10) ? (lanes.push(F), F) : findLane(i, N - Math.abs(i - N) / 5, P + 1);
|
|
519
|
+
}, "findLane"), drawArrow = /* @__PURE__ */ __name((i, N, P, F) => {
|
|
520
|
+
let { theme: I } = getConfig2(), L = COLOR_THEMES.has(I ?? ""), R = commitPos.get(N.id), z = commitPos.get(P.id);
|
|
521
|
+
if (R === void 0 || z === void 0) throw Error(`Commit positions not found for commits ${N.id} and ${P.id}`);
|
|
522
|
+
let V = shouldRerouteArrow(N, P, R, z, F), H = "", U = "", W = 0, G = 0, K = branchPos.get(P.branch)?.index;
|
|
523
|
+
P.type === commitType.MERGE && N.id !== P.parents[0] && (K = branchPos.get(N.branch)?.index);
|
|
524
|
+
let q;
|
|
525
|
+
if (V) {
|
|
526
|
+
H = "A 10 10, 0, 0, 0,", U = "A 10 10, 0, 0, 1,", W = 10, G = 10;
|
|
527
|
+
let i = R.y < z.y ? findLane(R.y, z.y) : findLane(z.y, R.y), P = R.x < z.x ? findLane(R.x, z.x) : findLane(z.x, R.x);
|
|
528
|
+
dir === "TB" ? R.x < z.x ? q = `M ${R.x} ${R.y} L ${P - W} ${R.y} ${U} ${P} ${R.y + G} L ${P} ${z.y - W} ${H} ${P + G} ${z.y} L ${z.x} ${z.y}` : (K = branchPos.get(N.branch)?.index, q = `M ${R.x} ${R.y} L ${P + W} ${R.y} ${H} ${P} ${R.y + G} L ${P} ${z.y - W} ${U} ${P - G} ${z.y} L ${z.x} ${z.y}`) : dir === "BT" ? R.x < z.x ? q = `M ${R.x} ${R.y} L ${P - W} ${R.y} ${H} ${P} ${R.y - G} L ${P} ${z.y + W} ${U} ${P + G} ${z.y} L ${z.x} ${z.y}` : (K = branchPos.get(N.branch)?.index, q = `M ${R.x} ${R.y} L ${P + W} ${R.y} ${U} ${P} ${R.y - G} L ${P} ${z.y + W} ${H} ${P - G} ${z.y} L ${z.x} ${z.y}`) : R.y < z.y ? q = `M ${R.x} ${R.y} L ${R.x} ${i - W} ${H} ${R.x + G} ${i} L ${z.x - W} ${i} ${U} ${z.x} ${i + G} L ${z.x} ${z.y}` : (K = branchPos.get(N.branch)?.index, q = `M ${R.x} ${R.y} L ${R.x} ${i + W} ${U} ${R.x + G} ${i} L ${z.x - W} ${i} ${H} ${z.x} ${i - G} L ${z.x} ${z.y}`);
|
|
529
|
+
} else H = "A 20 20, 0, 0, 0,", U = "A 20 20, 0, 0, 1,", W = 20, G = 20, dir === "TB" ? (R.x < z.x && (q = P.type === commitType.MERGE && N.id !== P.parents[0] ? `M ${R.x} ${R.y} L ${R.x} ${z.y - W} ${H} ${R.x + G} ${z.y} L ${z.x} ${z.y}` : `M ${R.x} ${R.y} L ${z.x - W} ${R.y} ${U} ${z.x} ${R.y + G} L ${z.x} ${z.y}`), R.x > z.x && (H = "A 20 20, 0, 0, 0,", U = "A 20 20, 0, 0, 1,", W = 20, G = 20, q = P.type === commitType.MERGE && N.id !== P.parents[0] ? `M ${R.x} ${R.y} L ${R.x} ${z.y - W} ${U} ${R.x - G} ${z.y} L ${z.x} ${z.y}` : `M ${R.x} ${R.y} L ${z.x + W} ${R.y} ${H} ${z.x} ${R.y + G} L ${z.x} ${z.y}`), R.x === z.x && (q = `M ${R.x} ${R.y} L ${z.x} ${z.y}`)) : dir === "BT" ? (R.x < z.x && (q = P.type === commitType.MERGE && N.id !== P.parents[0] ? `M ${R.x} ${R.y} L ${R.x} ${z.y + W} ${U} ${R.x + G} ${z.y} L ${z.x} ${z.y}` : `M ${R.x} ${R.y} L ${z.x - W} ${R.y} ${H} ${z.x} ${R.y - G} L ${z.x} ${z.y}`), R.x > z.x && (H = "A 20 20, 0, 0, 0,", U = "A 20 20, 0, 0, 1,", W = 20, G = 20, q = P.type === commitType.MERGE && N.id !== P.parents[0] ? `M ${R.x} ${R.y} L ${R.x} ${z.y + W} ${H} ${R.x - G} ${z.y} L ${z.x} ${z.y}` : `M ${R.x} ${R.y} L ${z.x + W} ${R.y} ${U} ${z.x} ${R.y - G} L ${z.x} ${z.y}`), R.x === z.x && (q = `M ${R.x} ${R.y} L ${z.x} ${z.y}`)) : (R.y < z.y && (q = P.type === commitType.MERGE && N.id !== P.parents[0] ? `M ${R.x} ${R.y} L ${z.x - W} ${R.y} ${U} ${z.x} ${R.y + G} L ${z.x} ${z.y}` : `M ${R.x} ${R.y} L ${R.x} ${z.y - W} ${H} ${R.x + G} ${z.y} L ${z.x} ${z.y}`), R.y > z.y && (q = P.type === commitType.MERGE && N.id !== P.parents[0] ? `M ${R.x} ${R.y} L ${z.x - W} ${R.y} ${H} ${z.x} ${R.y - G} L ${z.x} ${z.y}` : `M ${R.x} ${R.y} L ${R.x} ${z.y + W} ${U} ${R.x + G} ${z.y} L ${z.x} ${z.y}`), R.y === z.y && (q = `M ${R.x} ${R.y} L ${z.x} ${z.y}`));
|
|
530
|
+
if (q === void 0) throw Error("Line definition not found");
|
|
531
|
+
i.append("path").attr("d", q).attr("class", "arrow arrow" + calcColorIndex(K, THEME_COLOR_LIMIT, L));
|
|
532
|
+
}, "drawArrow"), drawArrows = /* @__PURE__ */ __name((i, N) => {
|
|
533
|
+
let P = i.append("g").attr("class", "commit-arrows");
|
|
534
|
+
[...N.keys()].forEach((i) => {
|
|
535
|
+
let F = N.get(i);
|
|
536
|
+
F.parents && F.parents.length > 0 && F.parents.forEach((i) => {
|
|
537
|
+
drawArrow(P, N.get(i), F, N);
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
}, "drawArrows"), drawBranches = /* @__PURE__ */ __name((i, N, P, F) => {
|
|
541
|
+
let { look: I, theme: L, themeVariables: R } = getConfig2(), { dropShadow: z, THEME_COLOR_LIMIT: V } = R, H = REDUX_GEOMETRY_THEMES.has(L ?? ""), U = COLOR_THEMES.has(L ?? ""), W = i.append("g");
|
|
542
|
+
N.forEach((i, N) => {
|
|
543
|
+
let L = calcColorIndex(N, H ? V : THEME_COLOR_LIMIT, U), R = branchPos.get(i.name)?.pos;
|
|
544
|
+
if (R === void 0) throw Error(`Position not found for branch ${i.name}`);
|
|
545
|
+
let B = dir === "TB" || dir === "BT" ? R : H ? R + REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : R - 2, G = W.append("line");
|
|
546
|
+
G.attr("x1", 0), G.attr("y1", B), G.attr("x2", maxPos), G.attr("y2", B), G.attr("class", "branch branch" + L), dir === "TB" ? (G.attr("y1", defaultPos), G.attr("x1", R), G.attr("y2", maxPos), G.attr("x2", R)) : dir === "BT" && (G.attr("y1", maxPos), G.attr("x1", R), G.attr("y2", defaultPos), G.attr("x2", R)), lanes.push(B);
|
|
547
|
+
let K = i.name, q = drawText(K), J = W.insert("rect"), Y = W.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + L);
|
|
548
|
+
Y.node().appendChild(q);
|
|
549
|
+
let X = q.getBBox(), Z = H ? 0 : 4, Q = H ? 16 : 0, $ = H ? REDUX_BRANCH_LABEL_PADDING_Y : 0;
|
|
550
|
+
I === "neo" && J.attr("data-look", "neo"), J.attr("class", "branchLabelBkg label" + L).attr("style", I === "neo" ? `filter:${H ? `url(#${F}-drop-shadow)` : z}` : "").attr("rx", Z).attr("ry", Z).attr("x", -X.width - 4 - (P.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -X.height / 2 + 10).attr("width", X.width + 18 + Q).attr("height", X.height + 4 + $), Y.attr("transform", "translate(" + (-X.width - 14 - (P.rotateCommitLabel === !0 ? 30 : 0) + Q / 2) + ", " + (B - X.height / 2 - 2) + ")"), dir === "TB" ? (J.attr("x", R - X.width / 2 - 10).attr("y", 0), Y.attr("transform", "translate(" + (R - X.width / 2 - 5) + ", 0)"), H && (J.attr("transform", `translate(${-Q / 2 - 3}, ${-$ - 10})`), Y.attr("transform", "translate(" + (R - X.width / 2 - 5) + ", " + (-$ * 2 + 7) + ")"))) : dir === "BT" ? (J.attr("x", R - X.width / 2 - 10).attr("y", maxPos), Y.attr("transform", "translate(" + (R - X.width / 2 - 5) + ", " + maxPos + ")"), H && (J.attr("transform", `translate(${-Q / 2 - 3}, ${$ + 10})`), Y.attr("transform", "translate(" + (R - X.width / 2 - 5) + ", " + (maxPos + $ * 2 + 4) + ")"))) : J.attr("transform", "translate(-19, " + (B - 12 - $ / 2) + ")");
|
|
551
|
+
});
|
|
552
|
+
}, "drawBranches"), setBranchPosition = /* @__PURE__ */ __name(function(i, N, P, F, I) {
|
|
553
|
+
return branchPos.set(i, {
|
|
554
|
+
pos: N,
|
|
555
|
+
index: P
|
|
556
|
+
}), N += 50 + (I ? 40 : 0) + (dir === "TB" || dir === "BT" ? F.width / 2 : 0), N;
|
|
557
|
+
}, "setBranchPosition"), gitGraphRenderer_default = { draw: /* @__PURE__ */ __name(function(i, P, F, I) {
|
|
558
|
+
clear3(), log.debug("in gitgraph renderer", i + "\n", "id:", P, F);
|
|
559
|
+
let L = I.db;
|
|
560
|
+
if (!L.getConfig) {
|
|
561
|
+
log.error("getConfig method is not available on db");
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
let R = L.getConfig(), z = R.rotateCommitLabel ?? !1;
|
|
565
|
+
allCommitsDict = L.getCommits();
|
|
566
|
+
let V = L.getBranchesAsObjArray();
|
|
567
|
+
dir = L.getDirection();
|
|
568
|
+
let H = select_default(`[id="${P}"]`), { look: U, theme: W, themeVariables: q } = getConfig2(), { useGradient: J, gradientStart: X, gradientStop: Z, filterColor: Q } = q;
|
|
569
|
+
if (J) {
|
|
570
|
+
let i = H.append("defs").append("linearGradient").attr("id", P + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
|
|
571
|
+
i.append("stop").attr("offset", "0%").attr("stop-color", X).attr("stop-opacity", 1), i.append("stop").attr("offset", "100%").attr("stop-color", Z).attr("stop-opacity", 1);
|
|
572
|
+
}
|
|
573
|
+
U === "neo" && REDUX_GEOMETRY_THEMES.has(W ?? "") && H.append("defs").append("filter").attr("id", P + "-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", Q);
|
|
574
|
+
let $ = 0;
|
|
575
|
+
V.forEach((i, N) => {
|
|
576
|
+
let P = drawText(i.name), F = H.append("g"), I = F.insert("g").attr("class", "branchLabel"), L = I.insert("g").attr("class", "label branch-label");
|
|
577
|
+
L.node()?.appendChild(P);
|
|
578
|
+
let R = P.getBBox();
|
|
579
|
+
$ = setBranchPosition(i.name, $, N, R, z), L.remove(), I.remove(), F.remove();
|
|
580
|
+
}), drawCommits(H, allCommitsDict, !1, R), R.showBranches && drawBranches(H, V, R, P), drawArrows(H, allCommitsDict), drawCommits(H, allCommitsDict, !0, R), utils_default.insertTitle(H, "gitTitleText", R.titleTopMargin ?? 0, L.getDiagramTitle()), setupGraphViewbox2(void 0, H, R.diagramPadding, R.useMaxWidth);
|
|
581
|
+
}, "draw") }, GIT_NAMED_COLOR_COUNT = 8, REDUX_GEOMETRY_THEMES2 = /* @__PURE__ */ new Set([
|
|
582
|
+
"redux",
|
|
583
|
+
"redux-dark",
|
|
584
|
+
"redux-color",
|
|
585
|
+
"redux-dark-color"
|
|
586
|
+
]), COLOR_THEMES2 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), NEO_THEMES = /* @__PURE__ */ new Set(["neo", "neo-dark"]), DARK_THEMES2 = /* @__PURE__ */ new Set([
|
|
587
|
+
"dark",
|
|
588
|
+
"redux-dark",
|
|
589
|
+
"redux-dark-color",
|
|
590
|
+
"neo-dark"
|
|
591
|
+
]), NEO_COLOR_GEN_THEMES = /* @__PURE__ */ new Set([
|
|
592
|
+
"redux",
|
|
593
|
+
"redux-dark",
|
|
594
|
+
"redux-color",
|
|
595
|
+
"redux-dark-color",
|
|
596
|
+
"neo",
|
|
597
|
+
"neo-dark"
|
|
598
|
+
]), genGitGraphGradient = /* @__PURE__ */ __name((i) => {
|
|
599
|
+
let { svgId: N } = i, P = "";
|
|
600
|
+
if (i.useGradient && N) for (let F = 0; F < i.THEME_COLOR_LIMIT; F++) P += `
|
|
601
|
+
.label${F} { fill: ${i.mainBkg}; stroke: url(${N}-gradient); stroke-width: ${i.strokeWidth};}
|
|
602
|
+
`;
|
|
603
|
+
return P;
|
|
604
|
+
}, "genGitGraphGradient"), genColor = /* @__PURE__ */ __name((i) => {
|
|
605
|
+
let { theme: N, themeVariables: P } = getConfig(), { borderColorArray: F } = P, I = REDUX_GEOMETRY_THEMES2.has(N);
|
|
606
|
+
if (NEO_THEMES.has(N)) {
|
|
607
|
+
let N = "";
|
|
608
|
+
for (let P = 0; P < i.THEME_COLOR_LIMIT; P++) if (P === 0) N += `
|
|
609
|
+
.branch-label${P} { fill: ${i.nodeBorder};}
|
|
610
|
+
.commit${P} { stroke: ${i.nodeBorder}; }
|
|
611
|
+
.commit-highlight${P} { stroke: ${i.nodeBorder}; fill: ${i.nodeBorder}; }
|
|
612
|
+
.arrow${P} { stroke: ${i.nodeBorder}; }
|
|
613
|
+
.commit-bullets { fill: ${i.nodeBorder}; }
|
|
614
|
+
.commit-cherry-pick${P} { stroke: ${i.nodeBorder}; }
|
|
615
|
+
${genGitGraphGradient(i)}`;
|
|
616
|
+
else {
|
|
617
|
+
let F = P % GIT_NAMED_COLOR_COUNT;
|
|
618
|
+
N += `
|
|
619
|
+
.branch-label${P} { fill: ${i["gitBranchLabel" + F]}; }
|
|
620
|
+
.commit${P} { stroke: ${i["git" + F]}; fill: ${i["git" + F]}; }
|
|
621
|
+
.commit-highlight${P} { stroke: ${i["gitInv" + F]}; fill: ${i["gitInv" + F]}; }
|
|
622
|
+
.arrow${P} { stroke: ${i["git" + F]}; }
|
|
623
|
+
`;
|
|
624
|
+
}
|
|
625
|
+
return N;
|
|
626
|
+
} else if (COLOR_THEMES2.has(N)) {
|
|
627
|
+
let P = "";
|
|
628
|
+
for (let L = 0; L < i.THEME_COLOR_LIMIT; L++) if (L === 0) P += `
|
|
629
|
+
.branch-label${L} { fill: ${i.nodeBorder}; ${I ? `font-weight:${i.noteFontWeight}` : ""} }
|
|
630
|
+
.commit${L} { stroke: ${i.nodeBorder}; }
|
|
631
|
+
.commit-highlight${L} { stroke: ${i.nodeBorder}; fill: ${i.mainBkg}; }
|
|
632
|
+
.label${L} { fill: ${i.mainBkg}; stroke: ${i.nodeBorder}; stroke-width: ${i.strokeWidth}; ${I ? `font-weight:${i.noteFontWeight}` : ""} }
|
|
633
|
+
.arrow${L} { stroke: ${i.nodeBorder}; }
|
|
634
|
+
.commit-bullets { fill: ${i.nodeBorder}; }
|
|
635
|
+
`;
|
|
636
|
+
else {
|
|
637
|
+
let R = L % F.length;
|
|
638
|
+
P += `
|
|
639
|
+
.branch-label${L} { fill: ${i.nodeBorder}; ${I ? `font-weight:${i.noteFontWeight}` : ""} }
|
|
640
|
+
.commit${L} { stroke: ${F[R]}; fill: ${F[R]}; }
|
|
641
|
+
.commit-highlight${L} { stroke: ${F[R]}; fill: ${F[R]}; }
|
|
642
|
+
.label${L} { fill: ${DARK_THEMES2.has(N) ? i.mainBkg : F[R]}; stroke: ${F[R]}; stroke-width: ${i.strokeWidth}; }
|
|
643
|
+
.arrow${L} { stroke: ${F[R]}; }
|
|
644
|
+
`;
|
|
645
|
+
}
|
|
646
|
+
return P;
|
|
647
|
+
} else {
|
|
648
|
+
let N = "";
|
|
649
|
+
for (let P = 0; P < i.THEME_COLOR_LIMIT; P++) N += `
|
|
650
|
+
.branch-label${P} { fill: ${i.nodeBorder}; ${I ? `font-weight:${i.noteFontWeight}` : ""} }
|
|
651
|
+
.commit${P} { stroke: ${i.nodeBorder}; }
|
|
652
|
+
.commit-highlight${P} { stroke: ${i.nodeBorder}; fill: ${i.nodeBorder}; }
|
|
653
|
+
.label${P} { fill: ${i.mainBkg}; stroke: ${i.nodeBorder}; stroke-width: ${i.strokeWidth}; ${I ? `font-weight:${i.noteFontWeight}` : ""}}
|
|
654
|
+
.arrow${P} { stroke: ${i.nodeBorder}; }
|
|
655
|
+
.commit-bullets { fill: ${i.nodeBorder}; }
|
|
656
|
+
.commit-cherry-pick${P} { stroke: ${i.nodeBorder}; }
|
|
657
|
+
`;
|
|
658
|
+
return N;
|
|
659
|
+
}
|
|
660
|
+
}, "genColor"), normalTheme = /* @__PURE__ */ __name((i) => `${Array.from({ length: i.THEME_COLOR_LIMIT }, (i, N) => N).map((N) => {
|
|
661
|
+
let P = N % GIT_NAMED_COLOR_COUNT;
|
|
662
|
+
return `
|
|
663
|
+
.branch-label${N} { fill: ${i["gitBranchLabel" + P]}; }
|
|
664
|
+
.commit${N} { stroke: ${i["git" + P]}; fill: ${i["git" + P]}; }
|
|
665
|
+
.commit-highlight${N} { stroke: ${i["gitInv" + P]}; fill: ${i["gitInv" + P]}; }
|
|
666
|
+
.label${N} { fill: ${i["git" + P]}; }
|
|
667
|
+
.arrow${N} { stroke: ${i["git" + P]}; }
|
|
668
|
+
`;
|
|
669
|
+
}).join("\n")}`, "normalTheme"), diagram = {
|
|
670
|
+
parser,
|
|
671
|
+
db,
|
|
672
|
+
renderer: gitGraphRenderer_default,
|
|
673
|
+
styles: /* @__PURE__ */ __name((i) => {
|
|
674
|
+
let { theme: N } = getConfig(), P = NEO_COLOR_GEN_THEMES.has(N);
|
|
675
|
+
return `
|
|
676
|
+
.commit-id,
|
|
677
|
+
.commit-msg,
|
|
678
|
+
.branch-label {
|
|
679
|
+
fill: lightgrey;
|
|
680
|
+
color: lightgrey;
|
|
681
|
+
font-family: 'trebuchet ms', verdana, arial, sans-serif;
|
|
682
|
+
font-family: var(--mermaid-font-family);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
${P ? genColor(i) : normalTheme(i)}
|
|
686
|
+
|
|
687
|
+
.branch {
|
|
688
|
+
stroke-width: ${i.strokeWidth};
|
|
689
|
+
stroke: ${i.commitLineColor ?? i.lineColor};
|
|
690
|
+
stroke-dasharray: ${P ? "4 2" : "2"};
|
|
691
|
+
}
|
|
692
|
+
.commit-label { font-size: ${i.commitLabelFontSize}; fill: ${P ? i.nodeBorder : i.commitLabelColor}; ${P ? `font-weight:${i.noteFontWeight};` : ""}}
|
|
693
|
+
.commit-label-bkg { font-size: ${i.commitLabelFontSize}; fill: ${P ? "transparent" : i.commitLabelBackground}; opacity: ${P ? "" : .5}; }
|
|
694
|
+
.tag-label { font-size: ${i.tagLabelFontSize}; fill: ${i.tagLabelColor};}
|
|
695
|
+
.tag-label-bkg { fill: ${P ? i.mainBkg : i.tagLabelBackground}; stroke: ${P ? i.nodeBorder : i.tagLabelBorder}; ${P ? `filter:${i.dropShadow}` : ""} }
|
|
696
|
+
.tag-hole { fill: ${i.textColor}; }
|
|
697
|
+
|
|
698
|
+
.commit-merge {
|
|
699
|
+
stroke: ${P ? i.mainBkg : i.primaryColor};
|
|
700
|
+
fill: ${P ? i.mainBkg : i.primaryColor};
|
|
701
|
+
}
|
|
702
|
+
.commit-reverse {
|
|
703
|
+
stroke: ${P ? i.mainBkg : i.primaryColor};
|
|
704
|
+
fill: ${P ? i.mainBkg : i.primaryColor};
|
|
705
|
+
stroke-width: ${P ? i.strokeWidth : 3};
|
|
706
|
+
}
|
|
707
|
+
.commit-highlight-outer {
|
|
708
|
+
}
|
|
709
|
+
.commit-highlight-inner {
|
|
710
|
+
stroke: ${P ? i.mainBkg : i.primaryColor};
|
|
711
|
+
fill: ${P ? i.mainBkg : i.primaryColor};
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
.arrow {
|
|
715
|
+
/* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
|
|
716
|
+
stroke-width: ${REDUX_GEOMETRY_THEMES2.has(N) ? i.strokeWidth : 8};
|
|
717
|
+
stroke-linecap: round;
|
|
718
|
+
fill: none
|
|
719
|
+
}
|
|
720
|
+
.gitTitleText {
|
|
721
|
+
text-anchor: middle;
|
|
722
|
+
font-size: 18px;
|
|
723
|
+
fill: ${i.textColor};
|
|
724
|
+
}
|
|
725
|
+
`;
|
|
726
|
+
}, "getStyles")
|
|
727
|
+
};
|
|
728
|
+
export { diagram };
|