@diagrammo/dgmo 0.92.0 → 0.93.0

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 (166) hide show
  1. package/dist/advanced.d.ts +85 -21
  2. package/dist/advanced.js +455 -422
  3. package/dist/block.d.ts +2 -2
  4. package/dist/block.js +75 -70
  5. package/dist/{chart-meta-BBqLnv5q.d.ts → chart-meta-BbjsRY7o.d.ts} +2 -2
  6. package/dist/chart-meta.d.ts +3 -3
  7. package/dist/chart-meta.js +25 -19
  8. package/dist/{chart-types-CbXlZFLd.d.ts → chart-types-Cppnp31G.d.ts} +173 -4
  9. package/dist/{charts-d3-QUUDVETP.js → charts-d3-ERYYVGP6.js} +7 -6
  10. package/dist/{chunk-HIWHIYLD.js → chunk-2TFXRBCD.js} +19 -19
  11. package/dist/{chunk-F7326NVM.js → chunk-3GCASUWA.js} +58 -25
  12. package/dist/{chunk-ZJAK6C7Y.js → chunk-3PP746YM.js} +6 -1
  13. package/dist/{chunk-WLLO3PZ3.js → chunk-472EOHVW.js} +17 -17
  14. package/dist/{chunk-LMP6Y7QO.js → chunk-4WQX55VX.js} +56 -24
  15. package/dist/{chunk-JLU52ZDT.js → chunk-5CBX66KB.js} +10 -10
  16. package/dist/{chunk-DEFBUZWV.js → chunk-5HAYT43L.js} +70 -54
  17. package/dist/{chunk-S7W75MIM.js → chunk-65GPEV5V.js} +21 -3
  18. package/dist/{chunk-Q6W2K33N.js → chunk-6XLMTAEX.js} +1 -1
  19. package/dist/{chunk-JKST4RTT.js → chunk-7OWK5K5C.js} +6 -6
  20. package/dist/{chunk-73EYNV4O.js → chunk-A5WIAMCT.js} +4 -6
  21. package/dist/{chunk-X5BUX2GK.js → chunk-ADVGV3P7.js} +1 -1
  22. package/dist/{chunk-45QUTYPD.js → chunk-CYDM2XII.js} +17 -17
  23. package/dist/chunk-CYTFO2LF.js +209 -0
  24. package/dist/{chunk-JRWUHLRP.js → chunk-D6PVMUCX.js} +51 -8
  25. package/dist/{chunk-BRSM6Z34.js → chunk-DAHQL57W.js} +14 -14
  26. package/dist/{chunk-RBFJT23E.js → chunk-EQWC76GQ.js} +6 -6
  27. package/dist/{chunk-ADNIO3XY.js → chunk-FIYW7JW4.js} +5 -5
  28. package/dist/{chunk-7ENDOHAA.js → chunk-FMAVHTYB.js} +919 -927
  29. package/dist/{chunk-3PFMGNOM.js → chunk-GJXMG4S3.js} +26 -11
  30. package/dist/chunk-GXCDD6NG.js +24 -0
  31. package/dist/{chunk-RJ2JW3FG.js → chunk-IESUM4N5.js} +2331 -2236
  32. package/dist/{chunk-62BP7AJU.js → chunk-IIV4SMJL.js} +18 -18
  33. package/dist/{chunk-5EBYPETE.js → chunk-J43OCO22.js} +3 -5
  34. package/dist/{chunk-L5NW3PVL.js → chunk-J6AEKIRQ.js} +1 -1
  35. package/dist/{chunk-2BJW7FSF.js → chunk-KBEWVCK3.js} +1 -1
  36. package/dist/{chunk-LRP5FXST.js → chunk-KCHQVED5.js} +18 -17
  37. package/dist/{chunk-Q6ZQX2HX.js → chunk-KCMGIYPO.js} +4 -6
  38. package/dist/{chunk-MDVJYRJT.js → chunk-KPGPK4SK.js} +22 -22
  39. package/dist/{chunk-Q2UFOKPB.js → chunk-KPSSNGAE.js} +22 -22
  40. package/dist/{chunk-V4D2ZQBE.js → chunk-KRPLP5LP.js} +6 -1
  41. package/dist/{chunk-BZX7QCXJ.js → chunk-KRU2LCIP.js} +15 -15
  42. package/dist/{chunk-HXULJZA2.js → chunk-LDDDKWL6.js} +6 -1
  43. package/dist/{chunk-NREU4JFE.js → chunk-LNVB75QU.js} +6 -8
  44. package/dist/{chunk-MX4SZLSV.js → chunk-LUDUDBO6.js} +16 -8
  45. package/dist/{chunk-2YAFDND3.js → chunk-M4NV5PPU.js} +4 -6
  46. package/dist/{chunk-26BBJUBW.js → chunk-M6ZQAFPD.js} +4 -6
  47. package/dist/{chunk-NPWVOFB3.js → chunk-MB2SQF7N.js} +1 -1
  48. package/dist/{chunk-6ZL2XYM7.js → chunk-MLY5ALOV.js} +6 -6
  49. package/dist/chunk-NJJCTEBM.js +416 -0
  50. package/dist/{chunk-OQW4ETJX.js → chunk-NM5V5EKY.js} +6 -1
  51. package/dist/{chunk-ONYO5WJW.js → chunk-NMK7KJZZ.js} +21 -21
  52. package/dist/{chunk-6BNNLVAR.js → chunk-NPDVWFAQ.js} +6 -1
  53. package/dist/{chunk-FTUMRSGT.js → chunk-P5FUWXPW.js} +4 -286
  54. package/dist/chunk-P7TRFL4P.js +54 -0
  55. package/dist/{chunk-A4PNWAUW.js → chunk-PGSGJLUR.js} +6 -1
  56. package/dist/{chunk-DRFGIOZ6.js → chunk-Q7Y6JQ3R.js} +4 -6
  57. package/dist/{chunk-J2E7EUER.js → chunk-QDRCWVV3.js} +17 -17
  58. package/dist/{chunk-MXAP37W6.js → chunk-TNV4F5WA.js} +16 -7
  59. package/dist/{chunk-EBSFSOJC.js → chunk-U7U64UUN.js} +22 -22
  60. package/dist/chunk-UCHZJJIT.js +421 -0
  61. package/dist/{chunk-FSJ3ZA6N.js → chunk-UG7AQQNR.js} +12 -12
  62. package/dist/{chunk-WFA6IULY.js → chunk-URRAWU5D.js} +5 -0
  63. package/dist/{chunk-VOR32OHN.js → chunk-USAGHYRD.js} +13 -15
  64. package/dist/{chunk-QUGC7GWB.js → chunk-UVX3IYXF.js} +15 -15
  65. package/dist/{chunk-B5PEKSRH.js → chunk-VSAKEMDD.js} +6 -1
  66. package/dist/{chunk-YRYKTYMQ.js → chunk-VSOZZYLK.js} +106 -12
  67. package/dist/{chunk-5SSTVFPX.js → chunk-WK5QEYFA.js} +5 -7
  68. package/dist/{chunk-KTGZDMDX.js → chunk-XUTR7GNT.js} +76 -28
  69. package/dist/{chunk-6WVX4KNP.js → chunk-YDZIVDVR.js} +97 -297
  70. package/dist/{chunk-URQIWIKX.js → chunk-YXXIRM4C.js} +3 -3
  71. package/dist/{chunk-H5UEVW6Q.js → chunk-ZD3QCNB7.js} +1 -1
  72. package/dist/{chunk-DUPZ2BBY.js → chunk-ZTLMEBAC.js} +66 -4
  73. package/dist/clock.js +168 -0
  74. package/dist/completion-registry.js +3 -1
  75. package/dist/countdown.js +36 -395
  76. package/dist/{dgmo-router-4UAPPIKN.js → dgmo-router-CZN36TR3.js} +50 -43
  77. package/dist/{dimensions-SCNVYLRF.js → dimensions-7HHKO5BS.js} +3 -3
  78. package/dist/{d3-BThYBTQk.d.ts → export-context-Ceh3wr0E.d.ts} +2 -8
  79. package/dist/{flowchart-parser-NA75YQ77.js → flowchart-parser-4MZPWYK6.js} +8 -3
  80. package/dist/{flowchart-renderer-6MGGX4RC.js → flowchart-renderer-5XDN575E.js} +13 -17
  81. package/dist/index.d.ts +8 -7
  82. package/dist/index.js +80 -74
  83. package/dist/{layout-S3RLVPH4.js → layout-33FHGDEV.js} +10 -12
  84. package/dist/{layout-MBVBAMPA.js → layout-3TSVAGWH.js} +2 -2
  85. package/dist/{layout-WRG4APSJ.js → layout-5GHV7HNM.js} +9 -13
  86. package/dist/layout-FTOGDNUL.js +23 -0
  87. package/dist/{layout-BNLFQHSB.js → layout-QXGPY7KA.js} +7 -9
  88. package/dist/{layout-search-PMYL3VWS.js → layout-search-EMTCDC3C.js} +8 -10
  89. package/dist/{palettes-IN7ZFRJM.js → palettes-4Y7CL2QL.js} +4 -2
  90. package/dist/{parser-3MK56JZC.js → parser-4Y6PODW6.js} +2 -2
  91. package/dist/{parser-2NWH5JUS.js → parser-A3AN76RQ.js} +2 -1
  92. package/dist/{parser-LCJ76UXS.js → parser-BT4NI6JY.js} +5 -1
  93. package/dist/{parser-FXDS4JDK.js → parser-F7NDRPMA.js} +2 -2
  94. package/dist/{parser-BES6LV3G.js → parser-GDLKUBTO.js} +5 -1
  95. package/dist/{parser-SEUTXN6U.js → parser-KJPPUN4D.js} +2 -2
  96. package/dist/{parser-SIKL4PLF.js → parser-KMKVFET2.js} +5 -1
  97. package/dist/{parser-5LW5JDYG.js → parser-NL73FSFI.js} +5 -1
  98. package/dist/{parser-VA7ZQQTA.js → parser-NUU3DVW4.js} +5 -1
  99. package/dist/{parser-L6RWDXQN.js → parser-OGF2CDA6.js} +8 -3
  100. package/dist/{parser-XZUKNZPB.js → parser-R3LPEQIT.js} +7 -1
  101. package/dist/{parser-X23GRTQJ.js → parser-RCIEKN7Y.js} +5 -1
  102. package/dist/{parser-GX5YLRIP.js → parser-VKYUAT4Y.js} +8 -3
  103. package/dist/{parser-QYISOAGR.js → parser-YX72VLDZ.js} +8 -3
  104. package/dist/redraw-MSXU4ZD2.js +73 -0
  105. package/dist/redraw-T324XAF3.js +1698 -0
  106. package/dist/{renderer-5VKPB4LL.js → renderer-37PLQHVB.js} +5 -5
  107. package/dist/{renderer-ISSDGK54.js → renderer-3F47TPZ2.js} +3 -3
  108. package/dist/{renderer-3QAFDXEY.js → renderer-5ITLW7MX.js} +14 -12
  109. package/dist/{renderer-ZZ6MWVB7.js → renderer-6GJWADLO.js} +4 -4
  110. package/dist/{renderer-MM27BSBO.js → renderer-7Y3LR4R2.js} +3 -4
  111. package/dist/{renderer-2FVUPBGV.js → renderer-AM7P4LN7.js} +1 -1
  112. package/dist/{renderer-ZHGHTSNG.js → renderer-BO73LSVT.js} +13 -12
  113. package/dist/{renderer-3IHQI4A4.js → renderer-CNRQFIEI.js} +11 -10
  114. package/dist/{renderer-OAR5VPH4.js → renderer-DAZWHNLI.js} +2 -2
  115. package/dist/{renderer-NDA2FFYB.js → renderer-DD6T3C4J.js} +5 -5
  116. package/dist/{renderer-WIU5BJUK.js → renderer-DDWDCM2K.js} +2 -2
  117. package/dist/{renderer-7ZZG5HR3.js → renderer-EVKWGUGT.js} +8 -9
  118. package/dist/{renderer-3JY6JAQJ.js → renderer-FL7EOSBU.js} +5 -6
  119. package/dist/{renderer-NIE5IW24.js → renderer-GFALLIYT.js} +8 -7
  120. package/dist/{renderer-O6DY46AV.js → renderer-GFGFHYWY.js} +7 -7
  121. package/dist/{renderer-5TZVFQ7K.js → renderer-GOXAP2IE.js} +7 -8
  122. package/dist/{renderer-NHTR7IRR.js → renderer-GPAVVUET.js} +4 -5
  123. package/dist/{renderer-TO2NVJP3.js → renderer-HJ54YXT3.js} +50 -45
  124. package/dist/{renderer-LM4ICK6I.js → renderer-HYGTMBHT.js} +4 -5
  125. package/dist/{renderer-S3YCLJKL.js → renderer-IHCWBFPI.js} +17 -20
  126. package/dist/{renderer-XO57LTU4.js → renderer-ISDKO3DI.js} +5 -5
  127. package/dist/{renderer-LQP3AGEJ.js → renderer-J3QWK6IM.js} +3 -4
  128. package/dist/{renderer-J666LZXJ.js → renderer-J6H4Q3RM.js} +7 -8
  129. package/dist/{renderer-ALWVK3EJ.js → renderer-JJ4QW3SK.js} +6 -6
  130. package/dist/{renderer-DC7C5Q3G.js → renderer-NOYLNVTI.js} +2 -2
  131. package/dist/{renderer-ZGY7P4BM.js → renderer-PBKTAWQV.js} +16 -20
  132. package/dist/{renderer-XGG2UNXT.js → renderer-POBGKIUT.js} +3 -4
  133. package/dist/{renderer-QGIHLZOJ.js → renderer-RDI2RYUP.js} +9 -10
  134. package/dist/{renderer-JEJT3YET.js → renderer-TSCSZ6CL.js} +2 -3
  135. package/dist/{renderer-VPIELEE5.js → renderer-VDBNC7A6.js} +8 -9
  136. package/dist/{renderer-J67LMOD5.js → renderer-VI34SD5V.js} +15 -15
  137. package/dist/{renderer-J5FKF423.js → renderer-W4MUMXJE.js} +7 -4
  138. package/dist/{renderer-RSK6QFWN.js → renderer-XJMVG2WJ.js} +7 -9
  139. package/dist/{state-parser-TIR2ORJY.js → state-parser-NPYTMRXP.js} +8 -3
  140. package/dist/{state-renderer-G6SUXU4J.js → state-renderer-44K2KDX7.js} +15 -19
  141. package/dist/{tag-groups-DsoVpAY-.d.ts → tag-groups-DydewK3D.d.ts} +2 -173
  142. package/dist/{themes-DRNjxX7Q.d.ts → themes-DzIH3Hjv.d.ts} +3 -2
  143. package/docs/ai-integration.md +1 -1
  144. package/docs/language-reference.md +23 -2
  145. package/gallery/fixtures/map-undirected-edges.dgmo +5 -5
  146. package/gallery/fixtures/whiteboard.dgmo +3 -0
  147. package/package.json +4 -6
  148. package/dist/chunk-3Y63RFJL.js +0 -75
  149. package/dist/chunk-5DH3KYFH.js +0 -20
  150. package/dist/chunk-O753JUEZ.js +0 -67
  151. package/dist/chunk-RJNZHFNG.js +0 -51
  152. package/dist/chunk-Z6DXWULM.js +0 -23
  153. package/dist/layout-5USEVQBY.js +0 -25
  154. package/dist/{chunk-YITHYQCL.js → chunk-4FT5KQ7H.js} +7 -7
  155. package/dist/{chunk-GE7ICBX6.js → chunk-4RY5D5RE.js} +4 -4
  156. package/dist/{chunk-DGUGE67L.js → chunk-CDYV46JE.js} +3 -3
  157. package/dist/{chunk-IGKFOHBG.js → chunk-CQYFZOUC.js} +13 -13
  158. package/dist/{chunk-TKAB3FTK.js → chunk-DRQSB72S.js} +11 -11
  159. package/dist/{chunk-ZKP77MB3.js → chunk-FVTYJUXR.js} +5 -5
  160. package/dist/{chunk-MA42PIGJ.js → chunk-H5NVCOEJ.js} +4 -4
  161. package/dist/{chunk-BEA4D7OS.js → chunk-IXHWS2HI.js} +3 -3
  162. package/dist/{chunk-QKY6W4NA.js → chunk-KHL652SX.js} +25 -25
  163. package/dist/{chunk-6OIMUSDX.js → chunk-MUJVNSEW.js} +9 -9
  164. package/dist/{chunk-YO6AQU4A.js → chunk-QJOVZ4TC.js} +12 -12
  165. package/dist/{chunk-SOHZDW6N.js → chunk-UXNA2H2V.js} +3 -3
  166. package/dist/{chunk-NO3UX6AP.js → chunk-V2NQV7VL.js} +4 -4
