@layers-app/editor 0.0.22 → 0.0.25

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 (242) hide show
  1. package/README.md +47 -2
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.d.ts +11 -43
  4. package/dist/index.js +2 -2
  5. package/dist/layers.07qQUlOx.js +11 -0
  6. package/dist/layers.0Uws2RMI.js +96 -0
  7. package/dist/layers.2klZ3piU.js +36 -0
  8. package/dist/layers.3O2dWJo4.js +1 -0
  9. package/dist/layers.3VppN-FK.js +423 -0
  10. package/dist/layers.3cmQBPRD.js +1 -0
  11. package/dist/layers.5U29QNMz.js +7 -0
  12. package/dist/layers.5s_bUFw7.js +8 -0
  13. package/dist/layers.7JqFgE4-.js +15 -0
  14. package/dist/layers.8dwcxQd3.js +8 -0
  15. package/dist/layers.9EMwI8Xs.js +425 -0
  16. package/dist/layers.9QK1wiQj.js +1 -0
  17. package/dist/layers.9pNaFvaX.js +1 -0
  18. package/dist/layers.9tX9hjoM.js +11692 -0
  19. package/dist/layers.B-eOoyQV.js +9128 -0
  20. package/dist/layers.B-hOwYRy.js +33 -0
  21. package/dist/layers.B0LHiU6c.js +10 -0
  22. package/dist/layers.B19hGmey.js +1 -0
  23. package/dist/layers.B1psjxfg.js +8 -0
  24. package/dist/layers.B1tTFwlU.js +5 -0
  25. package/dist/layers.B3NaBxHH.js +11 -0
  26. package/dist/layers.B43rvwKV.js +790 -0
  27. package/dist/layers.B7wN1gyM.js +35 -0
  28. package/dist/layers.B9ocXRVO.js +1 -0
  29. package/dist/layers.BAWbBe9N.js +42 -0
  30. package/dist/layers.BAaIrX5p.js +1 -0
  31. package/dist/layers.BAnc8Y8B.js +118 -0
  32. package/dist/layers.BAtv1CM7.js +1 -0
  33. package/dist/layers.BB7ssac6.js +50 -0
  34. package/dist/layers.BBm66jcD.js +70 -0
  35. package/dist/layers.BGF0mJI-.js +10 -0
  36. package/dist/layers.BIDnkNut.js +1510 -0
  37. package/dist/layers.BIeVwYKL.js +1 -0
  38. package/dist/layers.BJ2qg5fe.js +39 -0
  39. package/dist/layers.BK4BzYSQ.js +10 -0
  40. package/dist/layers.BKoRqbkc.js +4 -0
  41. package/dist/layers.BLvgQy3M.js +40 -0
  42. package/dist/layers.BNEX6ffl.js +1 -0
  43. package/dist/layers.BOEB6DhN.js +202 -0
  44. package/dist/layers.BOdIgbDK.js +233 -0
  45. package/dist/layers.BPTiALoi.js +19 -0
  46. package/dist/layers.BQHgH0c0.js +1 -0
  47. package/dist/layers.BQUkW6Sr.js +41 -0
  48. package/dist/layers.BQdiT-Gc.js +6 -0
  49. package/dist/layers.BSTBZrFn.js +1 -0
  50. package/dist/layers.BW8tNgnl.js +32 -0
  51. package/dist/layers.BWBOjwnD.js +9 -0
  52. package/dist/layers.BWBqFzL5.js +1083 -0
  53. package/dist/layers.BY_Ddtf_.js +257 -0
  54. package/dist/layers.BYzN4Zxz.js +7 -0
  55. package/dist/layers.B_3SG9-n.js +5 -0
  56. package/dist/layers.Bag9ck5N.js +1 -0
  57. package/dist/layers.Bgs9DWaM.js +160 -0
  58. package/dist/layers.BhjPgUp1.js +40 -0
  59. package/dist/layers.Bjqq928v.js +11 -0
  60. package/dist/layers.Bk3rEvTi.js +39 -0
  61. package/dist/layers.BlRFAeMZ.js +501 -0
  62. package/dist/layers.BlifjyLs.js +2 -0
  63. package/dist/layers.BlkvO94n.js +41 -0
  64. package/dist/layers.Bm4nXd83.js +2963 -0
  65. package/dist/layers.BmU3A8To.js +1 -0
  66. package/dist/layers.Bn8N2Stv.js +10 -0
  67. package/dist/layers.BpilXLfW.js +6 -0
  68. package/dist/layers.BqTvq1WO.js +38 -0
  69. package/dist/layers.BtP6vWIY.js +1 -0
  70. package/dist/layers.Bu0Rv7u8.js +9 -0
  71. package/dist/layers.BuJozguU.js +32 -0
  72. package/dist/layers.Bw3R-pSG.js +61 -0
  73. package/dist/layers.BwcyrXEu.js +39 -0
  74. package/dist/layers.Bwuu3jjm.js +3 -0
  75. package/dist/layers.BymWa7M3.js +11 -0
  76. package/dist/layers.BzRmHQQD.js +320 -0
  77. package/dist/layers.Bzc44mb4.js +36 -0
  78. package/dist/layers.C2b0BhoA.js +34 -0
  79. package/dist/layers.C3vT-_5E.js +42 -0
  80. package/dist/layers.C4L1zUgG.js +39 -0
  81. package/dist/layers.C6qRV0pD.js +9 -0
  82. package/dist/layers.C7_Otsyx.js +52 -0
  83. package/dist/layers.C7lIplJU.js +247 -0
  84. package/dist/layers.C8r5QjFY.js +2 -0
  85. package/dist/layers.C9vJr9Fp.js +769 -0
  86. package/dist/layers.CBAObrHU.js +1 -0
  87. package/dist/layers.CHZsXQcr.js +1 -0
  88. package/dist/layers.CHd51QJn.js +8 -0
  89. package/dist/layers.CI7Z-Sjj.js +9 -0
  90. package/dist/layers.CJudskXr.js +803 -0
  91. package/dist/layers.CLPJWTr_.js +1 -0
  92. package/dist/layers.CM0RbG9c.js +4 -0
  93. package/dist/layers.CNml1ojC.js +7 -0
  94. package/dist/layers.COAF7f8g.js +1 -0
  95. package/dist/{layers.CiSw1oA4.js → layers.CPPtpAVe.js} +1 -1
  96. package/dist/layers.CPqqkX8Z.js +23 -0
  97. package/dist/layers.CPtjfATq.js +40 -0
  98. package/dist/layers.CRVVTbRr.js +39 -0
  99. package/dist/layers.CRuKN3by.js +84 -0
  100. package/dist/layers.CSAdHZgs.js +1 -0
  101. package/dist/layers.CSy8D72I.js +40 -0
  102. package/dist/layers.CV_r6tXx.js +48146 -0
  103. package/dist/layers.CVlRuvNG.js +122 -0
  104. package/dist/layers.CWWJnwM1.js +39 -0
  105. package/dist/layers.CYPKJ9D_.js +39 -0
  106. package/dist/layers.CZ9asRxp.js +10 -0
  107. package/dist/layers.CctQZdRR.js +40 -0
  108. package/dist/layers.Cdw06C7D.js +2 -0
  109. package/dist/layers.Ce8BBqO9.js +139 -0
  110. package/dist/layers.CfVH6j0d.js +9 -0
  111. package/dist/layers.CfyH4z2e.js +39 -0
  112. package/dist/layers.CgdtQipl.js +207 -0
  113. package/dist/layers.CgvOUVzr.js +14 -0
  114. package/dist/layers.ChkOb4tl.js +960 -0
  115. package/dist/layers.Cj6cbW8i.js +2235 -0
  116. package/dist/layers.Cj7ITJ9c.js +1 -0
  117. package/dist/layers.CjRpPAKZ.js +1580 -0
  118. package/dist/{layers.C5tfzl26.js → layers.CjfoYqS0.js} +1 -1
  119. package/dist/layers.Ckd9L1ZQ.js +5 -0
  120. package/dist/layers.ClpTV2lw.js +1 -0
  121. package/dist/layers.CmEuIxO4.js +373 -0
  122. package/dist/layers.CmOPFjvq.js +9 -0
  123. package/dist/layers.CnlX6j6i.js +40 -0
  124. package/dist/layers.CqEtGCpU.js +40 -0
  125. package/dist/layers.CqMLQ0Dp.js +37 -0
  126. package/dist/layers.CqVTtuYm.js +6 -0
  127. package/dist/layers.CuxIZWEP.js +5 -0
  128. package/dist/layers.CvLOVBUw.js +40 -0
  129. package/dist/layers.Cx6FqSsI.js +11 -0
  130. package/dist/layers.CyUKOqQM.js +40 -0
  131. package/dist/layers.CzsxLGGT.js +8 -0
  132. package/dist/layers.D0yiFcqY.js +37 -0
  133. package/dist/layers.D0zn4_Mx.js +1 -0
  134. package/dist/layers.D1fmxxk7.js +1 -0
  135. package/dist/layers.D39cRqm0.js +8 -0
  136. package/dist/layers.D4fGb2cV.js +1272 -0
  137. package/dist/layers.D6ec9SRH.js +41 -0
  138. package/dist/layers.D71p3EhU.js +10 -0
  139. package/dist/layers.D7jGxypv.js +8 -0
  140. package/dist/layers.D8G_zttU.js +795 -0
  141. package/dist/layers.D8NjLtRn.js +8 -0
  142. package/dist/layers.DAkVONDW.js +21478 -0
  143. package/dist/layers.DDE-iai2.js +931 -0
  144. package/dist/layers.DDGV6wvn.js +10 -0
  145. package/dist/layers.DDPm1Phd.js +7 -0
  146. package/dist/layers.DFdD8OE6.js +5 -0
  147. package/dist/layers.DGC-QZbD.js +904 -0
  148. package/dist/layers.DH6JhdxT.js +35 -0
  149. package/dist/layers.DHNgS4o3.js +1 -0
  150. package/dist/layers.DHYQaKXy.js +35 -0
  151. package/dist/layers.DKTUd6cG.js +32 -0
  152. package/dist/layers.DLShWbE3.js +32 -0
  153. package/dist/layers.DLwuMfdd.js +84 -0
  154. package/dist/layers.DMkBISW1.js +1 -0
  155. package/dist/layers.DMnBSepD.js +7 -0
  156. package/dist/layers.DN2-RoYO.js +6 -0
  157. package/dist/layers.DN9HoVxI.js +18 -0
  158. package/dist/layers.DNvn8evO.js +8 -0
  159. package/dist/layers.DOrgOHBr.js +1 -0
  160. package/dist/layers.DPpl1Lyy.js +1283 -0
  161. package/dist/layers.DQevQguw.js +1034 -0
  162. package/dist/layers.DRGcrPPV.js +1126 -0
  163. package/dist/layers.DS8xp3z6.js +32 -0
  164. package/dist/layers.DT2vhESJ.js +4 -0
  165. package/dist/layers.DTSzGsqB.js +6 -0
  166. package/dist/layers.DTX-m6B0.js +41 -0
  167. package/dist/layers.DUgI8Qm6.js +1 -0
  168. package/dist/layers.DUt_7Rf9.js +261 -0
  169. package/dist/layers.DX5uxco3.js +6 -0
  170. package/dist/layers.DYoOWsyB.js +42 -0
  171. package/dist/layers.DZVs6rl-.js +65 -0
  172. package/dist/layers.DZxo3Qo-.js +37 -0
  173. package/dist/layers.DaNHv_tD.js +7 -0
  174. package/dist/layers.DbSjlXkz.js +10 -0
  175. package/dist/layers.DbaKVP5e.js +1 -0
  176. package/dist/layers.Dc_OXuAO.js +38 -0
  177. package/dist/layers.Dg4aFQbj.js +41 -0
  178. package/dist/layers.Dh8vVrkJ.js +38 -0
  179. package/dist/layers.DhaEWWE8.js +32 -0
  180. package/dist/layers.DhiiM0nu.js +6 -0
  181. package/dist/layers.Dj1RvABZ.js +9 -0
  182. package/dist/layers.DjUOC4st.js +16 -0
  183. package/dist/layers.DnhB9nfo.js +51 -0
  184. package/dist/layers.Dp_lp9sc.js +164 -0
  185. package/dist/layers.DpoqH_qu.js +36 -0
  186. package/dist/layers.Ds95POLS.js +1 -0
  187. package/dist/{layers.3lVEeOO7.js → layers.DtYpqqY0.js} +92 -92
  188. package/dist/layers.Dtt8if_X.js +9 -0
  189. package/dist/layers.Du5-W3Rw.js +186 -0
  190. package/dist/layers.Dv3wcPBB.js +1 -0
  191. package/dist/layers.DvVe2_B8.js +116 -0
  192. package/dist/layers.Dw80oYJ5.js +44 -0
  193. package/dist/layers.Dx5bTjWn.js +33 -0
  194. package/dist/layers.DxA6ocdw.js +70 -0
  195. package/dist/layers.Dy1naDTQ.js +14 -0
  196. package/dist/layers.DyUhnefH.js +1089 -0
  197. package/dist/layers.EqE20WDv.js +10 -0
  198. package/dist/{layers.CgiGa2Ym.js → layers.GO-Mbd7I.js} +38 -38
  199. package/dist/layers.HRFT_ZjM.js +268 -0
  200. package/dist/layers.JWCLFILJ.js +1 -0
  201. package/dist/layers.KCNY5y8z.js +37 -0
  202. package/dist/layers.KFKejNxr.js +41 -0
  203. package/dist/layers.LBCOqtdP.js +1 -0
  204. package/dist/layers.MYNPCNPb.js +1359 -0
  205. package/dist/layers.Mz6hy1ns.js +804 -0
  206. package/dist/layers.NnXYAx13.js +2479 -0
  207. package/dist/layers.O_QfH9Tw.js +55 -0
  208. package/dist/layers.PrN0U_UM.js +4 -0
  209. package/dist/layers.Q4CIFfze.js +1 -0
  210. package/dist/layers.R44OAZRP.js +40 -0
  211. package/dist/layers.SP95Qof2.js +9 -0
  212. package/dist/layers.SulLxOdh.js +1 -0
  213. package/dist/layers.T0eE6tga.js +42 -0
  214. package/dist/layers.UHP1RD2c.js +21836 -0
  215. package/dist/layers.UVNd1xGx.js +1265 -0
  216. package/dist/layers.WoRsWqkn.js +139 -0
  217. package/dist/layers.Xe8jbEny.js +39 -0
  218. package/dist/layers.ZN4JdEjx.js +7 -0
  219. package/dist/layers.ZYL9xgWP.js +6 -0
  220. package/dist/layers._hbnQs16.js +434 -0
  221. package/dist/layers.b0h5ZBmD.js +61 -0
  222. package/dist/layers.dRKtVcxx.js +41 -0
  223. package/dist/layers.eMCYstYw.js +7 -0
  224. package/dist/layers.eT0cgnuX.js +84 -0
  225. package/dist/layers.iE9hmQyV.js +1619 -0
  226. package/dist/layers.iRxcG0YN.js +9 -0
  227. package/dist/layers.kyTkLvwr.js +7 -0
  228. package/dist/layers.lCpg7dOn.js +21 -0
  229. package/dist/{layers.C9PaWLCY.js → layers.otSGVgrf.js} +10384 -11287
  230. package/dist/layers.pAr6m-ST.js +41 -0
  231. package/dist/layers.qxHQ5s48.js +8 -0
  232. package/dist/layers.qzkyQd0J.js +198 -0
  233. package/dist/layers.rB_UamkL.js +36 -0
  234. package/dist/layers.vK-UofJJ.js +8 -0
  235. package/dist/layers.vfmwTFt7.js +10 -0
  236. package/dist/layers.vrKjaGL3.js +13 -0
  237. package/dist/layers.wXI8z3zK.js +1 -0
  238. package/dist/layers.z_R2M9xA.js +42 -0
  239. package/dist/layers.zleGKGQR.js +220 -0
  240. package/dist/layers.zx6fFkwC.js +1 -0
  241. package/package.json +5 -7
  242. package/dist/layers.Dq4kf1xY.js +0 -164
