bg-editor 0.0.1

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.
Files changed (67) hide show
  1. package/LICENSE +8 -0
  2. package/README.md +51 -0
  3. package/README.zh-CN.md +51 -0
  4. package/dist/_basePickBy-4kmg42pS.js +158 -0
  5. package/dist/_baseUniq-WOvvCHTI.js +621 -0
  6. package/dist/arc-wItjmL5I.js +90 -0
  7. package/dist/architecture-U656AL7Q-FYDwFSxk.js +12 -0
  8. package/dist/architectureDiagram-VXUJARFQ-iG5MkBjx.js +4666 -0
  9. package/dist/blockDiagram-VD42YOAC-i2GlXmWy.js +2268 -0
  10. package/dist/c4Diagram-YG6GDRKO-IufO7T1R.js +1587 -0
  11. package/dist/channel-Dah4F59k.js +12 -0
  12. package/dist/chunk-4BX2VUAB-5_v9rnje.js +15 -0
  13. package/dist/chunk-55IACEB6-BDNtSypP.js +15 -0
  14. package/dist/chunk-B4BG7PRW-DzaYPsfW.js +1382 -0
  15. package/dist/chunk-DI55MBZ5-Buwrprkw.js +1377 -0
  16. package/dist/chunk-FMBD7UC4-BaEPEIWb.js +26 -0
  17. package/dist/chunk-QN33PNHL-DhbA7i5G.js +26 -0
  18. package/dist/chunk-QZHKN3VN-BAb_D1oz.js +22 -0
  19. package/dist/chunk-TZMSLE5B-OU1MJ2do.js +71 -0
  20. package/dist/classDiagram-2ON5EDUG-KStC8v09.js +23 -0
  21. package/dist/classDiagram-v2-WZHVMYZB-KStC8v09.js +23 -0
  22. package/dist/clone-C74UiRbr.js +15 -0
  23. package/dist/cose-bilkent-S5V4N54A-eRXCoix2.js +2612 -0
  24. package/dist/cytoscape.esm-BG3R4uVs.js +18738 -0
  25. package/dist/dagre-6UL2VRFP-Bi83jPQf.js +451 -0
  26. package/dist/defaultLocale-DgmhL6Re.js +178 -0
  27. package/dist/diagram-PSM6KHXK-aW98k2-4.js +539 -0
  28. package/dist/diagram-QEK2KX5R-BR--iNM5.js +224 -0
  29. package/dist/diagram-S2PKOQOG-NTnEy5_O.js +149 -0
  30. package/dist/erDiagram-Q2GNP2WA-C8oZ5c-S.js +848 -0
  31. package/dist/flowDiagram-NV44I4VS-DiKad3Bb.js +1627 -0
  32. package/dist/ganttDiagram-LVOFAZNH-CthzjjJq.js +2506 -0
  33. package/dist/gitGraph-F6HP7TQM-CuXAC0XT.js +12 -0
  34. package/dist/gitGraphDiagram-NY62KEGX-d4KszKqi.js +706 -0
  35. package/dist/graph-CnOTx4E0.js +254 -0
  36. package/dist/index-D6-Wf75-.js +122127 -0
  37. package/dist/info-NVLQJR56-Dhmtdc7O.js +12 -0
  38. package/dist/infoDiagram-ER5ION4S-DedidjTu.js +31 -0
  39. package/dist/init-d639unba.js +23 -0
  40. package/dist/journeyDiagram-XKPGCS4Q-BylvmUWL.js +843 -0
  41. package/dist/kanban-definition-3W4ZIXB7-DGV_aVgU.js +725 -0
  42. package/dist/layout-OXk4OSoz.js +1342 -0
  43. package/dist/linear-CO_vz87n.js +266 -0
  44. package/dist/mermaid-parser.core-CYtF6phW.js +12928 -0
  45. package/dist/mindmap-definition-VGOIOE7T-BU05Y6Vz.js +790 -0
  46. package/dist/ordinal-CofNqUw2.js +68 -0
  47. package/dist/packet-BFZMPI3H-D7H_8Q-U.js +12 -0
  48. package/dist/pie-7BOR55EZ-BNWNcO5Z.js +12 -0
  49. package/dist/pieDiagram-ADFJNKIX-reGTUsiW.js +168 -0
  50. package/dist/quadrantDiagram-AYHSOK5B-NeHOJ0lX.js +1029 -0
  51. package/dist/radar-NHE76QYJ-DrVEcvh1.js +12 -0
  52. package/dist/requirementDiagram-UZGBJVZJ-BE76XNaT.js +857 -0
  53. package/dist/sankeyDiagram-TZEHDZUN-UHfMLEKl.js +817 -0
  54. package/dist/sequenceDiagram-WL72ISMW-62KWnVbh.js +2518 -0
  55. package/dist/stateDiagram-FKZM4ZOC--_CkWvu6.js +270 -0
  56. package/dist/stateDiagram-v2-4FDKWEC3-Dj7ZjAmI.js +23 -0
  57. package/dist/style.css +1 -0
  58. package/dist/timeline-definition-IT6M3QCI-C3Wb0xMN.js +804 -0
  59. package/dist/treemap-KMMF4GRG-Bc8F2dFd.js +12 -0
  60. package/dist/umo-editor.js +16 -0
  61. package/dist/xychartDiagram-PRI3JC2R-D2J307cO.js +1347 -0
  62. package/package.json +200 -0
  63. package/types/index.d.ts +277 -0
  64. package/types/src/components/index.d.ts +9 -0
  65. package/types/src/components/menus/button.vue.d.ts +583 -0
  66. package/types/src/components/modal.vue.d.ts +2 -0
  67. package/types/src/components/tooltip.vue.d.ts +27 -0