@@ -1,12 +1,3 @@
1
- import {
2
- noteBoxSize
3
- } from "./chunk-RJNZHFNG.js";
4
- import {
5
- noteConnectorPoints
6
- } from "./chunk-JRWUHLRP.js";
7
- import {
8
- NOTE_GAP
9
- } from "./chunk-5DH3KYFH.js";
10
1
  import {
11
2
  LABEL_REACH_WIDE,
12
3
  NODE_HEIGHT,
@@ -14,285 +5,15 @@ import {
14
5
  placeEdgeLabels
15
6
  } from "./chunk-QT3KDDXK.js";
16
7
  import {
8
+ buildPlacedNotes,
9
+ noteCanvasShift,
17
10
  resolveNotes
18
- } from "./chunk-O753JUEZ.js";
11
+ } from "./chunk-NJJCTEBM.js";
19
12
  import {
20
13
  measureText,
21
14
  wrapTextToWidth
22
15
  } from "./chunk-KAO7JL4I.js";
23
16
 
24
- // src/utils/notes/place.ts
25
- var NOTE_CLEAR = 14;
26
- var intersects = (a, b, pad) => !(a.right + pad <= b.left || b.right + pad <= a.left || a.bottom + pad <= b.top || b.bottom + pad <= a.top);
27
- var CONNECTOR_CLEAR = 4;
28
- var EDGE_CLEAR = 6;
29
- var SLIDE_STEP = 10;
30
- var SEARCH_REACH = 480;
31
- var segmentCrosses = (x1, y1, x2, y2, r) => {
32
- const dx = x2 - x1;
33
- const dy = y2 - y1;
34
- const p = [-dx, dx, -dy, dy];
35
- const q = [x1 - r.left, r.right - x1, y1 - r.top, r.bottom - y1];
36
- let t0 = 0;
37
- let t1 = 1;
38
- for (let i = 0; i < 4; i++) {
39
- const pi = p[i];
40
- const qi = q[i];
41
- if (pi === 0) {
42
- if (qi <= 0) return false;
43
- continue;
44
- }
45
- const t = qi / pi;
46
- if (pi < 0) t0 = Math.max(t0, t);
47
- else t1 = Math.min(t1, t);
48
- }
49
- return t0 < t1;
50
- };
51
- function placeNotes(obstacles, requests, direction, edges = []) {
52
- const placements = /* @__PURE__ */ new Map();
53
- const occupied = obstacles.map((p) => ({
54
- left: p.x - p.width / 2,
55
- top: p.y - p.height / 2,
56
- right: p.x + p.width / 2,
57
- bottom: p.y + p.height / 2
58
- }));
59
- for (const req of requests) {
60
- if (req.collapsed) {
61
- placements.set(req.key, {
62
- collapsed: true,
63
- side: "right",
64
- x: 0,
65
- y: 0
66
- });
67
- continue;
68
- }
69
- const p = req.node;
70
- const cx = p.x;
71
- const cy = p.y;
72
- const nodeLeft = cx - p.width / 2;
73
- const nodeRight = cx + p.width / 2;
74
- const nodeTop = cy - p.height / 2;
75
- const nodeBottom = cy + p.height / 2;
76
- const { noteW, noteH } = req;
77
- const rectFor = (side) => {
78
- switch (side) {
79
- case "right": {
80
- const left = nodeRight + NOTE_GAP;
81
- const top = cy - noteH / 2;
82
- return { left, top, right: left + noteW, bottom: top + noteH };
83
- }
84
- case "left": {
85
- const right = nodeLeft - NOTE_GAP;
86
- const top = cy - noteH / 2;
87
- return { left: right - noteW, top, right, bottom: top + noteH };
88
- }
89
- case "below": {
90
- const left = cx - noteW / 2;
91
- const top = nodeBottom + NOTE_GAP;
92
- return { left, top, right: left + noteW, bottom: top + noteH };
93
- }
94
- case "above":
95
- default: {
96
- const left = cx - noteW / 2;
97
- const bottom = nodeTop - NOTE_GAP;
98
- return { left, top: bottom - noteH, right: left + noteW, bottom };
99
- }
100
- }
101
- };
102
- const order = direction === "LR" ? ["below", "above", "right", "left"] : ["right", "left", "below", "above"];
103
- const anchor = {
104
- left: nodeLeft,
105
- top: nodeTop,
106
- right: nodeRight,
107
- bottom: nodeBottom
108
- };
109
- const isAnchor = (o) => o.left === anchor.left && o.top === anchor.top && o.right === anchor.right && o.bottom === anchor.bottom;
110
- const connector = (rect, side) => {
111
- const [x1, y1, x2, y2] = noteConnectorPoints(p, {
112
- x: rect.left - cx,
113
- y: rect.top - cy,
114
- width: noteW,
115
- height: noteH,
116
- side
117
- });
118
- return [cx + x1, cy + y1, cx + x2, cy + y2];
119
- };
120
- const onEdge = (rect) => {
121
- const padded = {
122
- left: rect.left - EDGE_CLEAR,
123
- top: rect.top - EDGE_CLEAR,
124
- right: rect.right + EDGE_CLEAR,
125
- bottom: rect.bottom + EDGE_CLEAR
126
- };
127
- return edges.some(
128
- (path) => path.some(
129
- (pt, i) => i > 0 && segmentCrosses(path[i - 1].x, path[i - 1].y, pt.x, pt.y, padded)
130
- )
131
- );
132
- };
133
- const isClear = (rect, side, avoidEdges) => {
134
- if (occupied.some((o) => intersects(rect, o, NOTE_CLEAR))) return false;
135
- if (avoidEdges && onEdge(rect)) return false;
136
- const [x1, y1, x2, y2] = connector(rect, side);
137
- return !occupied.some(
138
- (o) => !isAnchor(o) && segmentCrosses(x1, y1, x2, y2, {
139
- left: o.left - CONNECTOR_CLEAR,
140
- top: o.top - CONNECTOR_CLEAR,
141
- right: o.right + CONNECTOR_CLEAR,
142
- bottom: o.bottom + CONNECTOR_CLEAR
143
- })
144
- );
145
- };
146
- const search = (avoidEdges) => {
147
- let chosen2 = null;
148
- for (const side of order.slice(0, 2)) {
149
- const rect = rectFor(side);
150
- if (isClear(rect, side, avoidEdges)) {
151
- chosen2 = { rect, side };
152
- break;
153
- }
154
- }
155
- if (chosen2) return chosen2;
156
- let bestLen = Infinity;
157
- for (const side of order) {
158
- const axisIsY = side === "above" || side === "below";
159
- const outward = side === "below" || side === "right" ? 1 : -1;
160
- const reach = axisIsY ? noteW / 2 : SEARCH_REACH;
161
- const slides = [0];
162
- for (let s = SLIDE_STEP; s <= reach; s += SLIDE_STEP) {
163
- slides.push(s, -s);
164
- }
165
- const base = rectFor(side);
166
- for (let out = 0; out <= SEARCH_REACH; out += NOTE_CLEAR) {
167
- for (const slide of slides) {
168
- const dx = axisIsY ? slide : out * outward;
169
- const dy = axisIsY ? out * outward : slide;
170
- const rect = {
171
- left: base.left + dx,
172
- top: base.top + dy,
173
- right: base.right + dx,
174
- bottom: base.bottom + dy
175
- };
176
- if (!isClear(rect, side, avoidEdges)) continue;
177
- const [x1, y1, x2, y2] = connector(rect, side);
178
- const len = Math.hypot(x2 - x1, y2 - y1);
179
- if (len < bestLen) {
180
- bestLen = len;
181
- chosen2 = { rect, side };
182
- }
183
- }
184
- }
185
- }
186
- return chosen2;
187
- };
188
- let chosen = search(true) ?? search(false);
189
- if (!chosen) {
190
- const side = order[0];
191
- let rect = rectFor(side);
192
- const axisIsY = side === "above" || side === "below";
193
- const outward = side === "below" || side === "right" ? 1 : -1;
194
- for (let guard = 0; guard < 50; guard++) {
195
- const blockers = occupied.filter(
196
- (o) => intersects(rect, o, NOTE_CLEAR)
197
- );
198
- if (blockers.length === 0) break;
199
- if (axisIsY && outward > 0) {
200
- const top = Math.max(...blockers.map((b) => b.bottom)) + NOTE_CLEAR;
201
- rect = { ...rect, top, bottom: top + noteH };
202
- } else if (axisIsY) {
203
- const bottom = Math.min(...blockers.map((b) => b.top)) - NOTE_CLEAR;
204
- rect = { ...rect, bottom, top: bottom - noteH };
205
- } else if (outward > 0) {
206
- const left = Math.max(...blockers.map((b) => b.right)) + NOTE_CLEAR;
207
- rect = { ...rect, left, right: left + noteW };
208
- } else {
209
- const right = Math.min(...blockers.map((b) => b.left)) - NOTE_CLEAR;
210
- rect = { ...rect, right, left: right - noteW };
211
- }
212
- }
213
- chosen = { rect, side };
214
- }
215
- occupied.push(chosen.rect);
216
- placements.set(req.key, {
217
- collapsed: false,
218
- side: chosen.side,
219
- x: chosen.rect.left - p.x,
220
- y: chosen.rect.top - p.y
221
- });
222
- }
223
- return placements;
224
- }
225
-
226
- // src/utils/notes/build.ts
227
- function buildPlacedNotes(anchors, noteByNode, direction, collapsedNotes) {
228
- const placed = /* @__PURE__ */ new Map();
229
- if (noteByNode.size === 0) return placed;
230
- const geoms = /* @__PURE__ */ new Map();
231
- const requests = [];
232
- for (const a of anchors) {
233
- const note = noteByNode.get(a.id);
234
- if (!note) continue;
235
- const size = noteBoxSize(note.body);
236
- geoms.set(a.id, {
237
- noteW: size.width,
238
- noteH: size.height,
239
- ...note.color && { color: note.color },
240
- lines: size.lines,
241
- lineNumber: note.lineNumber,
242
- endLineNumber: note.endLineNumber
243
- });
244
- requests.push({
245
- key: a.id,
246
- node: { x: a.x, y: a.y, width: a.width, height: a.height },
247
- noteW: size.width,
248
- noteH: size.height,
249
- collapsed: collapsedNotes?.has(note.lineNumber) ?? false
250
- });
251
- }
252
- const placements = placeNotes(
253
- anchors.map((a) => ({ x: a.x, y: a.y, width: a.width, height: a.height })),
254
- requests,
255
- direction
256
- );
257
- for (const [id, g] of geoms) {
258
- const p = placements.get(id);
259
- placed.set(
260
- id,
261
- p.collapsed ? {
262
- x: 0,
263
- y: 0,
264
- width: 0,
265
- height: 0,
266
- side: "right",
267
- ...g.color && { color: g.color },
268
- lines: [],
269
- lineNumber: g.lineNumber,
270
- endLineNumber: g.endLineNumber,
271
- collapsed: true
272
- } : {
273
- x: p.x,
274
- y: p.y,
275
- width: g.noteW,
276
- height: g.noteH,
277
- side: p.side,
278
- ...g.color && { color: g.color },
279
- lines: g.lines,
280
- lineNumber: g.lineNumber,
281
- endLineNumber: g.endLineNumber
282
- }
283
- );
284
- }
285
- return placed;
286
- }
287
-
288
- // src/utils/notes/bounds.ts
289
- function noteCanvasShift(minX, minY, margin = 20) {
290
- return {
291
- shiftX: minX < 0 ? margin - minX : 0,
292
- shiftY: minY < 0 ? margin - minY : 0
293
- };
294
- }
295
-
296
17
  // src/boxes-and-lines/layout.ts
