schematex 0.3.0 → 0.3.3
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/ai/ai-sdk.cjs +25 -25
- package/dist/ai/ai-sdk.d.cts +1 -1
- package/dist/ai/ai-sdk.d.ts +1 -1
- package/dist/ai/ai-sdk.js +20 -20
- package/dist/ai/index.cjs +28 -28
- package/dist/ai/index.d.cts +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +20 -20
- package/dist/browser.cjs +22 -22
- package/dist/browser.js +20 -20
- package/dist/{chunk-HDKDQAEQ.cjs → chunk-3WNW5Y7P.cjs} +54 -2
- package/dist/chunk-3WNW5Y7P.cjs.map +1 -0
- package/dist/{chunk-B6INLQBU.cjs → chunk-55UEHL57.cjs} +46 -46
- package/dist/{chunk-B6INLQBU.cjs.map → chunk-55UEHL57.cjs.map} +1 -1
- package/dist/{chunk-JDTB7IKL.js → chunk-5U2W3HQA.js} +3 -3
- package/dist/{chunk-JDTB7IKL.js.map → chunk-5U2W3HQA.js.map} +1 -1
- package/dist/{chunk-ULYRO2KY.cjs → chunk-5UCXMYE7.cjs} +44 -44
- package/dist/{chunk-ULYRO2KY.cjs.map → chunk-5UCXMYE7.cjs.map} +1 -1
- package/dist/{chunk-UGCUNADI.js → chunk-66XQBGX7.js} +35 -16
- package/dist/chunk-66XQBGX7.js.map +1 -0
- package/dist/{chunk-45KP67RR.js → chunk-6TIN33CA.js} +5 -5
- package/dist/chunk-6TIN33CA.js.map +1 -0
- package/dist/{chunk-NNU4RGT3.js → chunk-6YUP3QMA.js} +39 -27
- package/dist/chunk-6YUP3QMA.js.map +1 -0
- package/dist/{chunk-COLTVQWR.cjs → chunk-7EWFVNYD.cjs} +25 -25
- package/dist/{chunk-COLTVQWR.cjs.map → chunk-7EWFVNYD.cjs.map} +1 -1
- package/dist/{chunk-RP5UATRA.js → chunk-AC3XH3LB.js} +4 -4
- package/dist/{chunk-RP5UATRA.js.map → chunk-AC3XH3LB.js.map} +1 -1
- package/dist/{chunk-XTATRNUN.cjs → chunk-APV4AWQ5.cjs} +442 -430
- package/dist/chunk-APV4AWQ5.cjs.map +1 -0
- package/dist/{chunk-NZH4GWE6.cjs → chunk-AVIKQZSX.cjs} +37 -37
- package/dist/{chunk-NZH4GWE6.cjs.map → chunk-AVIKQZSX.cjs.map} +1 -1
- package/dist/{chunk-X7RPFTTR.cjs → chunk-CWZKP3CJ.cjs} +26 -26
- package/dist/{chunk-X7RPFTTR.cjs.map → chunk-CWZKP3CJ.cjs.map} +1 -1
- package/dist/{chunk-TYCHEOQX.js → chunk-FIVUMDLF.js} +49 -24
- package/dist/chunk-FIVUMDLF.js.map +1 -0
- package/dist/{chunk-DNZFOCV7.js → chunk-FO7BLCEW.js} +3 -3
- package/dist/{chunk-DNZFOCV7.js.map → chunk-FO7BLCEW.js.map} +1 -1
- package/dist/{chunk-OC22GGQN.js → chunk-GLFBHQSQ.js} +54 -4
- package/dist/chunk-GLFBHQSQ.js.map +1 -0
- package/dist/{chunk-XZNPAD6E.js → chunk-GVCPFBAV.js} +59 -8
- package/dist/chunk-GVCPFBAV.js.map +1 -0
- package/dist/{chunk-B37IKTI7.cjs → chunk-HOI6QKC6.cjs} +97 -47
- package/dist/chunk-HOI6QKC6.cjs.map +1 -0
- package/dist/{chunk-A5D2IMOX.cjs → chunk-IAEABLIV.cjs} +47 -47
- package/dist/{chunk-A5D2IMOX.cjs.map → chunk-IAEABLIV.cjs.map} +1 -1
- package/dist/{chunk-5YYAYW67.js → chunk-IQRRZPVZ.js} +3 -3
- package/dist/{chunk-5YYAYW67.js.map → chunk-IQRRZPVZ.js.map} +1 -1
- package/dist/{chunk-VLMK7MQK.js → chunk-MNOO7STY.js} +25 -6
- package/dist/chunk-MNOO7STY.js.map +1 -0
- package/dist/{chunk-ZNOD4VZT.cjs → chunk-N56YC75X.cjs} +46 -46
- package/dist/{chunk-ZNOD4VZT.cjs.map → chunk-N56YC75X.cjs.map} +1 -1
- package/dist/{chunk-YQANC7HQ.js → chunk-PAG3BNIV.js} +3 -3
- package/dist/{chunk-YQANC7HQ.js.map → chunk-PAG3BNIV.js.map} +1 -1
- package/dist/{chunk-QSQX77S2.cjs → chunk-PG6TDGKI.cjs} +21 -21
- package/dist/{chunk-QSQX77S2.cjs.map → chunk-PG6TDGKI.cjs.map} +1 -1
- package/dist/{chunk-WYFXOXVK.cjs → chunk-Q5OFA4I2.cjs} +35 -35
- package/dist/{chunk-WYFXOXVK.cjs.map → chunk-Q5OFA4I2.cjs.map} +1 -1
- package/dist/{chunk-MJGDP3CS.cjs → chunk-QOLBWCF5.cjs} +488 -109
- package/dist/chunk-QOLBWCF5.cjs.map +1 -0
- package/dist/{chunk-MCFQAUQV.cjs → chunk-QXL7AY2H.cjs} +58 -39
- package/dist/chunk-QXL7AY2H.cjs.map +1 -0
- package/dist/chunk-SYYBKDL7.js +122 -0
- package/dist/chunk-SYYBKDL7.js.map +1 -0
- package/dist/{chunk-H2OEUBPO.js → chunk-TQU44E46.js} +441 -62
- package/dist/chunk-TQU44E46.js.map +1 -0
- package/dist/{chunk-FCGHV6ZK.js → chunk-U3KRKXF7.js} +4 -4
- package/dist/{chunk-FCGHV6ZK.js.map → chunk-U3KRKXF7.js.map} +1 -1
- package/dist/{chunk-3YZ6FPQW.cjs → chunk-UDGU73RL.cjs} +131 -131
- package/dist/{chunk-3YZ6FPQW.cjs.map → chunk-UDGU73RL.cjs.map} +1 -1
- package/dist/{chunk-U6L3FAML.js → chunk-UDJ2KN2A.js} +3 -3
- package/dist/{chunk-U6L3FAML.js.map → chunk-UDJ2KN2A.js.map} +1 -1
- package/dist/{chunk-FE6GAUNW.js → chunk-UT4TIDAA.js} +5 -5
- package/dist/{chunk-FE6GAUNW.js.map → chunk-UT4TIDAA.js.map} +1 -1
- package/dist/{chunk-SQKLKBBK.cjs → chunk-UWRTV6IV.cjs} +27 -8
- package/dist/chunk-UWRTV6IV.cjs.map +1 -0
- package/dist/{chunk-NB56L5QK.js → chunk-WTF6JXHN.js} +4 -4
- package/dist/{chunk-NB56L5QK.js.map → chunk-WTF6JXHN.js.map} +1 -1
- package/dist/{chunk-ZNDIGQJD.js → chunk-X5QJO4ZD.js} +3 -3
- package/dist/{chunk-ZNDIGQJD.js.map → chunk-X5QJO4ZD.js.map} +1 -1
- package/dist/{chunk-M5B2UUNW.js → chunk-XV2DTN6G.js} +4 -4
- package/dist/{chunk-M5B2UUNW.js.map → chunk-XV2DTN6G.js.map} +1 -1
- package/dist/{chunk-K2SOC3XF.cjs → chunk-YUPG2M3I.cjs} +71 -20
- package/dist/chunk-YUPG2M3I.cjs.map +1 -0
- package/dist/{chunk-2JDVJRR3.cjs → chunk-ZCW7YH3C.cjs} +28 -28
- package/dist/chunk-ZCW7YH3C.cjs.map +1 -0
- package/dist/{chunk-3FKS4KQK.cjs → chunk-ZFNZ2FYI.cjs} +88 -63
- package/dist/chunk-ZFNZ2FYI.cjs.map +1 -0
- package/dist/{chunk-5AEN2PLB.cjs → chunk-ZZJDGGC3.cjs} +33 -33
- package/dist/{chunk-5AEN2PLB.cjs.map → chunk-ZZJDGGC3.cjs.map} +1 -1
- package/dist/diagrams/blockdiagram/index.cjs +6 -6
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/blockdiagram/index.js +2 -2
- package/dist/diagrams/circuit/index.cjs +8 -8
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.js +2 -2
- package/dist/diagrams/ecomap/index.cjs +8 -8
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/ecomap/index.js +3 -3
- package/dist/diagrams/entity/index.cjs +6 -6
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/entity/index.js +2 -2
- package/dist/diagrams/fishbone/index.cjs +8 -8
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.js +2 -2
- package/dist/diagrams/flowchart/index.cjs +8 -8
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/flowchart/index.js +2 -2
- package/dist/diagrams/genogram/index.cjs +10 -10
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/genogram/index.js +3 -3
- package/dist/diagrams/ladder/index.cjs +6 -6
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.js +2 -2
- package/dist/diagrams/logic/index.cjs +6 -6
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/logic/index.js +2 -2
- package/dist/diagrams/orgchart/index.cjs +7 -7
- package/dist/diagrams/orgchart/index.d.cts +1 -1
- package/dist/diagrams/orgchart/index.d.ts +1 -1
- package/dist/diagrams/orgchart/index.js +2 -2
- package/dist/diagrams/pedigree/index.cjs +8 -8
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.js +3 -3
- package/dist/diagrams/phylo/index.cjs +7 -7
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.js +2 -2
- package/dist/diagrams/sld/index.cjs +6 -6
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sld/index.js +2 -2
- package/dist/diagrams/sociogram/index.cjs +7 -7
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/sociogram/index.js +3 -3
- package/dist/diagrams/timing/index.cjs +5 -5
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/timing/index.js +2 -2
- package/dist/diagrams/venn/index.cjs +9 -9
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/diagrams/venn/index.js +2 -2
- package/dist/{index-CUwp4GXI.d.ts → index-D3u6vcA4.d.ts} +1 -1
- package/dist/{index-ivhNGsyU.d.cts → index-bdfj6FpQ.d.cts} +1 -1
- package/dist/index.cjs +41 -41
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +19 -19
- package/dist/react.cjs +20 -20
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +19 -19
- package/dist/react.js.map +1 -1
- package/dist/{types-Bl-Pn7Wj.d.cts → types-DnU2UlWz.d.cts} +26 -3
- package/dist/{types-Bl-Pn7Wj.d.ts → types-DnU2UlWz.d.ts} +26 -3
- package/package.json +1 -1
- package/dist/chunk-2JDVJRR3.cjs.map +0 -1
- package/dist/chunk-3FKS4KQK.cjs.map +0 -1
- package/dist/chunk-45KP67RR.js.map +0 -1
- package/dist/chunk-B37IKTI7.cjs.map +0 -1
- package/dist/chunk-H2OEUBPO.js.map +0 -1
- package/dist/chunk-HDKDQAEQ.cjs.map +0 -1
- package/dist/chunk-K2SOC3XF.cjs.map +0 -1
- package/dist/chunk-KLJEK547.js +0 -71
- package/dist/chunk-KLJEK547.js.map +0 -1
- package/dist/chunk-MCFQAUQV.cjs.map +0 -1
- package/dist/chunk-MJGDP3CS.cjs.map +0 -1
- package/dist/chunk-NNU4RGT3.js.map +0 -1
- package/dist/chunk-OC22GGQN.js.map +0 -1
- package/dist/chunk-SQKLKBBK.cjs.map +0 -1
- package/dist/chunk-TYCHEOQX.js.map +0 -1
- package/dist/chunk-UGCUNADI.js.map +0 -1
- package/dist/chunk-VLMK7MQK.js.map +0 -1
- package/dist/chunk-XTATRNUN.cjs.map +0 -1
- package/dist/chunk-XZNPAD6E.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveFlowchartTheme } from './chunk-2VNMKOUO.js';
|
|
2
|
-
import { text, title, desc, el, defs, group, svgRoot, rect, path, polygon, circle, line } from './chunk-
|
|
2
|
+
import { text, title, desc, el, defs, group, svgRoot, rect, multilineText, path, polygon, circle, line } from './chunk-SYYBKDL7.js';
|
|
3
3
|
|
|
4
4
|
// src/diagrams/flowchart/parser.ts
|
|
5
5
|
var FlowchartParseError = class extends Error {
|
|
@@ -15,76 +15,81 @@ var FlowchartParseError = class extends Error {
|
|
|
15
15
|
source;
|
|
16
16
|
};
|
|
17
17
|
var DIRECTIONS = /* @__PURE__ */ new Set(["TB", "TD", "BT", "LR", "RL"]);
|
|
18
|
+
function unquoteLabel(s) {
|
|
19
|
+
const t = s.trim();
|
|
20
|
+
if (t.length >= 2 && t.startsWith('"') && t.endsWith('"')) return t.slice(1, -1);
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
18
23
|
function parseShapeSuffix(line2, pos) {
|
|
19
24
|
const ch = line2[pos];
|
|
20
25
|
if (ch === void 0) return null;
|
|
21
26
|
if (ch === ">") {
|
|
22
27
|
const end = line2.indexOf("]", pos + 1);
|
|
23
28
|
if (end < 0) return null;
|
|
24
|
-
return { shape: "asymmetric", label: line2.slice(pos + 1, end)
|
|
29
|
+
return { shape: "asymmetric", label: unquoteLabel(line2.slice(pos + 1, end)), end: end + 1 };
|
|
25
30
|
}
|
|
26
31
|
if (ch === "(" && line2[pos + 1] === "(" && line2[pos + 2] === "(") {
|
|
27
32
|
const end = line2.indexOf(")))", pos + 3);
|
|
28
33
|
if (end < 0) return null;
|
|
29
|
-
return { shape: "double-circle", label: line2.slice(pos + 3, end)
|
|
34
|
+
return { shape: "double-circle", label: unquoteLabel(line2.slice(pos + 3, end)), end: end + 3 };
|
|
30
35
|
}
|
|
31
36
|
if (ch === "(" && line2[pos + 1] === "[") {
|
|
32
37
|
const end = line2.indexOf("])", pos + 2);
|
|
33
38
|
if (end < 0) return null;
|
|
34
|
-
return { shape: "stadium", label: line2.slice(pos + 2, end)
|
|
39
|
+
return { shape: "stadium", label: unquoteLabel(line2.slice(pos + 2, end)), end: end + 2 };
|
|
35
40
|
}
|
|
36
41
|
if (ch === "(" && line2[pos + 1] === "(") {
|
|
37
42
|
const end = line2.indexOf("))", pos + 2);
|
|
38
43
|
if (end < 0) return null;
|
|
39
|
-
return { shape: "circle", label: line2.slice(pos + 2, end)
|
|
44
|
+
return { shape: "circle", label: unquoteLabel(line2.slice(pos + 2, end)), end: end + 2 };
|
|
40
45
|
}
|
|
41
46
|
if (ch === "[" && line2[pos + 1] === "[") {
|
|
42
47
|
const end = line2.indexOf("]]", pos + 2);
|
|
43
48
|
if (end < 0) return null;
|
|
44
|
-
return { shape: "subroutine", label: line2.slice(pos + 2, end)
|
|
49
|
+
return { shape: "subroutine", label: unquoteLabel(line2.slice(pos + 2, end)), end: end + 2 };
|
|
45
50
|
}
|
|
46
51
|
if (ch === "[" && line2[pos + 1] === "(") {
|
|
47
52
|
const end = line2.indexOf(")]", pos + 2);
|
|
48
53
|
if (end < 0) return null;
|
|
49
|
-
return { shape: "cylinder", label: line2.slice(pos + 2, end)
|
|
54
|
+
return { shape: "cylinder", label: unquoteLabel(line2.slice(pos + 2, end)), end: end + 2 };
|
|
50
55
|
}
|
|
51
56
|
if (ch === "{" && line2[pos + 1] === "{") {
|
|
52
57
|
const end = line2.indexOf("}}", pos + 2);
|
|
53
58
|
if (end < 0) return null;
|
|
54
|
-
return { shape: "hexagon", label: line2.slice(pos + 2, end)
|
|
59
|
+
return { shape: "hexagon", label: unquoteLabel(line2.slice(pos + 2, end)), end: end + 2 };
|
|
55
60
|
}
|
|
56
61
|
if (ch === "[" && line2[pos + 1] === "/") {
|
|
57
62
|
const endSlash = line2.indexOf("\\]", pos + 2);
|
|
58
63
|
if (endSlash >= 0) {
|
|
59
|
-
return { shape: "trapezoid", label: line2.slice(pos + 2, endSlash)
|
|
64
|
+
return { shape: "trapezoid", label: unquoteLabel(line2.slice(pos + 2, endSlash)), end: endSlash + 2 };
|
|
60
65
|
}
|
|
61
66
|
const end = line2.indexOf("/]", pos + 2);
|
|
62
67
|
if (end < 0) return null;
|
|
63
|
-
return { shape: "parallelogram", label: line2.slice(pos + 2, end)
|
|
68
|
+
return { shape: "parallelogram", label: unquoteLabel(line2.slice(pos + 2, end)), end: end + 2 };
|
|
64
69
|
}
|
|
65
70
|
if (ch === "[" && line2[pos + 1] === "\\") {
|
|
66
71
|
const endFwd = line2.indexOf("/]", pos + 2);
|
|
67
72
|
if (endFwd >= 0) {
|
|
68
|
-
return { shape: "trapezoid-alt", label: line2.slice(pos + 2, endFwd)
|
|
73
|
+
return { shape: "trapezoid-alt", label: unquoteLabel(line2.slice(pos + 2, endFwd)), end: endFwd + 2 };
|
|
69
74
|
}
|
|
70
75
|
const end = line2.indexOf("\\]", pos + 2);
|
|
71
76
|
if (end < 0) return null;
|
|
72
|
-
return { shape: "parallelogram-alt", label: line2.slice(pos + 2, end)
|
|
77
|
+
return { shape: "parallelogram-alt", label: unquoteLabel(line2.slice(pos + 2, end)), end: end + 2 };
|
|
73
78
|
}
|
|
74
79
|
if (ch === "[") {
|
|
75
80
|
const end = line2.indexOf("]", pos + 1);
|
|
76
81
|
if (end < 0) return null;
|
|
77
|
-
return { shape: "rect", label: line2.slice(pos + 1, end)
|
|
82
|
+
return { shape: "rect", label: unquoteLabel(line2.slice(pos + 1, end)), end: end + 1 };
|
|
78
83
|
}
|
|
79
84
|
if (ch === "(") {
|
|
80
85
|
const end = line2.indexOf(")", pos + 1);
|
|
81
86
|
if (end < 0) return null;
|
|
82
|
-
return { shape: "round", label: line2.slice(pos + 1, end)
|
|
87
|
+
return { shape: "round", label: unquoteLabel(line2.slice(pos + 1, end)), end: end + 1 };
|
|
83
88
|
}
|
|
84
89
|
if (ch === "{") {
|
|
85
90
|
const end = line2.indexOf("}", pos + 1);
|
|
86
91
|
if (end < 0) return null;
|
|
87
|
-
return { shape: "diamond", label: line2.slice(pos + 1, end)
|
|
92
|
+
return { shape: "diamond", label: unquoteLabel(line2.slice(pos + 1, end)), end: end + 1 };
|
|
88
93
|
}
|
|
89
94
|
return null;
|
|
90
95
|
}
|
|
@@ -168,7 +173,7 @@ function parsePipeLabel(line2, pos) {
|
|
|
168
173
|
if (line2[pos] !== "|") return null;
|
|
169
174
|
const end = line2.indexOf("|", pos + 1);
|
|
170
175
|
if (end < 0) return null;
|
|
171
|
-
return { label: line2.slice(pos + 1, end)
|
|
176
|
+
return { label: unquoteLabel(line2.slice(pos + 1, end)), end: end + 1 };
|
|
172
177
|
}
|
|
173
178
|
function skipSpaces(line2, pos) {
|
|
174
179
|
while (pos < line2.length && (line2[pos] === " " || line2[pos] === " ")) pos++;
|
|
@@ -397,7 +402,18 @@ function parseFlowchart(source) {
|
|
|
397
402
|
}
|
|
398
403
|
continue;
|
|
399
404
|
}
|
|
400
|
-
|
|
405
|
+
const linkStyleMatch = /^linkStyle\s+([\d,\s]+|default)\s+(.+)$/.exec(trimmed);
|
|
406
|
+
if (linkStyleMatch) {
|
|
407
|
+
const sel = linkStyleMatch[1].trim();
|
|
408
|
+
const props = parseCssProps(linkStyleMatch[2]);
|
|
409
|
+
if (sel !== "default") {
|
|
410
|
+
const indices = sel.split(/[,\s]+/).map((s) => s.trim()).filter((s) => s.length > 0).map((s) => parseInt(s, 10)).filter((n) => !isNaN(n));
|
|
411
|
+
for (const idx of indices) {
|
|
412
|
+
ast.linkStyles.set(idx, { ...ast.linkStyles.get(idx) ?? {}, ...props });
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
401
417
|
let parsed;
|
|
402
418
|
try {
|
|
403
419
|
parsed = parseChainStatement(trimmed, i + 1);
|
|
@@ -1567,6 +1583,8 @@ function layoutFlowchart(ast) {
|
|
|
1567
1583
|
if (flipX) c.x = outWidth - c.x;
|
|
1568
1584
|
}
|
|
1569
1585
|
}
|
|
1586
|
+
const edgeIndex = /* @__PURE__ */ new Map();
|
|
1587
|
+
ast.edges.forEach((e, i) => edgeIndex.set(e, i));
|
|
1570
1588
|
const outEdges = updatedEdges.map((le) => {
|
|
1571
1589
|
const chain = le.chain.length > 0 ? le.chain : [le.from, le.to];
|
|
1572
1590
|
const points = [];
|
|
@@ -1581,7 +1599,7 @@ function layoutFlowchart(ast) {
|
|
|
1581
1599
|
}
|
|
1582
1600
|
}
|
|
1583
1601
|
if (points.length < 2) {
|
|
1584
|
-
return { edge: le.original, path: "" };
|
|
1602
|
+
return { edge: le.original, path: "", index: edgeIndex.get(le.original) };
|
|
1585
1603
|
}
|
|
1586
1604
|
const startNode = nodeCenter.get(chain[0]);
|
|
1587
1605
|
const endNode = nodeCenter.get(chain[chain.length - 1]);
|
|
@@ -1606,7 +1624,8 @@ function layoutFlowchart(ast) {
|
|
|
1606
1624
|
isReversed: le.isReversed
|
|
1607
1625
|
},
|
|
1608
1626
|
path: d,
|
|
1609
|
-
labelAnchor
|
|
1627
|
+
labelAnchor,
|
|
1628
|
+
index: edgeIndex.get(le.original)
|
|
1610
1629
|
};
|
|
1611
1630
|
});
|
|
1612
1631
|
function collectDescendantNodeIds(sgId) {
|
|
@@ -1874,7 +1893,7 @@ function renderCluster(lc) {
|
|
|
1874
1893
|
function renderNode(ln) {
|
|
1875
1894
|
const n = ln.node;
|
|
1876
1895
|
const shapeEl = shapeSVG(n.shape, ln.width, ln.height);
|
|
1877
|
-
const label =
|
|
1896
|
+
const label = multilineText(
|
|
1878
1897
|
{
|
|
1879
1898
|
x: ln.width / 2,
|
|
1880
1899
|
y: ln.height / 2,
|
|
@@ -1884,7 +1903,8 @@ function renderNode(ln) {
|
|
|
1884
1903
|
},
|
|
1885
1904
|
n.label
|
|
1886
1905
|
);
|
|
1887
|
-
const
|
|
1906
|
+
const plainLabel = n.label.replace(/<br\s*\/?>/gi, " ").replace(/<\/?[bi]>/gi, "");
|
|
1907
|
+
const nodeTitle = title(plainLabel);
|
|
1888
1908
|
const classAttr = ["sx-fc-node-g", ...(n.classes ?? []).map((c) => `sx-fc-class-${c}`)].join(" ");
|
|
1889
1909
|
return group(
|
|
1890
1910
|
{
|
|
@@ -1921,6 +1941,7 @@ function renderEdge(le) {
|
|
|
1921
1941
|
return group(
|
|
1922
1942
|
{
|
|
1923
1943
|
"data-edge-id": e.id ?? `${e.from}->${e.to}`,
|
|
1944
|
+
"data-edge-index": le.index,
|
|
1924
1945
|
"data-kind": e.kind,
|
|
1925
1946
|
"data-from": e.from,
|
|
1926
1947
|
"data-to": e.to
|
|
@@ -1969,6 +1990,10 @@ function renderFlowchartAST(ast, themeName = "default") {
|
|
|
1969
1990
|
const props = Object.entries(cd.props).map(([k, v]) => `${k}:${v}`).join(";");
|
|
1970
1991
|
return `.sx-fc-class-${cd.id} > .sx-fc-node { ${props} }`;
|
|
1971
1992
|
}).join("\n");
|
|
1993
|
+
const linkStyleOverrides = Array.from(ast.linkStyles.entries()).map(([idx, props]) => {
|
|
1994
|
+
const cssProps = Object.entries(props).map(([k, v]) => `${k}:${v}`).join(";");
|
|
1995
|
+
return `g[data-edge-index="${idx}"] path { ${cssProps} }`;
|
|
1996
|
+
}).join("\n");
|
|
1972
1997
|
const titleBlock = ast.title ? text(
|
|
1973
1998
|
{
|
|
1974
1999
|
x: layout.width / 2,
|
|
@@ -1978,7 +2003,7 @@ function renderFlowchartAST(ast, themeName = "default") {
|
|
|
1978
2003
|
},
|
|
1979
2004
|
ast.title
|
|
1980
2005
|
) : "";
|
|
1981
|
-
const cssOverrides = [nodeStyleOverrides, classDefOverrides].filter((s) => s.length > 0).join("\n");
|
|
2006
|
+
const cssOverrides = [nodeStyleOverrides, classDefOverrides, linkStyleOverrides].filter((s) => s.length > 0).join("\n");
|
|
1982
2007
|
const headMeta = [
|
|
1983
2008
|
title(ast.title ? `${ast.title} \u2014 Flowchart` : "Flowchart"),
|
|
1984
2009
|
desc(
|
|
@@ -2038,5 +2063,5 @@ var flowchart = {
|
|
|
2038
2063
|
};
|
|
2039
2064
|
|
|
2040
2065
|
export { FC_CONST, flowchart, layoutFlowchart, parseFlowchart, renderFlowchart, renderFlowchartAST };
|
|
2041
|
-
//# sourceMappingURL=chunk-
|
|
2042
|
-
//# sourceMappingURL=chunk-
|
|
2066
|
+
//# sourceMappingURL=chunk-FIVUMDLF.js.map
|
|
2067
|
+
//# sourceMappingURL=chunk-FIVUMDLF.js.map
|