@@ -0,0 +1,270 @@
1
+ import "./style.css";
2
+ import { s as G, a as W, S as N } from "./chunk-DI55MBZ5-Buwrprkw.js";
3
+ import { _ as f, c as t, d as H, l as S, e as P, k as z, R as _, S as U, O as C, u as F } from "./index-D6-Wf75-.js";
4
+ import { G as O } from "./graph-CnOTx4E0.js";
5
+ import { l as J } from "./layout-OXk4OSoz.js";
6
+ /**
7
+ * @umoteam/editor 9.0.1
8
+ * @license MIT
9
+ * @author umodoc https://www.umodoc.com
10
+ * @see https://www.umodoc.com
11
+ **/
12
+ var X = /* @__PURE__ */ f((e) => e.append("circle").attr("class", "start-state").attr("r", t().state.sizeUnit).attr("cx", t().state.padding + t().state.sizeUnit).attr("cy", t().state.padding + t().state.sizeUnit), "drawStartState"), D = /* @__PURE__ */ f((e) => e.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", t().state.textHeight).attr("class", "divider").attr("x2", t().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider"), Y = /* @__PURE__ */ f((e, i) => {
13
+ const d = e.append("text").attr("x", 2 * t().state.padding).attr("y", t().state.textHeight + 2 * t().state.padding).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.id), c = d.node().getBBox();
14
+ return e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", c.width + 2 * t().state.padding).attr("height", c.height + 2 * t().state.padding).attr("rx", t().state.radius), d;
15
+ }, "drawSimpleState"), I = /* @__PURE__ */ f((e, i) => {
16
+ const d = /* @__PURE__ */ f(function(g, B, m) {
17
+ const E = g.append("tspan").attr("x", 2 * t().state.padding).text(B);
18
+ m || E.attr("dy", t().state.textHeight);
19
+ }, "addTspan"), n = e.append("text").attr("x", 2 * t().state.padding).attr("y", t().state.textHeight + 1.3 * t().state.padding).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.descriptions[0]).node().getBBox(), l = n.height, x = e.append("text").attr("x", t().state.padding).attr(
20
+ "y",
21
+ l + t().state.padding * 0.4 + t().state.dividerMargin + t().state.textHeight
22
+ ).attr("class", "state-description");
23
+ let a = !0, s = !0;
24
+ i.descriptions.forEach(function(g) {
25
+ a || (d(x, g, s), s = !1), a = !1;
26
+ });
27
+ const w = e.append("line").attr("x1", t().state.padding).attr("y1", t().state.padding + l + t().state.dividerMargin / 2).attr("y2", t().state.padding + l + t().state.dividerMargin / 2).attr("class", "descr-divider"), p = x.node().getBBox(), o = Math.max(p.width, n.width);
28
+ return w.attr("x2", o + 3 * t().state.padding), e.insert("rect", ":first-child").attr("x", t().state.padding).attr("y", t().state.padding).attr("width", o + 2 * t().state.padding).attr("height", p.height + l + 2 * t().state.padding).attr("rx", t().state.radius), e;
29
+ }, "drawDescrState"), $ = /* @__PURE__ */ f((e, i, d) => {
30
+ const c = t().state.padding, n = 2 * t().state.padding, l = e.node().getBBox(), x = l.width, a = l.x, s = e.append("text").attr("x", 0).attr("y", t().state.titleShift).attr("font-size", t().state.fontSize).attr("class", "state-title").text(i.id), p = s.node().getBBox().width + n;
31
+ let o = Math.max(p, x);
32
+ o === x && (o = o + n);
33
+ let g;
34
+ const B = e.node().getBBox();
35
+ i.doc, g = a - c, p > x && (g = (x - o) / 2 + c), Math.abs(a - B.x) < c && p > x && (g = a - (p - x) / 2);
36
+ const m = 1 - t().state.textHeight;
37
+ return e.insert("rect", ":first-child").attr("x", g).attr("y", m).attr("class", d ? "alt-composit" : "composit").attr("width", o).attr(
38
+ "height",
39
+ B.height + t().state.textHeight + t().state.titleShift + 1
40
+ ).attr("rx", "0"), s.attr("x", g + c), p <= x && s.attr("x", a + (o - n) / 2 - p / 2 + c), e.insert("rect", ":first-child").attr("x", g).attr(
41
+ "y",
42
+ t().state.titleShift - t().state.textHeight - t().state.padding
43
+ ).attr("width", o).attr("height", t().state.textHeight * 3).attr("rx", t().state.radius), e.insert("rect", ":first-child").attr("x", g).attr(
44
+ "y",
45
+ t().state.titleShift - t().state.textHeight - t().state.padding
46
+ ).attr("width", o).attr("height", B.height + 3 + 2 * t().state.textHeight).attr("rx", t().state.radius), e;
47
+ }, "addTitleAndBox"), q = /* @__PURE__ */ f((e) => (e.append("circle").attr("class", "end-state-outer").attr("r", t().state.sizeUnit + t().state.miniPadding).attr(
48
+ "cx",
49
+ t().state.padding + t().state.sizeUnit + t().state.miniPadding
50
+ ).attr(
51
+ "cy",
52
+ t().state.padding + t().state.sizeUnit + t().state.miniPadding
53
+ ), e.append("circle").attr("class", "end-state-inner").attr("r", t().state.sizeUnit).attr("cx", t().state.padding + t().state.sizeUnit + 2).attr("cy", t().state.padding + t().state.sizeUnit + 2)), "drawEndState"), Z = /* @__PURE__ */ f((e, i) => {
54
+ let d = t().state.forkWidth, c = t().state.forkHeight;
55
+ if (i.parentId) {
56
+ let n = d;
57
+ d = c, c = n;
58
+ }
59
+ return e.append("rect").style("stroke", "black").style("fill", "black").attr("width", d).attr("height", c).attr("x", t().state.padding).attr("y", t().state.padding);
60
+ }, "drawForkJoinState"), j = /* @__PURE__ */ f((e, i, d, c) => {
61
+ let n = 0;
62
+ const l = c.append("text");
63
+ l.style("text-anchor", "start"), l.attr("class", "noteText");
64
+ let x = e.replace(/\r\n/g, "<br/>");
65
+ x = x.replace(/\n/g, "<br/>");
66
+ const a = x.split(z.lineBreakRegex);
67
+ let s = 1.25 * t().state.noteMargin;
68
+ for (const w of a) {
69
+ const p = w.trim();
70
+ if (p.length > 0) {
71
+ const o = l.append("tspan");
72
+ if (o.text(p), s === 0) {
73
+ const g = o.node().getBBox();
74
+ s += g.height;
75
+ }
76
+ n += s, o.attr("x", i + t().state.noteMargin), o.attr("y", d + n + 1.25 * t().state.noteMargin);
77
+ }
78
+ }
79
+ return { textWidth: l.node().getBBox().width, textHeight: n };
80
+ }, "_drawLongText"), K = /* @__PURE__ */ f((e, i) => {
81
+ i.attr("class", "state-note");
82
+ const d = i.append("rect").attr("x", 0).attr("y", t().state.padding), c = i.append("g"), { textWidth: n, textHeight: l } = j(e, 0, 0, c);
83
+ return d.attr("height", l + 2 * t().state.noteMargin), d.attr("width", n + t().state.noteMargin * 2), d;
84
+ }, "drawNote"), L = /* @__PURE__ */ f(function(e, i) {
85
+ const d = i.id, c = {
86
+ id: d,
87
+ label: i.id,
88
+ width: 0,
89
+ height: 0
90
+ }, n = e.append("g").attr("id", d).attr("class", "stateGroup");
91
+ i.type === "start" && X(n), i.type === "end" && q(n), (i.type === "fork" || i.type === "join") && Z(n, i), i.type === "note" && K(i.note.text, n), i.type === "divider" && D(n), i.type === "default" && i.descriptions.length === 0 && Y(n, i), i.type === "default" && i.descriptions.length > 0 && I(n, i);
92
+ const l = n.node().getBBox();
93
+ return c.width = l.width + 2 * t().state.padding, c.height = l.height + 2 * t().state.padding, c;
94
+ }, "drawState"), R = 0, Q = /* @__PURE__ */ f(function(e, i, d) {
95
+ const c = /* @__PURE__ */ f(function(s) {
96
+ switch (s) {
97
+ case N.relationType.AGGREGATION:
98
+ return "aggregation";
99
+ case N.relationType.EXTENSION:
100
+ return "extension";
101
+ case N.relationType.COMPOSITION:
102
+ return "composition";
103
+ case N.relationType.DEPENDENCY:
104
+ return "dependency";
105
+ }
106
+ }, "getRelationType");
107
+ i.points = i.points.filter((s) => !Number.isNaN(s.y));
108
+ const n = i.points, l = _().x(function(s) {
109
+ return s.x;
110
+ }).y(function(s) {
111
+ return s.y;
112
+ }).curve(U), x = e.append("path").attr("d", l(n)).attr("id", "edge" + R).attr("class", "transition");
113
+ let a = "";
114
+ if (t().state.arrowMarkerAbsolute && (a = C(!0)), x.attr(
115
+ "marker-end",
116
+ "url(" + a + "#" + c(N.relationType.DEPENDENCY) + "End)"
117
+ ), d.title !== void 0) {
118
+ const s = e.append("g").attr("class", "stateLabel"), { x: w, y: p } = F.calcLabelPosition(i.points), o = z.getRows(d.title);
119
+ let g = 0;
120
+ const B = [];
121
+ let m = 0, E = 0;
122
+ for (let u = 0; u <= o.length; u++) {
123
+ const h = s.append("text").attr("text-anchor", "middle").text(o[u]).attr("x", w).attr("y", p + g), y = h.node().getBBox();
124
+ m = Math.max(m, y.width), E = Math.min(E, y.x), S.info(y.x, w, p + g), g === 0 && (g = h.node().getBBox().height, S.info("Title height", g, p)), B.push(h);
125
+ }
126
+ let k = g * o.length;
127
+ if (o.length > 1) {
128
+ const u = (o.length - 1) * g * 0.5;
129
+ B.forEach((h, y) => h.attr("y", p + y * g - u)), k = g * o.length;
130
+ }
131
+ const r = s.node().getBBox();
132
+ s.insert("rect", ":first-child").attr("class", "box").attr("x", w - m / 2 - t().state.padding / 2).attr("y", p - k / 2 - t().state.padding / 2 - 3.5).attr("width", m + t().state.padding).attr("height", k + t().state.padding), S.info(r);
133
+ }
134
+ R++;
135
+ }, "drawEdge"), b, T = {}, V = /* @__PURE__ */ f(function() {
136
+ }, "setConf"), tt = /* @__PURE__ */ f(function(e) {
137
+ e.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 19,7 L9,13 L14,7 L9,1 Z");
138
+ }, "insertMarkers"), et = /* @__PURE__ */ f(function(e, i, d, c) {
139
+ b = t().state;
140
+ const n = t().securityLevel;
141
+ let l;
142
+ n === "sandbox" && (l = H("#i" + i));
143
+ const x = n === "sandbox" ? H(l.nodes()[0].contentDocument.body) : H("body"), a = n === "sandbox" ? l.nodes()[0].contentDocument : document;
144
+ S.debug("Rendering diagram " + e);
145
+ const s = x.select(`[id='${i}']`);
146
+ tt(s);
147
+ const w = c.db.getRootDoc();
148
+ A(w, s, void 0, !1, x, a, c);
149
+ const p = b.padding, o = s.node().getBBox(), g = o.width + p * 2, B = o.height + p * 2, m = g * 1.75;
150
+ P(s, B, m, b.useMaxWidth), s.attr(
151
+ "viewBox",
152
+ `${o.x - b.padding} ${o.y - b.padding} ` + g + " " + B
153
+ );
154
+ }, "draw"), at = /* @__PURE__ */ f((e) => e ? e.length * b.fontSizeFactor : 1, "getLabelWidth"), A = /* @__PURE__ */ f((e, i, d, c, n, l, x) => {
155
+ const a = new O({
156
+ compound: !0,
157
+ multigraph: !0
158
+ });
159
+ let s, w = !0;
160
+ for (s = 0; s < e.length; s++)
161
+ if (e[s].stmt === "relation") {
162
+ w = !1;
163
+ break;
164
+ }
165
+ d ? a.setGraph({
166
+ rankdir: "LR",
167
+ multigraph: !0,
168
+ compound: !0,
169
+ // acyclicer: 'greedy',
170
+ ranker: "tight-tree",
171
+ ranksep: w ? 1 : b.edgeLengthFactor,
172
+ nodeSep: w ? 1 : 50,
173
+ isMultiGraph: !0
174
+ // ranksep: 5,
175
+ // nodesep: 1
176
+ }) : a.setGraph({
177
+ rankdir: "TB",
178
+ multigraph: !0,
179
+ compound: !0,
180
+ // isCompound: true,
181
+ // acyclicer: 'greedy',
182
+ // ranker: 'longest-path'
183
+ ranksep: w ? 1 : b.edgeLengthFactor,
184
+ nodeSep: w ? 1 : 50,
185
+ ranker: "tight-tree",
186
+ // ranker: 'network-simplex'
187
+ isMultiGraph: !0
188
+ }), a.setDefaultEdgeLabel(function() {
189
+ return {};
190
+ });
191
+ const p = x.db.getStates(), o = x.db.getRelations(), g = Object.keys(p);
192
+ for (const r of g) {
193
+ const u = p[r];
194
+ d && (u.parentId = d);
195
+ let h;
196
+ if (u.doc) {
197
+ let y = i.append("g").attr("id", u.id).attr("class", "stateGroup");
198
+ h = A(u.doc, y, u.id, !c, n, l, x);
199
+ {
200
+ y = $(y, u, c);
201
+ let v = y.node().getBBox();
202
+ h.width = v.width, h.height = v.height + b.padding / 2, T[u.id] = { y: b.compositTitleSize };
203
+ }
204
+ } else
205
+ h = L(i, u, a);
206
+ if (u.note) {
207
+ const y = {
208
+ descriptions: [],
209
+ id: u.id + "-note",
210
+ note: u.note,
211
+ type: "note"
212
+ }, v = L(i, y, a);
213
+ u.note.position === "left of" ? (a.setNode(h.id + "-note", v), a.setNode(h.id, h)) : (a.setNode(h.id, h), a.setNode(h.id + "-note", v)), a.setParent(h.id, h.id + "-group"), a.setParent(h.id + "-note", h.id + "-group");
214
+ } else
215
+ a.setNode(h.id, h);
216
+ }
217
+ S.debug("Count=", a.nodeCount(), a);
218
+ let B = 0;
219
+ o.forEach(function(r) {
220
+ B++, S.debug("Setting edge", r), a.setEdge(
221
+ r.id1,
222
+ r.id2,
223
+ {
224
+ relation: r,
225
+ width: at(r.title),
226
+ height: b.labelHeight * z.getRows(r.title).length,
227
+ labelpos: "c"
228
+ },
229
+ "id" + B
230
+ );
231
+ }), J(a), S.debug("Graph after layout", a.nodes());
232
+ const m = i.node();
233
+ a.nodes().forEach(function(r) {
234
+ r !== void 0 && a.node(r) !== void 0 ? (S.warn("Node " + r + ": " + JSON.stringify(a.node(r))), n.select("#" + m.id + " #" + r).attr(
235
+ "transform",
236
+ "translate(" + (a.node(r).x - a.node(r).width / 2) + "," + (a.node(r).y + (T[r] ? T[r].y : 0) - a.node(r).height / 2) + " )"
237
+ ), n.select("#" + m.id + " #" + r).attr("data-x-shift", a.node(r).x - a.node(r).width / 2), l.querySelectorAll("#" + m.id + " #" + r + " .divider").forEach((h) => {
238
+ const y = h.parentElement;
239
+ let v = 0, M = 0;
240
+ y && (y.parentElement && (v = y.parentElement.getBBox().width), M = parseInt(y.getAttribute("data-x-shift"), 10), Number.isNaN(M) && (M = 0)), h.setAttribute("x1", 0 - M + 8), h.setAttribute("x2", v - M - 8);
241
+ })) : S.debug("No Node " + r + ": " + JSON.stringify(a.node(r)));
242
+ });
243
+ let E = m.getBBox();
244
+ a.edges().forEach(function(r) {
245
+ r !== void 0 && a.edge(r) !== void 0 && (S.debug("Edge " + r.v + " -> " + r.w + ": " + JSON.stringify(a.edge(r))), Q(i, a.edge(r), a.edge(r).relation));
246
+ }), E = m.getBBox();
247
+ const k = {
248
+ id: d || "root",
249
+ label: d || "root",
250
+ width: 0,
251
+ height: 0
252
+ };
253
+ return k.width = E.width + 2 * b.padding, k.height = E.height + 2 * b.padding, S.debug("Doc rendered", k, a), k;
254
+ }, "renderDoc"), it = {
255
+ setConf: V,
256
+ draw: et
257
+ }, ct = {
258
+ parser: W,
259
+ get db() {
260
+ return new N(1);
261
+ },
262
+ renderer: it,
263
+ styles: G,
264
+ init: /* @__PURE__ */ f((e) => {
265
+ e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute;
266
+ }, "init")
267
+ };
268
+ export {
269
+ ct as diagram
270
+ };
@@ -0,0 +1,23 @@
1
+ import "./style.css";
2
+ import { s as t, b as a, a as r, S as s } from "./chunk-DI55MBZ5-Buwrprkw.js";
3
+ import { _ as i } from "./index-D6-Wf75-.js";
4
+ /**
5
+ * @umoteam/editor 9.0.1
6
+ * @license MIT
7
+ * @author umodoc https://www.umodoc.com
8
+ * @see https://www.umodoc.com
9
+ **/
10
+ var _ = {
11
+ parser: r,
12
+ get db() {
13
+ return new s(2);
14
+ },
15
+ renderer: a,
16
+ styles: t,
17
+ init: /* @__PURE__ */ i((e) => {
18
+ e.state || (e.state = {}), e.state.arrowMarkerAbsolute = e.arrowMarkerAbsolute;
19
+ }, "init")
20
+ };
21
+ export {
22
+ _ as diagram
23
+ };