297
18
  var MARGIN = 40;
298
19
  var MAX_PARALLEL_EDGES = 5;
@@ -382,7 +103,7 @@ function computeNodeSize(node, reserveValueRow) {
382
103
  return { width: w, height: Math.max(NODE_HEIGHT, totalHeight) };
383
104
  }
384
105
  async function layoutBoxesAndLines(parsed, collapseInfo, layoutOptions) {
385
- const { layoutBoxesAndLinesSearch } = await import("./layout-search-PMYL3VWS.js");
106
+ const { layoutBoxesAndLinesSearch } = await import("./layout-search-EMTCDC3C.js");
386
107
  const searchOpts = {
387
108
  ...layoutOptions?.hideDescriptions !== void 0 && {
388
109
  hideDescriptions: layoutOptions.hideDescriptions
@@ -698,9 +419,6 @@ function applyParallelEdgeOffsets(layout) {
698
419
  }
699
420
 
700
421
  export {
701
- placeNotes,
702
- buildPlacedNotes,
703
- noteCanvasShift,
704
422
  computeNodeSize,
705
423
  layoutBoxesAndLines
706
424
  };
@@ -0,0 +1,54 @@
1
+ // src/whiteboard/types.ts
2
+ var WHITEBOARD_COLORS = [
3
+ "ink",
4
+ "red",
5
+ "green",
6
+ "blue",
7
+ "teal",
8
+ "purple",
9
+ "orange",
10
+ "yellow",
11
+ "cyan",
12
+ "gray"
13
+ ];
14
+ var WHITEBOARD_SHAPE_KINDS = [
15
+ "rectangle",
16
+ "ellipse",
17
+ "database",
18
+ "queue"
19
+ ];
20
+ var WHITEBOARD_ELEMENT_KEYWORDS = [
21
+ ...WHITEBOARD_SHAPE_KINDS,
22
+ "note",
23
+ "arrow",
24
+ "line",
25
+ "text",
26
+ "image",
27
+ "ink"
28
+ ];
29
+ var WHITEBOARD_STROKE_STYLES = ["solid", "dashed"];
30
+ var WHITEBOARD_FILLS = ["tint", "solid", "outline"];
31
+ var WHITEBOARD_HEADS = ["end", "both"];
32
+ var WHITEBOARD_NOTE_WIDTH = 160;
33
+ var WHITEBOARD_NOTE_HEIGHT = 99;
34
+ var WHITEBOARD_NOTE_COLOR = "yellow";
35
+ function isWhiteboardColor(value) {
36
+ return WHITEBOARD_COLORS.includes(value);
37
+ }
38
+ function isWhiteboardShapeKind(value) {
39
+ return WHITEBOARD_SHAPE_KINDS.includes(value);
40
+ }
41
+
42
+ export {
43
+ WHITEBOARD_COLORS,
44
+ WHITEBOARD_SHAPE_KINDS,
45
+ WHITEBOARD_ELEMENT_KEYWORDS,
46
+ WHITEBOARD_STROKE_STYLES,
47
+ WHITEBOARD_FILLS,
48
+ WHITEBOARD_HEADS,
49
+ WHITEBOARD_NOTE_WIDTH,
50
+ WHITEBOARD_NOTE_HEIGHT,
51
+ WHITEBOARD_NOTE_COLOR,
52
+ isWhiteboardColor,
53
+ isWhiteboardShapeKind
54
+ };
@@ -1,3 +1,6 @@
1
+ import {
2
+ extractPaletteDirective
3
+ } from "./chunk-CYTFO2LF.js";
1
4
  import {
2
5
  tryStripDescriptionKeyword
3
6
  } from "./chunk-IYULMRBE.js";
@@ -61,7 +64,9 @@ function parseJourneyMap(content, palette) {
61
64
  if (!content?.trim()) {
62
65
  return fail(0, "No content provided");
63
66
  }
64
- const lines = content.split("\n");
67
+ const directive = extractPaletteDirective(content);
68
+ result.diagnostics.push(...directive.diagnostics);
69
+ const lines = directive.content.split("\n");
65
70
  let contentStarted = false;
66
71
  let activeTagOptionLine = 0;
67
72
  let currentTagGroup = null;
@@ -1,12 +1,10 @@
1
- import {
2
- tryCollectNote
3
- } from "./chunk-3Y63RFJL.js";
4
- import {
5
- resolveNotes
6
- } from "./chunk-O753JUEZ.js";
7
1
  import {
8
2
  validateLabelCharacters
9
3
  } from "./chunk-N7VMGZCU.js";
4
+ import {
5
+ resolveNotes,
6
+ tryCollectNote
7
+ } from "./chunk-NJJCTEBM.js";
10
8
  import {
11
9
  displayName,
12
10
  normalizeName
@@ -12,14 +12,20 @@ import {
12
12
  appendArrowheadMarkers
13
13
  } from "./chunk-XBJJP2HN.js";
14
14
  import {
15
- renderInlineText
16
- } from "./chunk-S7W75MIM.js";
15
+ parseInfra
16
+ } from "./chunk-UXNA2H2V.js";
17
17
  import {
18
18
  ScaleContext
19
19
  } from "./chunk-24YPR5EH.js";
20
20
  import {
21
- renderIntegratedLegend
22
- } from "./chunk-NMS5XSLX.js";
21
+ layoutInlineHeader
22
+ } from "./chunk-42UJ23H3.js";
23
+ import {
24
+ TITLE_FONT_SIZE,
25
+ TITLE_FONT_WEIGHT,
26
+ TITLE_OFFSET,
27
+ TITLE_Y
28
+ } from "./chunk-VLC6WNRD.js";
23
29
  import {
24
30
  ARROWHEAD_HEIGHT,
25
31
  ARROWHEAD_WIDTH,
@@ -31,27 +37,21 @@ import {
31
37
  NODE_STROKE_WIDTH
32
38
  } from "./chunk-XCKNFFKM.js";
33
39
  import {
34
- layoutInlineHeader
35
- } from "./chunk-42UJ23H3.js";
40
+ renderIntegratedLegend
41
+ } from "./chunk-NMS5XSLX.js";
36
42
  import {
37
43
  getLegendExtent,
38
44
  getMaxLegendReservedHeight
39
45
  } from "./chunk-JILEYZ2V.js";
40
46
  import {
41
- TITLE_FONT_SIZE,
42
- TITLE_FONT_WEIGHT,
43
- TITLE_OFFSET,
44
- TITLE_Y
45
- } from "./chunk-VLC6WNRD.js";
47
+ preprocessDescriptionLine
48
+ } from "./chunk-IYULMRBE.js";
49
+ import {
50
+ renderInlineText
51
+ } from "./chunk-65GPEV5V.js";
46
52
  import {
47
53
  FONT_FAMILY
48
54
  } from "./chunk-ICLB27PZ.js";
49
- import {
50
- parseInfra
51
- } from "./chunk-SOHZDW6N.js";
52
- import {
53
- preprocessDescriptionLine
54
- } from "./chunk-IYULMRBE.js";
55
55
  import {
56
56
  tagAttrKey
57
57
  } from "./chunk-4SACN2C5.js";
@@ -1,13 +1,11 @@
1
1
  import {
2
2
  searchPlacement
3
- } from "./chunk-HXULJZA2.js";
3
+ } from "./chunk-LDDDKWL6.js";
4
4
  import {
5
5
  buildPlacedNotes,
6
- noteCanvasShift
7
- } from "./chunk-FTUMRSGT.js";
8
- import {
6
+ noteCanvasShift,
9
7
  resolveNotes
10
- } from "./chunk-O753JUEZ.js";
8
+ } from "./chunk-NJJCTEBM.js";
11
9
  import {
12
10
  measureText
13
11
  } from "./chunk-KAO7JL4I.js";
