@zjlab-frontier/markdown 1.0.4
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/README.md +148 -0
- package/dist/Tableau10-D7jGxypv.mjs +8 -0
- package/dist/arc-BkFOiLi7.mjs +84 -0
- package/dist/array-CqVTtuYm.mjs +6 -0
- package/dist/blockDiagram-c4efeb88-CngVNufX.mjs +1221 -0
- package/dist/c4Diagram-c83219d4-CvSWXhSV.mjs +1579 -0
- package/dist/channel-BCTzeqLo.mjs +5 -0
- package/dist/classDiagram-beda092f-8UkpWDgI.mjs +218 -0
- package/dist/classDiagram-v2-2358418a-D3LsBhTm.mjs +200 -0
- package/dist/clone-DZgGXtyK.mjs +8 -0
- package/dist/createText-1719965b-DMv-Bu7A.mjs +155 -0
- package/dist/edges-96097737-BeVwLt3S.mjs +1088 -0
- package/dist/erDiagram-0228fc6a-GXXkRZ8r.mjs +929 -0
- package/dist/flowDb-c6c81e3f-CrOg5i55.mjs +1126 -0
- package/dist/flowDiagram-50d868cf-sXe_oFAW.mjs +788 -0
- package/dist/flowDiagram-v2-4f6560a1-CoKYvZkH.mjs +17 -0
- package/dist/flowchart-elk-definition-6af322e1-SuvGsuBl.mjs +48146 -0
- package/dist/ganttDiagram-a2739b55-BbWq9bqY.mjs +2477 -0
- package/dist/gitGraphDiagram-82fe8481-C6-e4UmK.mjs +1264 -0
- package/dist/graph-CoIGCRFf.mjs +847 -0
- package/dist/index-5325376f-BENBY8aO.mjs +373 -0
- package/dist/index-5_ujiRGo.mjs +46276 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +8 -0
- package/dist/index.umd.js +2421 -0
- package/dist/infoDiagram-8eee0895-BEAb2pCD.mjs +319 -0
- package/dist/init-DjUOC4st.mjs +16 -0
- package/dist/journeyDiagram-c64418c1-CERjyYnA.mjs +801 -0
- package/dist/layout-aCAVHR2T.mjs +1472 -0
- package/dist/line-BGunMwE-.mjs +33 -0
- package/dist/linear-DciWi0hE.mjs +423 -0
- package/dist/markdown.d.ts +25 -0
- package/dist/mindmap-definition-8da855dc-Cc8_U7zD.mjs +21936 -0
- package/dist/ordinal-C0oynhte.mjs +61 -0
- package/dist/path-DLwuMfdd.mjs +84 -0
- package/dist/pieDiagram-a8764435-B00hy7Ez.mjs +500 -0
- package/dist/quadrantDiagram-1e28029f-DR7IGAoM.mjs +903 -0
- package/dist/requirementDiagram-08caed73-o6N3X3-m.mjs +767 -0
- package/dist/sankeyDiagram-a04cb91d-CYF9Ro1W.mjs +802 -0
- package/dist/sequenceDiagram-c5b8d532-vz_R7xBU.mjs +2234 -0
- package/dist/stateDiagram-1ecb1508-B0YUHnuE.mjs +266 -0
- package/dist/stateDiagram-v2-c2b004d7-CDTm1Jfb.mjs +184 -0
- package/dist/styles/highlight.scss +115 -0
- package/dist/styles/markdown.scss +1163 -0
- package/dist/styles-b4e223ce-C_-huVuQ.mjs +1089 -0
- package/dist/styles-ca3715f6-soe07Bnw.mjs +960 -0
- package/dist/styles-d45a18b0-0ZXwJp5P.mjs +436 -0
- package/dist/svgDrawCommon-b86b1483-UCLksviB.mjs +64 -0
- package/dist/timeline-definition-faaaa080-Dt5unv7p.mjs +792 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/xychartDiagram-f5964ef8-BZWS0E_9.mjs +1282 -0
- package/package.json +66 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { s as G, d as S, p as A } from "./styles-b4e223ce-C_-huVuQ.mjs";
|
|
2
|
+
import { g as v, l as y, d as B, e as W, F as $, B as M, G as I } from "./index-5_ujiRGo.mjs";
|
|
3
|
+
import { G as O } from "./graph-CoIGCRFf.mjs";
|
|
4
|
+
import { l as P } from "./layout-aCAVHR2T.mjs";
|
|
5
|
+
import { l as X } from "./line-BGunMwE-.mjs";
|
|
6
|
+
let H = 0;
|
|
7
|
+
const Y = function(i, a, t, o, p) {
|
|
8
|
+
const g = function(e) {
|
|
9
|
+
switch (e) {
|
|
10
|
+
case p.db.relationType.AGGREGATION:
|
|
11
|
+
return "aggregation";
|
|
12
|
+
case p.db.relationType.EXTENSION:
|
|
13
|
+
return "extension";
|
|
14
|
+
case p.db.relationType.COMPOSITION:
|
|
15
|
+
return "composition";
|
|
16
|
+
case p.db.relationType.DEPENDENCY:
|
|
17
|
+
return "dependency";
|
|
18
|
+
case p.db.relationType.LOLLIPOP:
|
|
19
|
+
return "lollipop";
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
a.points = a.points.filter((e) => !Number.isNaN(e.y));
|
|
23
|
+
const s = a.points, c = X().x(function(e) {
|
|
24
|
+
return e.x;
|
|
25
|
+
}).y(function(e) {
|
|
26
|
+
return e.y;
|
|
27
|
+
}).curve($), n = i.append("path").attr("d", c(s)).attr("id", "edge" + H).attr("class", "relation");
|
|
28
|
+
let r = "";
|
|
29
|
+
o.arrowMarkerAbsolute && (r = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, r = r.replace(/\(/g, "\\("), r = r.replace(/\)/g, "\\)")), t.relation.lineType == 1 && n.attr("class", "relation dashed-line"), t.relation.lineType == 10 && n.attr("class", "relation dotted-line"), t.relation.type1 !== "none" && n.attr(
|
|
30
|
+
"marker-start",
|
|
31
|
+
"url(" + r + "#" + g(t.relation.type1) + "Start)"
|
|
32
|
+
), t.relation.type2 !== "none" && n.attr(
|
|
33
|
+
"marker-end",
|
|
34
|
+
"url(" + r + "#" + g(t.relation.type2) + "End)"
|
|
35
|
+
);
|
|
36
|
+
let f, h;
|
|
37
|
+
const x = a.points.length;
|
|
38
|
+
let b = M.calcLabelPosition(a.points);
|
|
39
|
+
f = b.x, h = b.y;
|
|
40
|
+
let u, m, w, k;
|
|
41
|
+
if (x % 2 !== 0 && x > 1) {
|
|
42
|
+
let e = M.calcCardinalityPosition(
|
|
43
|
+
t.relation.type1 !== "none",
|
|
44
|
+
a.points,
|
|
45
|
+
a.points[0]
|
|
46
|
+
), d = M.calcCardinalityPosition(
|
|
47
|
+
t.relation.type2 !== "none",
|
|
48
|
+
a.points,
|
|
49
|
+
a.points[x - 1]
|
|
50
|
+
);
|
|
51
|
+
y.debug("cardinality_1_point " + JSON.stringify(e)), y.debug("cardinality_2_point " + JSON.stringify(d)), u = e.x, m = e.y, w = d.x, k = d.y;
|
|
52
|
+
}
|
|
53
|
+
if (t.title !== void 0) {
|
|
54
|
+
const e = i.append("g").attr("class", "classLabel"), d = e.append("text").attr("class", "label").attr("x", f).attr("y", h).attr("fill", "red").attr("text-anchor", "middle").text(t.title);
|
|
55
|
+
window.label = d;
|
|
56
|
+
const l = d.node().getBBox();
|
|
57
|
+
e.insert("rect", ":first-child").attr("class", "box").attr("x", l.x - o.padding / 2).attr("y", l.y - o.padding / 2).attr("width", l.width + o.padding).attr("height", l.height + o.padding);
|
|
58
|
+
}
|
|
59
|
+
y.info("Rendering relation " + JSON.stringify(t)), t.relationTitle1 !== void 0 && t.relationTitle1 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type1").attr("x", u).attr("y", m).attr("fill", "black").attr("font-size", "6").text(t.relationTitle1), t.relationTitle2 !== void 0 && t.relationTitle2 !== "none" && i.append("g").attr("class", "cardinality").append("text").attr("class", "type2").attr("x", w).attr("y", k).attr("fill", "black").attr("font-size", "6").text(t.relationTitle2), H++;
|
|
60
|
+
}, J = function(i, a, t, o) {
|
|
61
|
+
y.debug("Rendering class ", a, t);
|
|
62
|
+
const p = a.id, g = {
|
|
63
|
+
id: p,
|
|
64
|
+
label: a.id,
|
|
65
|
+
width: 0,
|
|
66
|
+
height: 0
|
|
67
|
+
}, s = i.append("g").attr("id", o.db.lookUpDomId(p)).attr("class", "classGroup");
|
|
68
|
+
let c;
|
|
69
|
+
a.link ? c = s.append("svg:a").attr("xlink:href", a.link).attr("target", a.linkTarget).append("text").attr("y", t.textHeight + t.padding).attr("x", 0) : c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
|
70
|
+
let n = !0;
|
|
71
|
+
a.annotations.forEach(function(d) {
|
|
72
|
+
const l = c.append("tspan").text("«" + d + "»");
|
|
73
|
+
n || l.attr("dy", t.textHeight), n = !1;
|
|
74
|
+
});
|
|
75
|
+
let r = C(a);
|
|
76
|
+
const f = c.append("tspan").text(r).attr("class", "title");
|
|
77
|
+
n || f.attr("dy", t.textHeight);
|
|
78
|
+
const h = c.node().getBBox().height;
|
|
79
|
+
let x, b, u;
|
|
80
|
+
if (a.members.length > 0) {
|
|
81
|
+
x = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin / 2).attr("y2", t.padding + h + t.dividerMargin / 2);
|
|
82
|
+
const d = s.append("text").attr("x", t.padding).attr("y", h + t.dividerMargin + t.textHeight).attr("fill", "white").attr("class", "classText");
|
|
83
|
+
n = !0, a.members.forEach(function(l) {
|
|
84
|
+
_(d, l, n, t), n = !1;
|
|
85
|
+
}), b = d.node().getBBox();
|
|
86
|
+
}
|
|
87
|
+
if (a.methods.length > 0) {
|
|
88
|
+
u = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin + b.height).attr("y2", t.padding + h + t.dividerMargin + b.height);
|
|
89
|
+
const d = s.append("text").attr("x", t.padding).attr("y", h + 2 * t.dividerMargin + b.height + t.textHeight).attr("fill", "white").attr("class", "classText");
|
|
90
|
+
n = !0, a.methods.forEach(function(l) {
|
|
91
|
+
_(d, l, n, t), n = !1;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const m = s.node().getBBox();
|
|
95
|
+
var w = " ";
|
|
96
|
+
a.cssClasses.length > 0 && (w = w + a.cssClasses.join(" "));
|
|
97
|
+
const e = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", m.width + 2 * t.padding).attr("height", m.height + t.padding + 0.5 * t.dividerMargin).attr("class", w).node().getBBox().width;
|
|
98
|
+
return c.node().childNodes.forEach(function(d) {
|
|
99
|
+
d.setAttribute("x", (e - d.getBBox().width) / 2);
|
|
100
|
+
}), a.tooltip && c.insert("title").text(a.tooltip), x && x.attr("x2", e), u && u.attr("x2", e), g.width = e, g.height = m.height + t.padding + 0.5 * t.dividerMargin, g;
|
|
101
|
+
}, C = function(i) {
|
|
102
|
+
let a = i.id;
|
|
103
|
+
return i.type && (a += "<" + I(i.type) + ">"), a;
|
|
104
|
+
}, Z = function(i, a, t, o) {
|
|
105
|
+
y.debug("Rendering note ", a, t);
|
|
106
|
+
const p = a.id, g = {
|
|
107
|
+
id: p,
|
|
108
|
+
text: a.text,
|
|
109
|
+
width: 0,
|
|
110
|
+
height: 0
|
|
111
|
+
}, s = i.append("g").attr("id", p).attr("class", "classGroup");
|
|
112
|
+
let c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
|
|
113
|
+
const n = JSON.parse(`"${a.text}"`).split(`
|
|
114
|
+
`);
|
|
115
|
+
n.forEach(function(x) {
|
|
116
|
+
y.debug(`Adding line: ${x}`), c.append("tspan").text(x).attr("class", "title").attr("dy", t.textHeight);
|
|
117
|
+
});
|
|
118
|
+
const r = s.node().getBBox(), h = s.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", r.width + 2 * t.padding).attr(
|
|
119
|
+
"height",
|
|
120
|
+
r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin
|
|
121
|
+
).node().getBBox().width;
|
|
122
|
+
return c.node().childNodes.forEach(function(x) {
|
|
123
|
+
x.setAttribute("x", (h - x.getBBox().width) / 2);
|
|
124
|
+
}), g.width = h, g.height = r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin, g;
|
|
125
|
+
}, _ = function(i, a, t, o) {
|
|
126
|
+
const { displayText: p, cssStyle: g } = a.getDisplayDetails(), s = i.append("tspan").attr("x", o.padding).text(p);
|
|
127
|
+
g !== "" && s.attr("style", a.cssStyle), t || s.attr("dy", o.textHeight);
|
|
128
|
+
}, N = {
|
|
129
|
+
getClassTitleString: C,
|
|
130
|
+
drawClass: J,
|
|
131
|
+
drawEdge: Y,
|
|
132
|
+
drawNote: Z
|
|
133
|
+
};
|
|
134
|
+
let T = {};
|
|
135
|
+
const E = 20, L = function(i) {
|
|
136
|
+
const a = Object.entries(T).find((t) => t[1].label === i);
|
|
137
|
+
if (a)
|
|
138
|
+
return a[0];
|
|
139
|
+
}, R = function(i) {
|
|
140
|
+
i.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), i.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), i.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), i.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
|
|
141
|
+
}, F = function(i, a, t, o) {
|
|
142
|
+
const p = v().class;
|
|
143
|
+
T = {}, y.info("Rendering diagram " + i);
|
|
144
|
+
const g = v().securityLevel;
|
|
145
|
+
let s;
|
|
146
|
+
g === "sandbox" && (s = B("#i" + a));
|
|
147
|
+
const c = g === "sandbox" ? B(s.nodes()[0].contentDocument.body) : B("body"), n = c.select(`[id='${a}']`);
|
|
148
|
+
R(n);
|
|
149
|
+
const r = new O({
|
|
150
|
+
multigraph: !0
|
|
151
|
+
});
|
|
152
|
+
r.setGraph({
|
|
153
|
+
isMultiGraph: !0
|
|
154
|
+
}), r.setDefaultEdgeLabel(function() {
|
|
155
|
+
return {};
|
|
156
|
+
});
|
|
157
|
+
const f = o.db.getClasses(), h = Object.keys(f);
|
|
158
|
+
for (const e of h) {
|
|
159
|
+
const d = f[e], l = N.drawClass(n, d, p, o);
|
|
160
|
+
T[l.id] = l, r.setNode(l.id, l), y.info("Org height: " + l.height);
|
|
161
|
+
}
|
|
162
|
+
o.db.getRelations().forEach(function(e) {
|
|
163
|
+
y.info(
|
|
164
|
+
// cspell:ignore tjoho
|
|
165
|
+
"tjoho" + L(e.id1) + L(e.id2) + JSON.stringify(e)
|
|
166
|
+
), r.setEdge(
|
|
167
|
+
L(e.id1),
|
|
168
|
+
L(e.id2),
|
|
169
|
+
{
|
|
170
|
+
relation: e
|
|
171
|
+
},
|
|
172
|
+
e.title || "DEFAULT"
|
|
173
|
+
);
|
|
174
|
+
}), o.db.getNotes().forEach(function(e) {
|
|
175
|
+
y.debug(`Adding note: ${JSON.stringify(e)}`);
|
|
176
|
+
const d = N.drawNote(n, e, p, o);
|
|
177
|
+
T[d.id] = d, r.setNode(d.id, d), e.class && e.class in f && r.setEdge(
|
|
178
|
+
e.id,
|
|
179
|
+
L(e.class),
|
|
180
|
+
{
|
|
181
|
+
relation: {
|
|
182
|
+
id1: e.id,
|
|
183
|
+
id2: e.class,
|
|
184
|
+
relation: {
|
|
185
|
+
type1: "none",
|
|
186
|
+
type2: "none",
|
|
187
|
+
lineType: 10
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"DEFAULT"
|
|
192
|
+
);
|
|
193
|
+
}), P(r), r.nodes().forEach(function(e) {
|
|
194
|
+
e !== void 0 && r.node(e) !== void 0 && (y.debug("Node " + e + ": " + JSON.stringify(r.node(e))), c.select("#" + (o.db.lookUpDomId(e) || e)).attr(
|
|
195
|
+
"transform",
|
|
196
|
+
"translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
|
|
197
|
+
));
|
|
198
|
+
}), r.edges().forEach(function(e) {
|
|
199
|
+
e !== void 0 && r.edge(e) !== void 0 && (y.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(r.edge(e))), N.drawEdge(n, r.edge(e), r.edge(e).relation, p, o));
|
|
200
|
+
});
|
|
201
|
+
const u = n.node().getBBox(), m = u.width + E * 2, w = u.height + E * 2;
|
|
202
|
+
W(n, w, m, p.useMaxWidth);
|
|
203
|
+
const k = `${u.x - E} ${u.y - E} ${m} ${w}`;
|
|
204
|
+
y.debug(`viewBox ${k}`), n.attr("viewBox", k);
|
|
205
|
+
}, U = {
|
|
206
|
+
draw: F
|
|
207
|
+
}, D = {
|
|
208
|
+
parser: A,
|
|
209
|
+
db: S,
|
|
210
|
+
renderer: U,
|
|
211
|
+
styles: G,
|
|
212
|
+
init: (i) => {
|
|
213
|
+
i.class || (i.class = {}), i.class.arrowMarkerAbsolute = i.arrowMarkerAbsolute, S.clear();
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
D as diagram
|
|
218
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { s as M, d as _, p as B } from "./styles-b4e223ce-C_-huVuQ.mjs";
|
|
2
|
+
import { l as d, g as c, d as w, B as R, o as G, k as D, p as E, q as C, n as A } from "./index-5_ujiRGo.mjs";
|
|
3
|
+
import { G as q } from "./graph-CoIGCRFf.mjs";
|
|
4
|
+
import { r as z } from "./index-5325376f-BENBY8aO.mjs";
|
|
5
|
+
import "./layout-aCAVHR2T.mjs";
|
|
6
|
+
const S = (s) => D.sanitizeText(s, c());
|
|
7
|
+
let k = {
|
|
8
|
+
dividerMargin: 10,
|
|
9
|
+
padding: 5,
|
|
10
|
+
textHeight: 10,
|
|
11
|
+
curve: void 0
|
|
12
|
+
};
|
|
13
|
+
const P = function(s, t, y, a) {
|
|
14
|
+
const e = Object.keys(s);
|
|
15
|
+
d.info("keys:", e), d.info(s), e.forEach(function(i) {
|
|
16
|
+
var o, r;
|
|
17
|
+
const l = s[i], p = {
|
|
18
|
+
shape: "rect",
|
|
19
|
+
id: l.id,
|
|
20
|
+
domId: l.domId,
|
|
21
|
+
labelText: S(l.id),
|
|
22
|
+
labelStyle: "",
|
|
23
|
+
style: "fill: none; stroke: black",
|
|
24
|
+
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
25
|
+
padding: ((o = c().flowchart) == null ? void 0 : o.padding) ?? ((r = c().class) == null ? void 0 : r.padding)
|
|
26
|
+
};
|
|
27
|
+
t.setNode(l.id, p), $(l.classes, t, y, a, l.id), d.info("setNode", p);
|
|
28
|
+
});
|
|
29
|
+
}, $ = function(s, t, y, a, e) {
|
|
30
|
+
const i = Object.keys(s);
|
|
31
|
+
d.info("keys:", i), d.info(s), i.filter((o) => s[o].parent == e).forEach(function(o) {
|
|
32
|
+
var r, l;
|
|
33
|
+
const n = s[o], p = n.cssClasses.join(" "), f = E(n.styles), h = n.label ?? n.id, u = 0, b = {
|
|
34
|
+
labelStyle: f.labelStyle,
|
|
35
|
+
shape: "class_box",
|
|
36
|
+
labelText: S(h),
|
|
37
|
+
classData: n,
|
|
38
|
+
rx: u,
|
|
39
|
+
ry: u,
|
|
40
|
+
class: p,
|
|
41
|
+
style: f.style,
|
|
42
|
+
id: n.id,
|
|
43
|
+
domId: n.domId,
|
|
44
|
+
tooltip: a.db.getTooltip(n.id, e) || "",
|
|
45
|
+
haveCallback: n.haveCallback,
|
|
46
|
+
link: n.link,
|
|
47
|
+
width: n.type === "group" ? 500 : void 0,
|
|
48
|
+
type: n.type,
|
|
49
|
+
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
50
|
+
padding: ((r = c().flowchart) == null ? void 0 : r.padding) ?? ((l = c().class) == null ? void 0 : l.padding)
|
|
51
|
+
};
|
|
52
|
+
t.setNode(n.id, b), e && t.setParent(n.id, e), d.info("setNode", b);
|
|
53
|
+
});
|
|
54
|
+
}, F = function(s, t, y, a) {
|
|
55
|
+
d.info(s), s.forEach(function(e, i) {
|
|
56
|
+
var o, r;
|
|
57
|
+
const l = e, n = "", p = { labelStyle: "", style: "" }, f = l.text, h = 0, v = {
|
|
58
|
+
labelStyle: p.labelStyle,
|
|
59
|
+
shape: "note",
|
|
60
|
+
labelText: S(f),
|
|
61
|
+
noteData: l,
|
|
62
|
+
rx: h,
|
|
63
|
+
ry: h,
|
|
64
|
+
class: n,
|
|
65
|
+
style: p.style,
|
|
66
|
+
id: l.id,
|
|
67
|
+
domId: l.id,
|
|
68
|
+
tooltip: "",
|
|
69
|
+
type: "note",
|
|
70
|
+
// TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
|
|
71
|
+
padding: ((o = c().flowchart) == null ? void 0 : o.padding) ?? ((r = c().class) == null ? void 0 : r.padding)
|
|
72
|
+
};
|
|
73
|
+
if (t.setNode(l.id, v), d.info("setNode", v), !l.class || !(l.class in a))
|
|
74
|
+
return;
|
|
75
|
+
const b = y + i, x = {
|
|
76
|
+
id: `edgeNote${b}`,
|
|
77
|
+
//Set relationship style and line type
|
|
78
|
+
classes: "relation",
|
|
79
|
+
pattern: "dotted",
|
|
80
|
+
// Set link type for rendering
|
|
81
|
+
arrowhead: "none",
|
|
82
|
+
//Set edge extra labels
|
|
83
|
+
startLabelRight: "",
|
|
84
|
+
endLabelLeft: "",
|
|
85
|
+
//Set relation arrow types
|
|
86
|
+
arrowTypeStart: "none",
|
|
87
|
+
arrowTypeEnd: "none",
|
|
88
|
+
style: "fill:none",
|
|
89
|
+
labelStyle: "",
|
|
90
|
+
curve: C(k.curve, A)
|
|
91
|
+
};
|
|
92
|
+
t.setEdge(l.id, l.class, x, b);
|
|
93
|
+
});
|
|
94
|
+
}, H = function(s, t) {
|
|
95
|
+
const y = c().flowchart;
|
|
96
|
+
let a = 0;
|
|
97
|
+
s.forEach(function(e) {
|
|
98
|
+
var i;
|
|
99
|
+
a++;
|
|
100
|
+
const o = {
|
|
101
|
+
//Set relationship style and line type
|
|
102
|
+
classes: "relation",
|
|
103
|
+
pattern: e.relation.lineType == 1 ? "dashed" : "solid",
|
|
104
|
+
id: `id_${e.id1}_${e.id2}_${a}`,
|
|
105
|
+
// Set link type for rendering
|
|
106
|
+
arrowhead: e.type === "arrow_open" ? "none" : "normal",
|
|
107
|
+
//Set edge extra labels
|
|
108
|
+
startLabelRight: e.relationTitle1 === "none" ? "" : e.relationTitle1,
|
|
109
|
+
endLabelLeft: e.relationTitle2 === "none" ? "" : e.relationTitle2,
|
|
110
|
+
//Set relation arrow types
|
|
111
|
+
arrowTypeStart: N(e.relation.type1),
|
|
112
|
+
arrowTypeEnd: N(e.relation.type2),
|
|
113
|
+
style: "fill:none",
|
|
114
|
+
labelStyle: "",
|
|
115
|
+
curve: C(y?.curve, A)
|
|
116
|
+
};
|
|
117
|
+
if (d.info(o, e), e.style !== void 0) {
|
|
118
|
+
const r = E(e.style);
|
|
119
|
+
o.style = r.style, o.labelStyle = r.labelStyle;
|
|
120
|
+
}
|
|
121
|
+
e.text = e.title, e.text === void 0 ? e.style !== void 0 && (o.arrowheadStyle = "fill: #333") : (o.arrowheadStyle = "fill: #333", o.labelpos = "c", ((i = c().flowchart) == null ? void 0 : i.htmlLabels) ?? c().htmlLabels ? (o.labelType = "html", o.label = '<span class="edgeLabel">' + e.text + "</span>") : (o.labelType = "text", o.label = e.text.replace(D.lineBreakRegex, `
|
|
122
|
+
`), e.style === void 0 && (o.style = o.style || "stroke: #333; stroke-width: 1.5px;fill:none"), o.labelStyle = o.labelStyle.replace("color:", "fill:"))), t.setEdge(e.id1, e.id2, o, a);
|
|
123
|
+
});
|
|
124
|
+
}, V = function(s) {
|
|
125
|
+
k = {
|
|
126
|
+
...k,
|
|
127
|
+
...s
|
|
128
|
+
};
|
|
129
|
+
}, W = async function(s, t, y, a) {
|
|
130
|
+
d.info("Drawing class - ", t);
|
|
131
|
+
const e = c().flowchart ?? c().class, i = c().securityLevel;
|
|
132
|
+
d.info("config:", e);
|
|
133
|
+
const o = e?.nodeSpacing ?? 50, r = e?.rankSpacing ?? 50, l = new q({
|
|
134
|
+
multigraph: !0,
|
|
135
|
+
compound: !0
|
|
136
|
+
}).setGraph({
|
|
137
|
+
rankdir: a.db.getDirection(),
|
|
138
|
+
nodesep: o,
|
|
139
|
+
ranksep: r,
|
|
140
|
+
marginx: 8,
|
|
141
|
+
marginy: 8
|
|
142
|
+
}).setDefaultEdgeLabel(function() {
|
|
143
|
+
return {};
|
|
144
|
+
}), n = a.db.getNamespaces(), p = a.db.getClasses(), f = a.db.getRelations(), h = a.db.getNotes();
|
|
145
|
+
d.info(f), P(n, l, t, a), $(p, l, t, a), H(f, l), F(h, l, f.length + 1, p);
|
|
146
|
+
let u;
|
|
147
|
+
i === "sandbox" && (u = w("#i" + t));
|
|
148
|
+
const v = i === "sandbox" ? w(u.nodes()[0].contentDocument.body) : w("body"), b = v.select(`[id="${t}"]`), x = v.select("#" + t + " g");
|
|
149
|
+
if (await z(
|
|
150
|
+
x,
|
|
151
|
+
l,
|
|
152
|
+
["aggregation", "extension", "composition", "dependency", "lollipop"],
|
|
153
|
+
"classDiagram",
|
|
154
|
+
t
|
|
155
|
+
), R.insertTitle(b, "classTitleText", e?.titleTopMargin ?? 5, a.db.getDiagramTitle()), G(l, b, e?.diagramPadding, e?.useMaxWidth), !e?.htmlLabels) {
|
|
156
|
+
const T = i === "sandbox" ? u.nodes()[0].contentDocument : document, I = T.querySelectorAll('[id="' + t + '"] .edgeLabel .label');
|
|
157
|
+
for (const g of I) {
|
|
158
|
+
const L = g.getBBox(), m = T.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
159
|
+
m.setAttribute("rx", 0), m.setAttribute("ry", 0), m.setAttribute("width", L.width), m.setAttribute("height", L.height), g.insertBefore(m, g.firstChild);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
function N(s) {
|
|
164
|
+
let t;
|
|
165
|
+
switch (s) {
|
|
166
|
+
case 0:
|
|
167
|
+
t = "aggregation";
|
|
168
|
+
break;
|
|
169
|
+
case 1:
|
|
170
|
+
t = "extension";
|
|
171
|
+
break;
|
|
172
|
+
case 2:
|
|
173
|
+
t = "composition";
|
|
174
|
+
break;
|
|
175
|
+
case 3:
|
|
176
|
+
t = "dependency";
|
|
177
|
+
break;
|
|
178
|
+
case 4:
|
|
179
|
+
t = "lollipop";
|
|
180
|
+
break;
|
|
181
|
+
default:
|
|
182
|
+
t = "none";
|
|
183
|
+
}
|
|
184
|
+
return t;
|
|
185
|
+
}
|
|
186
|
+
const J = {
|
|
187
|
+
setConf: V,
|
|
188
|
+
draw: W
|
|
189
|
+
}, Z = {
|
|
190
|
+
parser: B,
|
|
191
|
+
db: _,
|
|
192
|
+
renderer: J,
|
|
193
|
+
styles: M,
|
|
194
|
+
init: (s) => {
|
|
195
|
+
s.class || (s.class = {}), s.class.arrowMarkerAbsolute = s.arrowMarkerAbsolute, _.clear();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
export {
|
|
199
|
+
Z as diagram
|
|
200
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { l as b, b6 as T, b7 as m, i as W, Z as E, b8 as w } from "./index-5_ujiRGo.mjs";
|
|
2
|
+
function S(n) {
|
|
3
|
+
const t = n.replace(/\n{2,}/g, `
|
|
4
|
+
`);
|
|
5
|
+
return w(t);
|
|
6
|
+
}
|
|
7
|
+
function j(n) {
|
|
8
|
+
const t = S(n), { children: e } = m(t), o = [[]];
|
|
9
|
+
let s = 0;
|
|
10
|
+
function i(r, a = "normal") {
|
|
11
|
+
r.type === "text" ? r.value.split(`
|
|
12
|
+
`).forEach((l, p) => {
|
|
13
|
+
p !== 0 && (s++, o.push([])), l.split(" ").forEach((f) => {
|
|
14
|
+
f && o[s].push({ content: f, type: a });
|
|
15
|
+
});
|
|
16
|
+
}) : (r.type === "strong" || r.type === "emphasis") && r.children.forEach((c) => {
|
|
17
|
+
i(c, r.type);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return e.forEach((r) => {
|
|
21
|
+
r.type === "paragraph" && r.children.forEach((a) => {
|
|
22
|
+
i(a);
|
|
23
|
+
});
|
|
24
|
+
}), o;
|
|
25
|
+
}
|
|
26
|
+
function v(n) {
|
|
27
|
+
const { children: t } = m(n);
|
|
28
|
+
function e(o) {
|
|
29
|
+
return o.type === "text" ? o.value.replace(/\n/g, "<br/>") : o.type === "strong" ? `<strong>${o.children.map(e).join("")}</strong>` : o.type === "emphasis" ? `<em>${o.children.map(e).join("")}</em>` : o.type === "paragraph" ? `<p>${o.children.map(e).join("")}</p>` : `Unsupported markdown: ${o.type}`;
|
|
30
|
+
}
|
|
31
|
+
return t.map(e).join("");
|
|
32
|
+
}
|
|
33
|
+
function L(n) {
|
|
34
|
+
return Intl.Segmenter ? [...new Intl.Segmenter().segment(n)].map((t) => t.segment) : [...n];
|
|
35
|
+
}
|
|
36
|
+
function $(n, t) {
|
|
37
|
+
const e = L(t.content);
|
|
38
|
+
return x(n, [], e, t.type);
|
|
39
|
+
}
|
|
40
|
+
function x(n, t, e, o) {
|
|
41
|
+
if (e.length === 0)
|
|
42
|
+
return [
|
|
43
|
+
{ content: t.join(""), type: o },
|
|
44
|
+
{ content: "", type: o }
|
|
45
|
+
];
|
|
46
|
+
const [s, ...i] = e, r = [...t, s];
|
|
47
|
+
return n([{ content: r.join(""), type: o }]) ? x(n, r, i, o) : (t.length === 0 && s && (t.push(s), e.shift()), [
|
|
48
|
+
{ content: t.join(""), type: o },
|
|
49
|
+
{ content: e.join(""), type: o }
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
function k(n, t) {
|
|
53
|
+
if (n.some(({ content: e }) => e.includes(`
|
|
54
|
+
`)))
|
|
55
|
+
throw new Error("splitLineToFitWidth does not support newlines in the line");
|
|
56
|
+
return h(n, t);
|
|
57
|
+
}
|
|
58
|
+
function h(n, t, e = [], o = []) {
|
|
59
|
+
if (n.length === 0)
|
|
60
|
+
return o.length > 0 && e.push(o), e.length > 0 ? e : [];
|
|
61
|
+
let s = "";
|
|
62
|
+
n[0].content === " " && (s = " ", n.shift());
|
|
63
|
+
const i = n.shift() ?? { content: " ", type: "normal" }, r = [...o];
|
|
64
|
+
if (s !== "" && r.push({ content: s, type: "normal" }), r.push(i), t(r))
|
|
65
|
+
return h(n, t, e, r);
|
|
66
|
+
if (o.length > 0)
|
|
67
|
+
e.push(o), n.unshift(i);
|
|
68
|
+
else if (i.content) {
|
|
69
|
+
const [a, c] = $(t, i);
|
|
70
|
+
e.push([a]), c.content && n.unshift(c);
|
|
71
|
+
}
|
|
72
|
+
return h(n, t, e);
|
|
73
|
+
}
|
|
74
|
+
function M(n, t) {
|
|
75
|
+
t && n.attr("style", t);
|
|
76
|
+
}
|
|
77
|
+
function R(n, t, e, o, s = !1) {
|
|
78
|
+
const i = n.append("foreignObject"), r = i.append("xhtml:div"), a = t.label, c = t.isNode ? "nodeLabel" : "edgeLabel";
|
|
79
|
+
r.html(
|
|
80
|
+
W(
|
|
81
|
+
`
|
|
82
|
+
<span class="${c} ${o}" ` + (t.labelStyle ? 'style="' + t.labelStyle + '"' : "") + ">" + a + "</span>",
|
|
83
|
+
E()
|
|
84
|
+
)
|
|
85
|
+
), M(r, t.labelStyle), r.style("display", "table-cell"), r.style("white-space", "nowrap"), r.style("max-width", e + "px"), r.attr("xmlns", "http://www.w3.org/1999/xhtml"), s && r.attr("class", "labelBkg");
|
|
86
|
+
let l = r.node().getBoundingClientRect();
|
|
87
|
+
return l.width === e && (r.style("display", "table"), r.style("white-space", "break-spaces"), r.style("width", e + "px"), l = r.node().getBoundingClientRect()), i.style("width", l.width), i.style("height", l.height), i.node();
|
|
88
|
+
}
|
|
89
|
+
function d(n, t, e) {
|
|
90
|
+
return n.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", t * e - 0.1 + "em").attr("dy", e + "em");
|
|
91
|
+
}
|
|
92
|
+
function B(n, t, e) {
|
|
93
|
+
const o = n.append("text"), s = d(o, 1, t);
|
|
94
|
+
g(s, e);
|
|
95
|
+
const i = s.node().getComputedTextLength();
|
|
96
|
+
return o.remove(), i;
|
|
97
|
+
}
|
|
98
|
+
function I(n, t, e) {
|
|
99
|
+
var o;
|
|
100
|
+
const s = n.append("text"), i = d(s, 1, t);
|
|
101
|
+
g(i, [{ content: e, type: "normal" }]);
|
|
102
|
+
const r = (o = i.node()) == null ? void 0 : o.getBoundingClientRect();
|
|
103
|
+
return r && s.remove(), r;
|
|
104
|
+
}
|
|
105
|
+
function N(n, t, e, o = !1) {
|
|
106
|
+
const i = t.append("g"), r = i.insert("rect").attr("class", "background"), a = i.append("text").attr("y", "-10.1");
|
|
107
|
+
let c = 0;
|
|
108
|
+
for (const l of e) {
|
|
109
|
+
const p = (u) => B(i, 1.1, u) <= n, f = p(l) ? [l] : k(l, p);
|
|
110
|
+
for (const u of f) {
|
|
111
|
+
const y = d(a, c, 1.1);
|
|
112
|
+
g(y, u), c++;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (o) {
|
|
116
|
+
const l = a.node().getBBox(), p = 2;
|
|
117
|
+
return r.attr("x", -p).attr("y", -p).attr("width", l.width + 2 * p).attr("height", l.height + 2 * p), i.node();
|
|
118
|
+
} else
|
|
119
|
+
return a.node();
|
|
120
|
+
}
|
|
121
|
+
function g(n, t) {
|
|
122
|
+
n.text(""), t.forEach((e, o) => {
|
|
123
|
+
const s = n.append("tspan").attr("font-style", e.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", e.type === "strong" ? "bold" : "normal");
|
|
124
|
+
o === 0 ? s.text(e.content) : s.text(" " + e.content);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const O = (n, t = "", {
|
|
128
|
+
style: e = "",
|
|
129
|
+
isTitle: o = !1,
|
|
130
|
+
classes: s = "",
|
|
131
|
+
useHtmlLabels: i = !0,
|
|
132
|
+
isNode: r = !0,
|
|
133
|
+
width: a = 200,
|
|
134
|
+
addSvgBackground: c = !1
|
|
135
|
+
} = {}) => {
|
|
136
|
+
if (b.info("createText", t, e, o, s, i, r, c), i) {
|
|
137
|
+
const l = v(t), p = {
|
|
138
|
+
isNode: r,
|
|
139
|
+
label: T(l).replace(
|
|
140
|
+
/fa[blrs]?:fa-[\w-]+/g,
|
|
141
|
+
// cspell: disable-line
|
|
142
|
+
(u) => `<i class='${u.replace(":", " ")}'></i>`
|
|
143
|
+
),
|
|
144
|
+
labelStyle: e.replace("fill:", "color:")
|
|
145
|
+
};
|
|
146
|
+
return R(n, p, a, s, c);
|
|
147
|
+
} else {
|
|
148
|
+
const l = j(t);
|
|
149
|
+
return N(a, n, l, c);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
O as a,
|
|
154
|
+
I as c
|
|
155
|
+
};
|