@@ -0,0 +1,220 @@
1
+ import { s as A, d as S, p as G } from "./layers.DyUhnefH.js";
2
+ import { g as v, l as y, d as B, e as W, r as $, u as M, X as I } from "./layers.B-eOoyQV.js";
3
+ import "lodash-es";
4
+ import { l as X } from "./layers.D4fGb2cV.js";
5
+ import { G as O } from "./layers.C7lIplJU.js";
6
+ import "./layers.DAkVONDW.js";
7
+ import { l as P } from "./layers.Dx5bTjWn.js";
8
+ let H = 0;
9
+ const Y = function(i, a, t, o, p) {
10
+ const g = function(e) {
11
+ switch (e) {
12
+ case p.db.relationType.AGGREGATION:
13
+ return "aggregation";
14
+ case p.db.relationType.EXTENSION:
15
+ return "extension";
16
+ case p.db.relationType.COMPOSITION:
17
+ return "composition";
18
+ case p.db.relationType.DEPENDENCY:
19
+ return "dependency";
20
+ case p.db.relationType.LOLLIPOP:
21
+ return "lollipop";
22
+ }
23
+ };
24
+ a.points = a.points.filter((e) => !Number.isNaN(e.y));
25
+ const s = a.points, c = P().x(function(e) {
26
+ return e.x;
27
+ }).y(function(e) {
28
+ return e.y;
29
+ }).curve($), n = i.append("path").attr("d", c(s)).attr("id", "edge" + H).attr("class", "relation");
30
+ let r = "";
31
+ 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(
32
+ "marker-start",
33
+ "url(" + r + "#" + g(t.relation.type1) + "Start)"
34
+ ), t.relation.type2 !== "none" && n.attr(
35
+ "marker-end",
36
+ "url(" + r + "#" + g(t.relation.type2) + "End)"
37
+ );
38
+ let f, h;
39
+ const x = a.points.length;
40
+ let b = M.calcLabelPosition(a.points);
41
+ f = b.x, h = b.y;
42
+ let u, m, w, k;
43
+ if (x % 2 !== 0 && x > 1) {
44
+ let e = M.calcCardinalityPosition(
45
+ t.relation.type1 !== "none",
46
+ a.points,
47
+ a.points[0]
48
+ ), d = M.calcCardinalityPosition(
49
+ t.relation.type2 !== "none",
50
+ a.points,
51
+ a.points[x - 1]
52
+ );
53
+ 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;
54
+ }
55
+ if (t.title !== void 0) {
56
+ 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);
57
+ window.label = d;
58
+ const l = d.node().getBBox();
59
+ 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);
60
+ }
61
+ 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++;
62
+ }, J = function(i, a, t, o) {
63
+ y.debug("Rendering class ", a, t);
64
+ const p = a.id, g = {
65
+ id: p,
66
+ label: a.id,
67
+ width: 0,
68
+ height: 0
69
+ }, s = i.append("g").attr("id", o.db.lookUpDomId(p)).attr("class", "classGroup");
70
+ let c;
71
+ 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);
72
+ let n = !0;
73
+ a.annotations.forEach(function(d) {
74
+ const l = c.append("tspan").text("«" + d + "»");
75
+ n || l.attr("dy", t.textHeight), n = !1;
76
+ });
77
+ let r = C(a);
78
+ const f = c.append("tspan").text(r).attr("class", "title");
79
+ n || f.attr("dy", t.textHeight);
80
+ const h = c.node().getBBox().height;
81
+ let x, b, u;
82
+ if (a.members.length > 0) {
83
+ x = s.append("line").attr("x1", 0).attr("y1", t.padding + h + t.dividerMargin / 2).attr("y2", t.padding + h + t.dividerMargin / 2);
84
+ const d = s.append("text").attr("x", t.padding).attr("y", h + t.dividerMargin + t.textHeight).attr("fill", "white").attr("class", "classText");
85
+ n = !0, a.members.forEach(function(l) {
86
+ _(d, l, n, t), n = !1;
87
+ }), b = d.node().getBBox();
88
+ }
89
+ if (a.methods.length > 0) {
90
+ 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);
91
+ 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");
92
+ n = !0, a.methods.forEach(function(l) {
93
+ _(d, l, n, t), n = !1;
94
+ });
95
+ }
96
+ const m = s.node().getBBox();
97
+ var w = " ";
98
+ a.cssClasses.length > 0 && (w = w + a.cssClasses.join(" "));
99
+ 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;
100
+ return c.node().childNodes.forEach(function(d) {
101
+ d.setAttribute("x", (e - d.getBBox().width) / 2);
102
+ }), 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;
103
+ }, C = function(i) {
104
+ let a = i.id;
105
+ return i.type && (a += "<" + I(i.type) + ">"), a;
106
+ }, Z = function(i, a, t, o) {
107
+ y.debug("Rendering note ", a, t);
108
+ const p = a.id, g = {
109
+ id: p,
110
+ text: a.text,
111
+ width: 0,
112
+ height: 0
113
+ }, s = i.append("g").attr("id", p).attr("class", "classGroup");
114
+ let c = s.append("text").attr("y", t.textHeight + t.padding).attr("x", 0);
115
+ const n = JSON.parse(`"${a.text}"`).split(`
116
+ `);
117
+ n.forEach(function(x) {
118
+ y.debug(`Adding line: ${x}`), c.append("tspan").text(x).attr("class", "title").attr("dy", t.textHeight);
119
+ });
120
+ 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(
121
+ "height",
122
+ r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin
123
+ ).node().getBBox().width;
124
+ return c.node().childNodes.forEach(function(x) {
125
+ x.setAttribute("x", (h - x.getBBox().width) / 2);
126
+ }), g.width = h, g.height = r.height + n.length * t.textHeight + t.padding + 0.5 * t.dividerMargin, g;
127
+ }, _ = function(i, a, t, o) {
128
+ const { displayText: p, cssStyle: g } = a.getDisplayDetails(), s = i.append("tspan").attr("x", o.padding).text(p);
129
+ g !== "" && s.attr("style", a.cssStyle), t || s.attr("dy", o.textHeight);
130
+ }, N = {
131
+ getClassTitleString: C,
132
+ drawClass: J,
133
+ drawEdge: Y,
134
+ drawNote: Z
135
+ };
136
+ let T = {};
137
+ const E = 20, L = function(i) {
138
+ const a = Object.entries(T).find((t) => t[1].label === i);
139
+ if (a)
140
+ return a[0];
141
+ }, R = function(i) {
142
+ 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");
143
+ }, F = function(i, a, t, o) {
144
+ const p = v().class;
145
+ T = {}, y.info("Rendering diagram " + i);
146
+ const g = v().securityLevel;
147
+ let s;
148
+ g === "sandbox" && (s = B("#i" + a));
149
+ const c = g === "sandbox" ? B(s.nodes()[0].contentDocument.body) : B("body"), n = c.select(`[id='${a}']`);
150
+ R(n);
151
+ const r = new O({
152
+ multigraph: !0
153
+ });
154
+ r.setGraph({
155
+ isMultiGraph: !0
156
+ }), r.setDefaultEdgeLabel(function() {
157
+ return {};
158
+ });
159
+ const f = o.db.getClasses(), h = Object.keys(f);
160
+ for (const e of h) {
161
+ const d = f[e], l = N.drawClass(n, d, p, o);
162
+ T[l.id] = l, r.setNode(l.id, l), y.info("Org height: " + l.height);
163
+ }
164
+ o.db.getRelations().forEach(function(e) {
165
+ y.info(
166
+ // cspell:ignore tjoho
167
+ "tjoho" + L(e.id1) + L(e.id2) + JSON.stringify(e)
168
+ ), r.setEdge(
169
+ L(e.id1),
170
+ L(e.id2),
171
+ {
172
+ relation: e
173
+ },
174
+ e.title || "DEFAULT"
175
+ );
176
+ }), o.db.getNotes().forEach(function(e) {
177
+ y.debug(`Adding note: ${JSON.stringify(e)}`);
178
+ const d = N.drawNote(n, e, p, o);
179
+ T[d.id] = d, r.setNode(d.id, d), e.class && e.class in f && r.setEdge(
180
+ e.id,
181
+ L(e.class),
182
+ {
183
+ relation: {
184
+ id1: e.id,
185
+ id2: e.class,
186
+ relation: {
187
+ type1: "none",
188
+ type2: "none",
189
+ lineType: 10
190
+ }
191
+ }
192
+ },
193
+ "DEFAULT"
194
+ );
195
+ }), X(r), r.nodes().forEach(function(e) {
196
+ 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(
197
+ "transform",
198
+ "translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
199
+ ));
200
+ }), r.edges().forEach(function(e) {
201
+ 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));
202
+ });
203
+ const u = n.node().getBBox(), m = u.width + E * 2, w = u.height + E * 2;
204
+ W(n, w, m, p.useMaxWidth);
205
+ const k = `${u.x - E} ${u.y - E} ${m} ${w}`;
206
+ y.debug(`viewBox ${k}`), n.attr("viewBox", k);
207
+ }, U = {
208
+ draw: F
209
+ }, tt = {
210
+ parser: G,
211
+ db: S,
212
+ renderer: U,
213
+ styles: A,
214
+ init: (i) => {
215
+ i.class || (i.class = {}), i.class.arrowMarkerAbsolute = i.arrowMarkerAbsolute, S.clear();
216
+ }
217
+ };
218
+ export {
219
+ tt as diagram
220
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./layers.CgdtQipl.js"),t=require("./layers.0Uws2RMI.js");require("lodash-es");const z=require("./layers.COAF7f8g.js"),T=require("./layers.9QK1wiQj.js");require("./layers.qzkyQd0J.js");const L=require("./layers.BtP6vWIY.js"),P=e=>e.append("circle").attr("class","start-state").attr("r",t.getConfig().state.sizeUnit).attr("cx",t.getConfig().state.padding+t.getConfig().state.sizeUnit).attr("cy",t.getConfig().state.padding+t.getConfig().state.sizeUnit),A=e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t.getConfig().state.textHeight).attr("class","divider").attr("x2",t.getConfig().state.textHeight*2).attr("y1",0).attr("y2",0),G=(e,n)=>{const r=e.append("text").attr("x",2*t.getConfig().state.padding).attr("y",t.getConfig().state.textHeight+2*t.getConfig().state.padding).attr("font-size",t.getConfig().state.fontSize).attr("class","state-title").text(n.id),d=r.node().getBBox();return e.insert("rect",":first-child").attr("x",t.getConfig().state.padding).attr("y",t.getConfig().state.padding).attr("width",d.width+2*t.getConfig().state.padding).attr("height",d.height+2*t.getConfig().state.padding).attr("rx",t.getConfig().state.radius),r},W=(e,n)=>{const r=function(c,w,y){const S=c.append("tspan").attr("x",2*t.getConfig().state.padding).text(w);y||S.attr("dy",t.getConfig().state.textHeight)},a=e.append("text").attr("x",2*t.getConfig().state.padding).attr("y",t.getConfig().state.textHeight+1.3*t.getConfig().state.padding).attr("font-size",t.getConfig().state.fontSize).attr("class","state-title").text(n.descriptions[0]).node().getBBox(),l=a.height,f=e.append("text").attr("x",t.getConfig().state.padding).attr("y",l+t.getConfig().state.padding*.4+t.getConfig().state.dividerMargin+t.getConfig().state.textHeight).attr("class","state-description");let i=!0,s=!0;n.descriptions.forEach(function(c){i||(r(f,c,s),s=!1),i=!1});const C=e.append("line").attr("x1",t.getConfig().state.padding).attr("y1",t.getConfig().state.padding+l+t.getConfig().state.dividerMargin/2).attr("y2",t.getConfig().state.padding+l+t.getConfig().state.dividerMargin/2).attr("class","descr-divider"),p=f.node().getBBox(),g=Math.max(p.width,a.width);return C.attr("x2",g+3*t.getConfig().state.padding),e.insert("rect",":first-child").attr("x",t.getConfig().state.padding).attr("y",t.getConfig().state.padding).attr("width",g+2*t.getConfig().state.padding).attr("height",p.height+l+2*t.getConfig().state.padding).attr("rx",t.getConfig().state.radius),e},v=(e,n,r)=>{const d=t.getConfig().state.padding,a=2*t.getConfig().state.padding,l=e.node().getBBox(),f=l.width,i=l.x,s=e.append("text").attr("x",0).attr("y",t.getConfig().state.titleShift).attr("font-size",t.getConfig().state.fontSize).attr("class","state-title").text(n.id),p=s.node().getBBox().width+a;let g=Math.max(p,f);g===f&&(g=g+a);let c;const w=e.node().getBBox();n.doc,c=i-d,p>f&&(c=(f-g)/2+d),Math.abs(i-w.x)<d&&p>f&&(c=i-(p-f)/2);const y=1-t.getConfig().state.textHeight;return e.insert("rect",":first-child").attr("x",c).attr("y",y).attr("class",r?"alt-composit":"composit").attr("width",g).attr("height",w.height+t.getConfig().state.textHeight+t.getConfig().state.titleShift+1).attr("rx","0"),s.attr("x",c+d),p<=f&&s.attr("x",i+(g-a)/2-p/2+d),e.insert("rect",":first-child").attr("x",c).attr("y",t.getConfig().state.titleShift-t.getConfig().state.textHeight-t.getConfig().state.padding).attr("width",g).attr("height",t.getConfig().state.textHeight*3).attr("rx",t.getConfig().state.radius),e.insert("rect",":first-child").attr("x",c).attr("y",t.getConfig().state.titleShift-t.getConfig().state.textHeight-t.getConfig().state.padding).attr("width",g).attr("height",w.height+3+2*t.getConfig().state.textHeight).attr("rx",t.getConfig().state.radius),e},R=e=>(e.append("circle").attr("class","end-state-outer").attr("r",t.getConfig().state.sizeUnit+t.getConfig().state.miniPadding).attr("cx",t.getConfig().state.padding+t.getConfig().state.sizeUnit+t.getConfig().state.miniPadding).attr("cy",t.getConfig().state.padding+t.getConfig().state.sizeUnit+t.getConfig().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t.getConfig().state.sizeUnit).attr("cx",t.getConfig().state.padding+t.getConfig().state.sizeUnit+2).attr("cy",t.getConfig().state.padding+t.getConfig().state.sizeUnit+2)),U=(e,n)=>{let r=t.getConfig().state.forkWidth,d=t.getConfig().state.forkHeight;if(n.parentId){let a=r;r=d,d=a}return e.append("rect").style("stroke","black").style("fill","black").attr("width",r).attr("height",d).attr("x",t.getConfig().state.padding).attr("y",t.getConfig().state.padding)},q=(e,n,r,d)=>{let a=0;const l=d.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let f=e.replace(/\r\n/g,"<br/>");f=f.replace(/\n/g,"<br/>");const i=f.split(t.common$1.lineBreakRegex);let s=1.25*t.getConfig().state.noteMargin;for(const C of i){const p=C.trim();if(p.length>0){const g=l.append("tspan");if(g.text(p),s===0){const c=g.node().getBBox();s+=c.height}a+=s,g.attr("x",n+t.getConfig().state.noteMargin),g.attr("y",r+a+1.25*t.getConfig().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:a}},F=(e,n)=>{n.attr("class","state-note");const r=n.append("rect").attr("x",0).attr("y",t.getConfig().state.padding),d=n.append("g"),{textWidth:a,textHeight:l}=q(e,0,0,d);return r.attr("height",l+2*t.getConfig().state.noteMargin),r.attr("width",a+t.getConfig().state.noteMargin*2),r},M=function(e,n){const r=n.id,d={id:r,label:n.id,width:0,height:0},a=e.append("g").attr("id",r).attr("class","stateGroup");n.type==="start"&&P(a),n.type==="end"&&R(a),(n.type==="fork"||n.type==="join")&&U(a,n),n.type==="note"&&F(n.note.text,a),n.type==="divider"&&A(a),n.type==="default"&&n.descriptions.length===0&&G(a,n),n.type==="default"&&n.descriptions.length>0&&W(a,n);const l=a.node().getBBox();return d.width=l.width+2*t.getConfig().state.padding,d.height=l.height+2*t.getConfig().state.padding,d};let H=0;const O=function(e,n,r){const d=function(s){switch(s){case m.db.relationType.AGGREGATION:return"aggregation";case m.db.relationType.EXTENSION:return"extension";case m.db.relationType.COMPOSITION:return"composition";case m.db.relationType.DEPENDENCY:return"dependency"}};n.points=n.points.filter(s=>!Number.isNaN(s.y));const a=n.points,l=L.line().x(function(s){return s.x}).y(function(s){return s.y}).curve(t.curveBasis),f=e.append("path").attr("d",l(a)).attr("id","edge"+H).attr("class","transition");let i="";if(t.getConfig().state.arrowMarkerAbsolute&&(i=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,i=i.replace(/\(/g,"\\("),i=i.replace(/\)/g,"\\)")),f.attr("marker-end","url("+i+"#"+d(m.db.relationType.DEPENDENCY)+"End)"),r.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:C,y:p}=t.utils.calcLabelPosition(n.points),g=t.common$1.getRows(r.title);let c=0;const w=[];let y=0,S=0;for(let x=0;x<=g.length;x++){const h=s.append("text").attr("text-anchor","middle").text(g[x]).attr("x",C).attr("y",p+c),u=h.node().getBBox();y=Math.max(y,u.width),S=Math.min(S,u.x),t.log$1.info(u.x,C,p+c),c===0&&(c=h.node().getBBox().height,t.log$1.info("Title height",c,p)),w.push(h)}let E=c*g.length;if(g.length>1){const x=(g.length-1)*c*.5;w.forEach((h,u)=>h.attr("y",p+u*c-x)),E=c*g.length}const o=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",C-y/2-t.getConfig().state.padding/2).attr("y",p-E/2-t.getConfig().state.padding/2-3.5).attr("width",y+t.getConfig().state.padding).attr("height",E+t.getConfig().state.padding),t.log$1.info(o)}H++};let b;const N={},X=function(){},J=function(e){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")},Y=function(e,n,r,d){b=t.getConfig().state;const a=t.getConfig().securityLevel;let l;a==="sandbox"&&(l=t.select("#i"+n));const f=a==="sandbox"?t.select(l.nodes()[0].contentDocument.body):t.select("body"),i=a==="sandbox"?l.nodes()[0].contentDocument:document;t.log$1.debug("Rendering diagram "+e);const s=f.select(`[id='${n}']`);J(s);const C=d.db.getRootDoc();$(C,s,void 0,!1,f,i,d);const p=b.padding,g=s.node().getBBox(),c=g.width+p*2,w=g.height+p*2,y=c*1.75;t.configureSvgSize(s,w,y,b.useMaxWidth),s.attr("viewBox",`${g.x-b.padding} ${g.y-b.padding} `+c+" "+w)},I=e=>e?e.length*b.fontSizeFactor:1,$=(e,n,r,d,a,l,f)=>{const i=new T.Graph({compound:!0,multigraph:!0});let s,C=!0;for(s=0;s<e.length;s++)if(e[s].stmt==="relation"){C=!1;break}r?i.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:C?1:b.edgeLengthFactor,nodeSep:C?1:50,isMultiGraph:!0}):i.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:C?1:b.edgeLengthFactor,nodeSep:C?1:50,ranker:"tight-tree",isMultiGraph:!0}),i.setDefaultEdgeLabel(function(){return{}}),f.db.extract(e);const p=f.db.getStates(),g=f.db.getRelations(),c=Object.keys(p);for(const o of c){const x=p[o];r&&(x.parentId=r);let h;if(x.doc){let u=n.append("g").attr("id",x.id).attr("class","stateGroup");h=$(x.doc,u,x.id,!d,a,l,f);{u=v(u,x,d);let B=u.node().getBBox();h.width=B.width,h.height=B.height+b.padding/2,N[x.id]={y:b.compositTitleSize}}}else h=M(n,x);if(x.note){const u={descriptions:[],id:x.id+"-note",note:x.note,type:"note"},B=M(n,u);x.note.position==="left of"?(i.setNode(h.id+"-note",B),i.setNode(h.id,h)):(i.setNode(h.id,h),i.setNode(h.id+"-note",B)),i.setParent(h.id,h.id+"-group"),i.setParent(h.id+"-note",h.id+"-group")}else i.setNode(h.id,h)}t.log$1.debug("Count=",i.nodeCount(),i);let w=0;g.forEach(function(o){w++,t.log$1.debug("Setting edge",o),i.setEdge(o.id1,o.id2,{relation:o,width:I(o.title),height:b.labelHeight*t.common$1.getRows(o.title).length,labelpos:"c"},"id"+w)}),z.layout(i),t.log$1.debug("Graph after layout",i.nodes());const y=n.node();i.nodes().forEach(function(o){o!==void 0&&i.node(o)!==void 0?(t.log$1.warn("Node "+o+": "+JSON.stringify(i.node(o))),a.select("#"+y.id+" #"+o).attr("transform","translate("+(i.node(o).x-i.node(o).width/2)+","+(i.node(o).y+(N[o]?N[o].y:0)-i.node(o).height/2)+" )"),a.select("#"+y.id+" #"+o).attr("data-x-shift",i.node(o).x-i.node(o).width/2),l.querySelectorAll("#"+y.id+" #"+o+" .divider").forEach(h=>{const u=h.parentElement;let B=0,k=0;u&&(u.parentElement&&(B=u.parentElement.getBBox().width),k=parseInt(u.getAttribute("data-x-shift"),10),Number.isNaN(k)&&(k=0)),h.setAttribute("x1",0-k+8),h.setAttribute("x2",B-k-8)})):t.log$1.debug("No Node "+o+": "+JSON.stringify(i.node(o)))});let S=y.getBBox();i.edges().forEach(function(o){o!==void 0&&i.edge(o)!==void 0&&(t.log$1.debug("Edge "+o.v+" -> "+o.w+": "+JSON.stringify(i.edge(o))),O(n,i.edge(o),i.edge(o).relation))}),S=y.getBBox();const E={id:r||"root",label:r||"root",width:0,height:0};return E.width=S.width+2*b.padding,E.height=S.height+2*b.padding,t.log$1.debug("Doc rendered",E,i),E},_={setConf:X,draw:Y},Z={parser:m.parser$1,db:m.db,renderer:_,styles:m.styles,init:e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute,m.db.clear()}};exports.diagram=Z;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@layers-app/editor",
3
3
  "private": false,
4
- "version": "0.0.22",
4
+ "version": "0.0.25",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "VITE_LAYERS=true vite --mode full ",
@@ -26,6 +26,7 @@
26
26
  "main": "dist/index.js",
27
27
  "types": "dist/index.d.ts",
28
28
  "dependencies": {
29
+ "@excalidraw/excalidraw": "^0.18.0",
29
30
  "@layers-app/shared": "0.0.30",
30
31
  "@lexical/headless": "0.21.0",
31
32
  "@lexical/markdown": "0.21.0",
@@ -46,8 +47,8 @@
46
47
  "@mantine/form": "7.17.2",
47
48
  "@mantine/hooks": "7.17.2",
48
49
  "@mantine/modals": "7.17.2",
49
- "@mantine/tiptap": "7.17.2",
50
50
  "@mantine/notifications": "7.17.2",
51
+ "@mantine/tiptap": "7.17.2",
51
52
  "@rollup/plugin-typescript": "^11.1.6",
52
53
  "@tabler/icons-react": "^3.7.0",
53
54
  "@trivago/prettier-plugin-sort-imports": "^5.2.1",
@@ -56,8 +57,8 @@
56
57
  "@types/lodash-es": "^4.17.12",
57
58
  "@types/node": "^20.14.11",
58
59
  "@types/prettier": "2.7.3",
59
- "@types/react": "^18.2.55",
60
- "@types/react-dom": "^18.2.19",
60
+ "@types/react": "^18.3.22",
61
+ "@types/react-dom": "^18.3.7",
61
62
  "@types/swagger-ui-react": "^5.18.0",
62
63
  "@typescript-eslint/eslint-plugin": "^8.27.0",
63
64
  "@typescript-eslint/parser": "^8.27.0",
@@ -91,9 +92,6 @@
91
92
  "vite-plugin-svgr": "^4.2.0",
92
93
  "zustand": "^4.5.4"
93
94
  },
94
- "overrides": {
95
- "prismjs": "1.30.0"
96
- },
97
95
  "peerDependencies": {
98
96
  "@mantine/core": ">=7.17.2",
99
97
  "@mantine/dropzone": ">=7.17.2",