@@ -20,6 +18,10 @@ var HEADER_BASE = 36;
20
18
  var TABLE_FONT_SIZE = 13;
21
19
  var COLUMN_FONT_SIZE = 11;
22
20
  var EDGE_LABEL_FONT_SIZE = 11;
21
+ var RANKSEP = 80;
22
+ var EDGE_LABEL_MIN_ROOM = 10;
23
+ var EDGE_LABEL_MARKER_ROOM = 24;
24
+ var EDGE_LABEL_BOX_HEIGHT = 16;
23
25
  var CONSTRAINT_ICON_WIDTH = 16;
24
26
  var MEMBER_LINE_HEIGHT = 18;
25
27
  var COMPARTMENT_PADDING_Y = 8;
@@ -96,7 +98,7 @@ function layoutComponent(tables, rels, dimMap) {
96
98
  rankdir: "LR",
97
99
  ranker,
98
100
  nodesep: 40,
99
- ranksep: 80,
101
+ ranksep: RANKSEP,
100
102
  edgesep: 20
101
103
  });
102
104
  g2.setDefaultEdgeLabel(() => ({}));
@@ -105,10 +107,17 @@ function layoutComponent(tables, rels, dimMap) {
105
107
  g2.setNode(table.id, { width: dims.width, height: dims.height });
106
108
  }
107
109
  for (const rel of ord(rels)) {
110
+ const box = rel.label ? measureText(rel.label, EDGE_LABEL_FONT_SIZE) + 8 : 0;
111
+ const excess = box + 2 * EDGE_LABEL_MIN_ROOM > RANKSEP ? box + 2 * EDGE_LABEL_MARKER_ROOM - RANKSEP : 0;
108
112
  g2.setEdge(
109
113
  rel.source,
110
114
  rel.target,
111
- { label: rel.label ?? "" },
115
+ excess > 0 ? {
116
+ label: rel.label,
117
+ width: excess,
118
+ height: EDGE_LABEL_BOX_HEIGHT,
119
+ labelpos: "c"
120
+ } : { label: rel.label ?? "" },
112
121
  String(rel.lineNumber)
113
122
  );
114
123
  }
@@ -7,26 +7,17 @@ import {
7
7
  appendArrowheadMarkers,
8
8
  appendReverseArrowheadMarkers
9
9
  } from "./chunk-XBJJP2HN.js";
10
- import {
11
- NOTE_BADGE_RADIUS,
12
- noteConnectorPoints,
13
- renderNoteBadge,
14
- renderNoteBox,
15
- renderNoteConnector
16
- } from "./chunk-JRWUHLRP.js";
17
- import {
18
- wrapDescriptionLines
19
- } from "./chunk-NPWVOFB3.js";
20
- import {
21
- renderInlineText,
22
- stripInlineMarkdown
23
- } from "./chunk-S7W75MIM.js";
24
10
  import {
25
11
  ScaleContext
26
12
  } from "./chunk-24YPR5EH.js";
27
13
  import {
28
- renderIntegratedLegend
29
- } from "./chunk-NMS5XSLX.js";
14
+ layoutInlineHeader
15
+ } from "./chunk-42UJ23H3.js";
16
+ import {
17
+ TITLE_FONT_SIZE,
18
+ TITLE_FONT_WEIGHT,
19
+ TITLE_Y
20
+ } from "./chunk-VLC6WNRD.js";
30
21
  import {
31
22
  ARROWHEAD_HEIGHT,
32
23
  ARROWHEAD_WIDTH,
@@ -38,17 +29,26 @@ import {
38
29
  NODE_STROKE_WIDTH
39
30
  } from "./chunk-XCKNFFKM.js";
40
31
  import {
41
- layoutInlineHeader
42
- } from "./chunk-42UJ23H3.js";
32
+ renderIntegratedLegend
33
+ } from "./chunk-NMS5XSLX.js";
43
34
  import {
44
35
  getLegendExtent,
45
36
  getMaxLegendReservedHeight
46
37
  } from "./chunk-JILEYZ2V.js";
47
38
  import {
48
- TITLE_FONT_SIZE,
49
- TITLE_FONT_WEIGHT,
50
- TITLE_Y
51
- } from "./chunk-VLC6WNRD.js";
39
+ NOTE_BADGE_RADIUS,
40
+ noteConnectorPoints,
41
+ renderNoteBadge,
42
+ renderNoteBox,
43
+ renderNoteConnector
44
+ } from "./chunk-D6PVMUCX.js";
45
+ import {
46
+ wrapDescriptionLines
47
+ } from "./chunk-MB2SQF7N.js";
48
+ import {
49
+ renderInlineText,
50
+ stripInlineMarkdown
51
+ } from "./chunk-65GPEV5V.js";
52
52
  import {
53
53
  FONT_FAMILY
54
54
  } from "./chunk-ICLB27PZ.js";