@diagrammo/dgmo 0.85.0 → 0.86.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.
- package/dist/advanced.d.ts +63 -9
- package/dist/advanced.js +69 -51
- package/dist/block.js +8 -8
- package/dist/chart-meta.js +3 -3
- package/dist/{chunk-LRNIYQ6Y.js → chunk-33FQ6HNV.js} +1 -1
- package/dist/{chunk-REUEU5PU.js → chunk-3CQS3CIO.js} +2 -2
- package/dist/{chunk-LQSNWE3W.js → chunk-4ELXLATB.js} +1 -1
- package/dist/{chunk-ADAGWVWJ.js → chunk-4YA5XW43.js} +39 -39
- package/dist/{chunk-23RWHHI5.js → chunk-5NU7NII2.js} +14 -2
- package/dist/{chunk-HMWZQ53A.js → chunk-7WGCQE2E.js} +1 -1
- package/dist/{chunk-NSS2EF5B.js → chunk-AAMCXQPP.js} +1 -1
- package/dist/{chunk-XD7XL3SF.js → chunk-AGO3PFGS.js} +1 -1
- package/dist/{chunk-JVRDKR5R.js → chunk-AQIBKTPG.js} +1 -1
- package/dist/{chunk-ITLPDLBH.js → chunk-BF7JAFJI.js} +1 -1
- package/dist/{chunk-RMAJIB6S.js → chunk-BHZE36F7.js} +3 -3
- package/dist/{chunk-6HOVLE3H.js → chunk-BT2WH2XT.js} +1 -1
- package/dist/{chunk-3MXJMZAN.js → chunk-BV6PKJUS.js} +105 -28
- package/dist/{chunk-PSH5DT26.js → chunk-C6FZZFYD.js} +2 -2
- package/dist/{chunk-7256EOAE.js → chunk-CFBY77QJ.js} +129 -10
- package/dist/{chunk-OZTDXMRQ.js → chunk-D4M25W6R.js} +1 -1
- package/dist/{chunk-A4PHPKNR.js → chunk-DAX42XVH.js} +1 -1
- package/dist/{chunk-V3LJIPS4.js → chunk-E6S2K6O2.js} +1 -1
- package/dist/{chunk-BIQYWWJ2.js → chunk-ERYHC4KJ.js} +1 -1
- package/dist/{chunk-JLGN6S4B.js → chunk-EWSESGC2.js} +32 -3
- package/dist/{chunk-MIZ46MOF.js → chunk-GYORDNOM.js} +1 -1
- package/dist/{chunk-D7D5YK4J.js → chunk-H6AFNCN3.js} +14 -2
- package/dist/{chunk-PEFPTQ3Z.js → chunk-HUMQIRJK.js} +1 -1
- package/dist/{chunk-XXAZ5C4K.js → chunk-IJ27L3R4.js} +1 -1
- package/dist/{chunk-VDMG3MM4.js → chunk-JD4RHBNX.js} +1 -1
- package/dist/{chunk-J2ICADUM.js → chunk-LHBMQJC3.js} +1 -1
- package/dist/{chunk-Y7FTHOMD.js → chunk-LIYWJ6DV.js} +32 -223
- package/dist/{chunk-HATTVAWX.js → chunk-LJFXC3IP.js} +1 -1
- package/dist/{chunk-T327J6CE.js → chunk-MSXRNVHB.js} +2 -2
- package/dist/{chunk-2QIGN7KL.js → chunk-MYHPRQHR.js} +6 -2
- package/dist/{chunk-UJRMARNX.js → chunk-NJIGYGZS.js} +19 -1
- package/dist/{chunk-RYZNNXUV.js → chunk-PKXKWHDW.js} +1 -1
- package/dist/{chunk-C5FEPGSJ.js → chunk-QJFT5MAH.js} +1 -1
- package/dist/{chunk-ULCB4BLF.js → chunk-QPE646M2.js} +1 -1
- package/dist/{chunk-UNSN56OJ.js → chunk-R2K5L4UA.js} +1 -1
- package/dist/{chunk-SLMAAJPE.js → chunk-RGI64U3A.js} +1 -1
- package/dist/chunk-TW6WMZFW.js +287 -0
- package/dist/{chunk-ZUUNTOMG.js → chunk-UIUXIDBX.js} +1 -1
- package/dist/{chunk-XIYVGO24.js → chunk-UMRZPRAN.js} +3 -3
- package/dist/{chunk-67USWFFE.js → chunk-UY6TEJJH.js} +1 -1
- package/dist/{chunk-YWHGWLY6.js → chunk-VEE777MD.js} +3 -3
- package/dist/{chunk-UGYZ5Q5Y.js → chunk-VJ2KROJ5.js} +1 -1
- package/dist/{chunk-OGKP2XGJ.js → chunk-VPVWG2GH.js} +1 -1
- package/dist/{chunk-IIEI7VK5.js → chunk-XCKNFFKM.js} +2 -0
- package/dist/{chunk-NJS62BAG.js → chunk-XFMQSFS4.js} +1 -1
- package/dist/cloud-reference.d.ts +11 -1
- package/dist/cloud-reference.js +1 -1
- package/dist/{dgmo-router-VILEOWQ2.js → dgmo-router-F2DSURTR.js} +4 -4
- package/dist/{dimensions-F3Y5T54V.js → dimensions-6QAWEGIR.js} +2 -2
- package/dist/{flowchart-renderer-TGQL4S4L.js → flowchart-renderer-H72L7BEC.js} +2 -2
- package/dist/index.js +8 -8
- package/dist/{layout-WZCXK7DF.js → layout-5NPBHV5F.js} +2 -2
- package/dist/{layout-WXVGMSI3.js → layout-5VSMZPMG.js} +2 -2
- package/dist/{layout-K6NI4VCS.js → layout-CUFA7XJD.js} +2 -2
- package/dist/{layout-NB7TKAWN.js → layout-LUQKAGGT.js} +2 -2
- package/dist/{layout-CFTB7GKV.js → layout-QIPCNUSB.js} +2 -2
- package/dist/{layout-PT7IKVCV.js → layout-QX5T6ZNE.js} +2 -2
- package/dist/layout-T6TAB5OI.js +10 -0
- package/dist/{layout-search-GRJEBAUF.js → layout-search-AW5VBDCV.js} +13 -8
- package/dist/live-link-resolve.d.ts +21 -3
- package/dist/live-link-resolve.js +47 -17
- package/dist/{parser-6TXNMXNB.js → parser-XYY5NHP4.js} +2 -2
- package/dist/{renderer-FXX3XSNW.js → renderer-2BWRW23Z.js} +2 -2
- package/dist/{renderer-OV3GUJRR.js → renderer-36JH4OMC.js} +4 -4
- package/dist/{renderer-EU27D4S6.js → renderer-425QUIYO.js} +2 -2
- package/dist/{renderer-HV6ZYJMC.js → renderer-4NZZ5J2F.js} +2 -2
- package/dist/{renderer-UGA5DGKR.js → renderer-5JVVJBAS.js} +2 -2
- package/dist/{renderer-YSH5EX54.js → renderer-AI2MD52D.js} +1 -1
- package/dist/{renderer-HWEGM72C.js → renderer-BICLPGAH.js} +2 -2
- package/dist/{renderer-XS42HEXW.js → renderer-CZJ4AMYV.js} +2 -2
- package/dist/{renderer-WUDVV363.js → renderer-E7WF75GY.js} +2 -2
- package/dist/{renderer-3XRDFNYF.js → renderer-EWJS2RAZ.js} +3 -3
- package/dist/{renderer-5YOF2AHJ.js → renderer-JEEGPLMM.js} +2 -2
- package/dist/{renderer-OXSLLQQC.js → renderer-KVAQE7PQ.js} +2 -2
- package/dist/{renderer-TF3NTKP3.js → renderer-NX4YKWCJ.js} +2 -2
- package/dist/{renderer-P7LQBDU2.js → renderer-QM23SWAM.js} +2 -2
- package/dist/{renderer-FBAFYSIQ.js → renderer-RAATRF6W.js} +3 -3
- package/dist/{renderer-X4KFEKUK.js → renderer-RH4U3UVM.js} +3 -3
- package/dist/{renderer-G72GMBKA.js → renderer-RLSR7N6I.js} +4 -4
- package/dist/{renderer-3F4K2X57.js → renderer-RMGN3Q7D.js} +2 -2
- package/dist/{renderer-OVDVFPAI.js → renderer-RUGMKHX5.js} +3 -3
- package/dist/{renderer-DRLLZZ6P.js → renderer-UUWR7NGF.js} +2 -2
- package/dist/{renderer-J3O2KVTL.js → renderer-V6LLASGN.js} +2 -2
- package/dist/{renderer-FQAZ3KNU.js → renderer-VKAJ52UO.js} +2 -2
- package/dist/{renderer-WRWVFEX7.js → renderer-XRALFCIN.js} +6 -4
- package/dist/{renderer-5A6VWIVX.js → renderer-YIZ7G4HU.js} +5 -5
- package/dist/{state-renderer-B4ZF6ESS.js → state-renderer-DDVJ43HR.js} +2 -2
- package/docs/language-reference.md +12 -12
- package/package.json +2 -2
- package/dist/chunk-WTTIODDV.js +0 -9
- package/dist/layout-JQ3IPJYR.js +0 -9
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import {
|
|
2
|
+
measureText,
|
|
3
|
+
truncateText,
|
|
4
|
+
wrapTextToWidth
|
|
5
|
+
} from "./chunk-KAO7JL4I.js";
|
|
6
|
+
|
|
7
|
+
// src/boxes-and-lines/node-metrics.ts
|
|
8
|
+
var PHI = 1.618;
|
|
9
|
+
var NODE_HEIGHT = 60;
|
|
10
|
+
var NODE_WIDTH = Math.round(NODE_HEIGHT * PHI);
|
|
11
|
+
|
|
12
|
+
// src/boxes-and-lines/label-placement.ts
|
|
13
|
+
var EDGE_LABEL_FONT_SIZE = 11;
|
|
14
|
+
var LABEL_MAX_WIDTH = 160;
|
|
15
|
+
var MAX_LABEL_LINES = 3;
|
|
16
|
+
var LABEL_LINE_HEIGHT = 1.3;
|
|
17
|
+
var H_PAD = 6;
|
|
18
|
+
var V_PAD = 3;
|
|
19
|
+
var BOX_CLEAR_PAD = 4;
|
|
20
|
+
var PERP_STEP = 8;
|
|
21
|
+
var LABEL_REACH_NEAR = 40;
|
|
22
|
+
var LABEL_REACH_WIDE = 56;
|
|
23
|
+
var SLIDE_SAMPLES = 9;
|
|
24
|
+
function measureEdgeLabel(label, fontSize = EDGE_LABEL_FONT_SIZE, maxWidth = LABEL_MAX_WIDTH) {
|
|
25
|
+
let lines = wrapTextToWidth(label, fontSize, maxWidth, { hardBreak: true });
|
|
26
|
+
if (lines.length > MAX_LABEL_LINES) {
|
|
27
|
+
const kept = lines.slice(0, MAX_LABEL_LINES - 1);
|
|
28
|
+
const rest = lines.slice(MAX_LABEL_LINES - 1).join(" ");
|
|
29
|
+
kept.push(truncateText(rest, fontSize, maxWidth));
|
|
30
|
+
lines = kept;
|
|
31
|
+
}
|
|
32
|
+
let textW = 0;
|
|
33
|
+
for (const ln of lines) {
|
|
34
|
+
const w = measureText(ln, fontSize);
|
|
35
|
+
if (w > textW) textW = w;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
lines,
|
|
39
|
+
width: textW + 2 * H_PAD,
|
|
40
|
+
height: lines.length * fontSize * LABEL_LINE_HEIGHT + 2 * V_PAD
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function edgePolylineMidpoint(points) {
|
|
44
|
+
return pointAtArcFraction(points, 0.5).p;
|
|
45
|
+
}
|
|
46
|
+
function pointAtArcFraction(points, t) {
|
|
47
|
+
if (points.length === 0) return { p: { x: 0, y: 0 }, nx: 0, ny: 1 };
|
|
48
|
+
if (points.length === 1)
|
|
49
|
+
return { p: { x: points[0].x, y: points[0].y }, nx: 0, ny: 1 };
|
|
50
|
+
const segLen = [];
|
|
51
|
+
let total = 0;
|
|
52
|
+
for (let k = 1; k < points.length; k++) {
|
|
53
|
+
const len = Math.hypot(
|
|
54
|
+
points[k].x - points[k - 1].x,
|
|
55
|
+
points[k].y - points[k - 1].y
|
|
56
|
+
);
|
|
57
|
+
segLen.push(len);
|
|
58
|
+
total += len;
|
|
59
|
+
}
|
|
60
|
+
let want = total * Math.max(0, Math.min(1, t));
|
|
61
|
+
for (let k = 1; k < points.length; k++) {
|
|
62
|
+
const len = segLen[k - 1];
|
|
63
|
+
if (want <= len || k === points.length - 1) {
|
|
64
|
+
const f = len === 0 ? 0 : Math.min(1, want / len);
|
|
65
|
+
const ax = points[k - 1].x;
|
|
66
|
+
const ay = points[k - 1].y;
|
|
67
|
+
const bx = points[k].x;
|
|
68
|
+
const by = points[k].y;
|
|
69
|
+
const dx = bx - ax;
|
|
70
|
+
const dy = by - ay;
|
|
71
|
+
const dlen = Math.hypot(dx, dy) || 1;
|
|
72
|
+
return {
|
|
73
|
+
p: { x: ax + dx * f, y: ay + dy * f },
|
|
74
|
+
nx: -dy / dlen,
|
|
75
|
+
ny: dx / dlen
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
want -= len;
|
|
79
|
+
}
|
|
80
|
+
const last = points[points.length - 1];
|
|
81
|
+
return { p: { x: last.x, y: last.y }, nx: 0, ny: 1 };
|
|
82
|
+
}
|
|
83
|
+
function rectFromCenter(cx, cy, w, h) {
|
|
84
|
+
return {
|
|
85
|
+
minX: cx - w / 2,
|
|
86
|
+
minY: cy - h / 2,
|
|
87
|
+
maxX: cx + w / 2,
|
|
88
|
+
maxY: cy + h / 2
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function overlapsAny(cx, cy, w, h, obstacles, pad) {
|
|
92
|
+
const minX = cx - w / 2 - pad;
|
|
93
|
+
const minY = cy - h / 2 - pad;
|
|
94
|
+
const maxX = cx + w / 2 + pad;
|
|
95
|
+
const maxY = cy + h / 2 + pad;
|
|
96
|
+
for (const o of obstacles) {
|
|
97
|
+
if (minX < o.maxX && maxX > o.minX && minY < o.maxY && maxY > o.minY)
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
function slideFractions() {
|
|
103
|
+
const out = [0.5];
|
|
104
|
+
for (let k = 1; k <= SLIDE_SAMPLES; k++) {
|
|
105
|
+
const off = k * 0.08;
|
|
106
|
+
if (0.5 - off >= 0.12) out.push(0.5 - off);
|
|
107
|
+
if (0.5 + off <= 0.88) out.push(0.5 + off);
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
function findClearPosition(w, h, points, obstacles, perpMax) {
|
|
112
|
+
const ts = slideFractions();
|
|
113
|
+
for (const t of ts) {
|
|
114
|
+
const { p } = pointAtArcFraction(points, t);
|
|
115
|
+
if (!overlapsAny(p.x, p.y, w, h, obstacles, BOX_CLEAR_PAD)) return p;
|
|
116
|
+
}
|
|
117
|
+
for (let mag = PERP_STEP; mag <= perpMax; mag += PERP_STEP) {
|
|
118
|
+
for (const t of ts) {
|
|
119
|
+
const { p, nx, ny } = pointAtArcFraction(points, t);
|
|
120
|
+
for (const sign of [-1, 1]) {
|
|
121
|
+
const x = p.x + nx * mag * sign;
|
|
122
|
+
const y = p.y + ny * mag * sign;
|
|
123
|
+
if (!overlapsAny(x, y, w, h, obstacles, BOX_CLEAR_PAD)) return { x, y };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
function buildGroupContainers(groups) {
|
|
130
|
+
const byLabel = new Map(groups.map((g) => [g.label, g]));
|
|
131
|
+
const parent = /* @__PURE__ */ new Map();
|
|
132
|
+
for (const g of groups)
|
|
133
|
+
for (const c of g.children) if (byLabel.has(c)) parent.set(c, g.label);
|
|
134
|
+
for (const g of groups) if (g.parentGroup) parent.set(g.label, g.parentGroup);
|
|
135
|
+
const chainOf = (label) => {
|
|
136
|
+
const out = [];
|
|
137
|
+
const seen = /* @__PURE__ */ new Set();
|
|
138
|
+
let cur = label;
|
|
139
|
+
while (cur !== void 0 && byLabel.has(cur) && !seen.has(cur)) {
|
|
140
|
+
seen.add(cur);
|
|
141
|
+
out.push(cur);
|
|
142
|
+
cur = parent.get(cur);
|
|
143
|
+
}
|
|
144
|
+
return out;
|
|
145
|
+
};
|
|
146
|
+
const containers = /* @__PURE__ */ new Map();
|
|
147
|
+
for (const g of groups) containers.set(g.label, new Set(chainOf(g.label)));
|
|
148
|
+
for (const g of groups) {
|
|
149
|
+
const chain = chainOf(g.label);
|
|
150
|
+
for (const c of g.children) {
|
|
151
|
+
if (byLabel.has(c)) continue;
|
|
152
|
+
let set = containers.get(c);
|
|
153
|
+
if (!set) {
|
|
154
|
+
set = /* @__PURE__ */ new Set();
|
|
155
|
+
containers.set(c, set);
|
|
156
|
+
}
|
|
157
|
+
for (const a of chain) set.add(a);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return containers;
|
|
161
|
+
}
|
|
162
|
+
function resolveLabelOverlaps(boxes) {
|
|
163
|
+
const MAX_PASSES = 8;
|
|
164
|
+
const PAD = 4;
|
|
165
|
+
for (let pass = 0; pass < MAX_PASSES; pass++) {
|
|
166
|
+
let moved = false;
|
|
167
|
+
for (let i = 0; i < boxes.length; i++) {
|
|
168
|
+
for (let j = i + 1; j < boxes.length; j++) {
|
|
169
|
+
const a = boxes[i];
|
|
170
|
+
const b = boxes[j];
|
|
171
|
+
const dx = Math.abs(a.cx - b.cx);
|
|
172
|
+
const dy = Math.abs(a.cy - b.cy);
|
|
173
|
+
const overlapX = (a.w + b.w) / 2 + PAD - dx;
|
|
174
|
+
const overlapY = (a.h + b.h) / 2 + PAD - dy;
|
|
175
|
+
if (overlapX > 0 && overlapY > 0) {
|
|
176
|
+
const shift = overlapY / 2 + 1;
|
|
177
|
+
if (a.cy < b.cy) {
|
|
178
|
+
a.cy -= shift;
|
|
179
|
+
b.cy += shift;
|
|
180
|
+
} else {
|
|
181
|
+
a.cy += shift;
|
|
182
|
+
b.cy -= shift;
|
|
183
|
+
}
|
|
184
|
+
moved = true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (!moved) break;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function placeEdgeLabels(layout, opts) {
|
|
192
|
+
const fontSize = opts?.fontSize ?? EDGE_LABEL_FONT_SIZE;
|
|
193
|
+
const maxWidth = opts?.maxWidth ?? LABEL_MAX_WIDTH;
|
|
194
|
+
const perpMax = opts?.perpMax ?? LABEL_REACH_NEAR;
|
|
195
|
+
const baseObstacles = [];
|
|
196
|
+
for (const n of layout.nodes)
|
|
197
|
+
baseObstacles.push(rectFromCenter(n.x, n.y, n.width, n.height));
|
|
198
|
+
const expandedGroups = [];
|
|
199
|
+
for (const g of layout.groups) {
|
|
200
|
+
const r = rectFromCenter(g.x, g.y, g.width, g.height);
|
|
201
|
+
if (g.collapsed) baseObstacles.push(r);
|
|
202
|
+
else expandedGroups.push({ label: g.label, rect: r });
|
|
203
|
+
}
|
|
204
|
+
const containers = buildGroupContainers(opts?.groups ?? []);
|
|
205
|
+
const noContainers = /* @__PURE__ */ new Set();
|
|
206
|
+
const obstacleCache = /* @__PURE__ */ new Map();
|
|
207
|
+
const obstaclesFor = (edgeIdx) => {
|
|
208
|
+
const cached = obstacleCache.get(edgeIdx);
|
|
209
|
+
if (cached !== void 0) return cached;
|
|
210
|
+
let out = baseObstacles;
|
|
211
|
+
if (expandedGroups.length > 0) {
|
|
212
|
+
const e = layout.edges[edgeIdx];
|
|
213
|
+
const src = containers.get(e.source) ?? noContainers;
|
|
214
|
+
const tgt = containers.get(e.target) ?? noContainers;
|
|
215
|
+
const foreign = expandedGroups.filter((g) => !(src.has(g.label) && tgt.has(g.label))).map((g) => g.rect);
|
|
216
|
+
if (foreign.length > 0) out = [...baseObstacles, ...foreign];
|
|
217
|
+
}
|
|
218
|
+
obstacleCache.set(edgeIdx, out);
|
|
219
|
+
return out;
|
|
220
|
+
};
|
|
221
|
+
const boxes = [];
|
|
222
|
+
layout.edges.forEach((e, idx) => {
|
|
223
|
+
if (!e.label || e.points.length < 2) return;
|
|
224
|
+
const m = measureEdgeLabel(e.label, fontSize, maxWidth);
|
|
225
|
+
const mid = edgePolylineMidpoint(e.points);
|
|
226
|
+
let cy = mid.y;
|
|
227
|
+
if (e.parallelCount > 1 && e.yOffset !== 0)
|
|
228
|
+
cy += (e.yOffset < 0 ? -1 : 1) * (m.height / 2);
|
|
229
|
+
boxes.push({
|
|
230
|
+
edgeIdx: idx,
|
|
231
|
+
cx: mid.x,
|
|
232
|
+
cy,
|
|
233
|
+
w: m.width,
|
|
234
|
+
h: m.height,
|
|
235
|
+
lines: m.lines,
|
|
236
|
+
resolved: true
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
for (const box of boxes) {
|
|
240
|
+
const obstacles = obstaclesFor(box.edgeIdx);
|
|
241
|
+
if (!overlapsAny(box.cx, box.cy, box.w, box.h, obstacles, BOX_CLEAR_PAD))
|
|
242
|
+
continue;
|
|
243
|
+
const e = layout.edges[box.edgeIdx];
|
|
244
|
+
const clear = findClearPosition(box.w, box.h, e.points, obstacles, perpMax) ?? findClearPosition(box.w, box.h, e.points, baseObstacles, perpMax);
|
|
245
|
+
if (clear) {
|
|
246
|
+
box.cx = clear.x;
|
|
247
|
+
box.cy = clear.y;
|
|
248
|
+
}
|
|
249
|
+
if (overlapsAny(box.cx, box.cy, box.w, box.h, obstacles, BOX_CLEAR_PAD))
|
|
250
|
+
box.resolved = false;
|
|
251
|
+
}
|
|
252
|
+
resolveLabelOverlaps(boxes);
|
|
253
|
+
for (const box of boxes) {
|
|
254
|
+
const obstacles = obstaclesFor(box.edgeIdx);
|
|
255
|
+
if (overlapsAny(box.cx, box.cy, box.w, box.h, obstacles, BOX_CLEAR_PAD))
|
|
256
|
+
box.resolved = false;
|
|
257
|
+
}
|
|
258
|
+
const boxByIdx = /* @__PURE__ */ new Map();
|
|
259
|
+
for (const b of boxes) boxByIdx.set(b.edgeIdx, b);
|
|
260
|
+
const edges = layout.edges.map((e, idx) => {
|
|
261
|
+
const b = boxByIdx.get(idx);
|
|
262
|
+
if (!b) return e;
|
|
263
|
+
return {
|
|
264
|
+
...e,
|
|
265
|
+
labelX: b.cx,
|
|
266
|
+
labelY: b.cy,
|
|
267
|
+
labelWidth: b.w,
|
|
268
|
+
labelHeight: b.h,
|
|
269
|
+
labelLines: b.lines,
|
|
270
|
+
labelResolved: b.resolved
|
|
271
|
+
};
|
|
272
|
+
});
|
|
273
|
+
return {
|
|
274
|
+
layout: { ...layout, edges },
|
|
275
|
+
unresolved: boxes.filter((b) => !b.resolved).map((b) => b.edgeIdx)
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export {
|
|
280
|
+
NODE_HEIGHT,
|
|
281
|
+
NODE_WIDTH,
|
|
282
|
+
EDGE_LABEL_FONT_SIZE,
|
|
283
|
+
BOX_CLEAR_PAD,
|
|
284
|
+
LABEL_REACH_WIDE,
|
|
285
|
+
measureEdgeLabel,
|
|
286
|
+
placeEdgeLabels
|
|
287
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
layoutOrg
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-33FQ6HNV.js";
|
|
4
4
|
import {
|
|
5
5
|
renderCollapseBar,
|
|
6
6
|
renderNodeCard
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-R2K5L4UA.js";
|
|
8
8
|
import {
|
|
9
9
|
ScaleContext
|
|
10
10
|
} from "./chunk-24YPR5EH.js";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
META_LINE_HEIGHT,
|
|
25
25
|
NODE_STROKE_WIDTH,
|
|
26
26
|
SEPARATOR_GAP
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-XCKNFFKM.js";
|
|
28
28
|
import {
|
|
29
29
|
extractExportSvg,
|
|
30
30
|
runInExportContainer
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-WMIKC5XO.js";
|
|
4
4
|
import {
|
|
5
5
|
renderNodeCard
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-R2K5L4UA.js";
|
|
7
7
|
import {
|
|
8
8
|
renderInlineText
|
|
9
9
|
} from "./chunk-FWNJDD4U.js";
|
|
10
10
|
import {
|
|
11
11
|
formatDateLabel
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QPE646M2.js";
|
|
13
13
|
import {
|
|
14
14
|
CARD_RADIUS,
|
|
15
15
|
HAIRLINE_DASH,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
LABEL_FONT_SIZE,
|
|
18
18
|
NODE_STROKE_WIDTH,
|
|
19
19
|
SEPARATOR_GAP
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-XCKNFFKM.js";
|
|
21
21
|
import {
|
|
22
22
|
layoutInlineHeader
|
|
23
23
|
} from "./chunk-3DOQOXXI.js";
|
|
@@ -5,6 +5,7 @@ var CARD_RADIUS = 6;
|
|
|
5
5
|
var CONTAINER_RADIUS = 8;
|
|
6
6
|
var COLLAPSE_BAR_INSET = 0;
|
|
7
7
|
var EDGE_LABEL_KNOCKOUT_OPACITY = 0.9;
|
|
8
|
+
var EDGE_LABEL_UNRESOLVED_KNOCKOUT_OPACITY = 1;
|
|
8
9
|
var ARROWHEAD_WIDTH = 10;
|
|
9
10
|
var ARROWHEAD_HEIGHT = 7;
|
|
10
11
|
var EDGE_DASH = "6 3";
|
|
@@ -31,6 +32,7 @@ export {
|
|
|
31
32
|
CONTAINER_RADIUS,
|
|
32
33
|
COLLAPSE_BAR_INSET,
|
|
33
34
|
EDGE_LABEL_KNOCKOUT_OPACITY,
|
|
35
|
+
EDGE_LABEL_UNRESOLVED_KNOCKOUT_OPACITY,
|
|
34
36
|
ARROWHEAD_WIDTH,
|
|
35
37
|
ARROWHEAD_HEIGHT,
|
|
36
38
|
EDGE_DASH,
|
|
@@ -79,7 +79,17 @@ interface ResolveUrlOptions {
|
|
|
79
79
|
/** Origin of the Cloud API. */
|
|
80
80
|
base?: string;
|
|
81
81
|
}
|
|
82
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* The URL to fetch a reference's source from. Always the current revision.
|
|
84
|
+
*
|
|
85
|
+
* 🔴 Throws on an id that is not id-shaped, `undefined` and `''` included. The
|
|
86
|
+
* parsers above never produce one, so a bad id here means a caller built the
|
|
87
|
+
* reference by hand. Interpolating it anyway sent
|
|
88
|
+
* `GET /public/diagrams/undefined/source` to the Cloud API 56 times in one day
|
|
89
|
+
* from a Node process nobody could name, because a 404 on the server carries no
|
|
90
|
+
* stack. Refusing here makes that caller fail in its own process, where the
|
|
91
|
+
* stack names it (#772).
|
|
92
|
+
*/
|
|
83
93
|
declare function referenceSourceUrl(ref: CloudReference, options?: ResolveUrlOptions): string;
|
|
84
94
|
/** The human share link for a reference — what a "view this in Diagrammo" link points at. */
|
|
85
95
|
declare function referenceShareUrl(ref: CloudReference, options?: {
|
package/dist/cloud-reference.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
isExtendedChartType,
|
|
7
7
|
knownChartTypeIds,
|
|
8
8
|
parseDgmo
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MSXRNVHB.js";
|
|
10
10
|
import "./chunk-EOYPX6SF.js";
|
|
11
11
|
import "./chunk-WP2RLGDI.js";
|
|
12
12
|
import "./chunk-A2RUBBVT.js";
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
looksLikeC4,
|
|
47
47
|
looksLikeGantt,
|
|
48
48
|
parseDgmoChartType
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-AQIBKTPG.js";
|
|
50
50
|
import "./chunk-3RYBTEF5.js";
|
|
51
51
|
import "./chunk-UNNJCSSQ.js";
|
|
52
52
|
import "./chunk-3TYUXC7D.js";
|
|
53
|
-
import "./chunk-
|
|
53
|
+
import "./chunk-7WGCQE2E.js";
|
|
54
54
|
import "./chunk-EQW6HOP4.js";
|
|
55
55
|
import "./chunk-DAOFNU6J.js";
|
|
56
56
|
import "./chunk-VPASQOR3.js";
|
|
@@ -72,7 +72,7 @@ import "./chunk-HSRQDWV7.js";
|
|
|
72
72
|
import "./chunk-4WW3SGMH.js";
|
|
73
73
|
import "./chunk-L5AFONQU.js";
|
|
74
74
|
import "./chunk-44GP7PD5.js";
|
|
75
|
-
import "./chunk-
|
|
75
|
+
import "./chunk-5NU7NII2.js";
|
|
76
76
|
import "./chunk-IDJGV6VM.js";
|
|
77
77
|
import "./chunk-7HWY4QAJ.js";
|
|
78
78
|
import "./chunk-2M4IGSCY.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mapContentAspect,
|
|
3
3
|
mapExportDimensions
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-VJ2KROJ5.js";
|
|
5
|
+
import "./chunk-BV6PKJUS.js";
|
|
6
6
|
import "./chunk-4QV26TEG.js";
|
|
7
7
|
import "./chunk-KMU65FYM.js";
|
|
8
8
|
import "./chunk-VLC6WNRD.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderFlowchart,
|
|
3
3
|
renderFlowchartForExport
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4ELXLATB.js";
|
|
5
5
|
import "./chunk-26EVL454.js";
|
|
6
6
|
import "./chunk-PBEH52A2.js";
|
|
7
7
|
import "./chunk-5JO443MB.js";
|
|
@@ -13,7 +13,7 @@ import "./chunk-WMIKC5XO.js";
|
|
|
13
13
|
import "./chunk-FWNJDD4U.js";
|
|
14
14
|
import "./chunk-EPDBWATV.js";
|
|
15
15
|
import "./chunk-24YPR5EH.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-XCKNFFKM.js";
|
|
17
17
|
import "./chunk-LD2JSKU3.js";
|
|
18
18
|
import "./chunk-VLC6WNRD.js";
|
|
19
19
|
import "./chunk-ICLB27PZ.js";
|
package/dist/index.js
CHANGED
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
} from "./chunk-SQAG3UXH.js";
|
|
12
12
|
import {
|
|
13
13
|
render
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4YA5XW43.js";
|
|
15
15
|
import {
|
|
16
16
|
renderErrorCard
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-D4M25W6R.js";
|
|
18
18
|
import {
|
|
19
19
|
getDiagnosticSpec,
|
|
20
20
|
listDiagnosticCodes,
|
|
21
21
|
parseDgmo
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-MSXRNVHB.js";
|
|
23
23
|
import "./chunk-EOYPX6SF.js";
|
|
24
24
|
import "./chunk-WP2RLGDI.js";
|
|
25
25
|
import "./chunk-A2RUBBVT.js";
|
|
@@ -34,12 +34,12 @@ import "./chunk-KMU65FYM.js";
|
|
|
34
34
|
import "./chunk-EPDBWATV.js";
|
|
35
35
|
import "./chunk-7UDAIP6W.js";
|
|
36
36
|
import "./chunk-2CW5ZTNH.js";
|
|
37
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-QPE646M2.js";
|
|
38
38
|
import "./chunk-YRYKTYMQ.js";
|
|
39
39
|
import "./chunk-24YPR5EH.js";
|
|
40
40
|
import {
|
|
41
41
|
GRID_DASH
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-XCKNFFKM.js";
|
|
43
43
|
import "./chunk-RE6TVIAV.js";
|
|
44
44
|
import "./chunk-QFIXL3OK.js";
|
|
45
45
|
import "./chunk-3DOQOXXI.js";
|
|
@@ -82,11 +82,11 @@ import {
|
|
|
82
82
|
decodeDiagramUrl,
|
|
83
83
|
encodeDiagramUrl
|
|
84
84
|
} from "./chunk-RE27AX7O.js";
|
|
85
|
-
import "./chunk-
|
|
85
|
+
import "./chunk-AQIBKTPG.js";
|
|
86
86
|
import "./chunk-3RYBTEF5.js";
|
|
87
87
|
import "./chunk-UNNJCSSQ.js";
|
|
88
88
|
import "./chunk-3TYUXC7D.js";
|
|
89
|
-
import "./chunk-
|
|
89
|
+
import "./chunk-7WGCQE2E.js";
|
|
90
90
|
import "./chunk-EQW6HOP4.js";
|
|
91
91
|
import "./chunk-DAOFNU6J.js";
|
|
92
92
|
import "./chunk-VPASQOR3.js";
|
|
@@ -110,7 +110,7 @@ import "./chunk-L5AFONQU.js";
|
|
|
110
110
|
import {
|
|
111
111
|
chartTypes
|
|
112
112
|
} from "./chunk-44GP7PD5.js";
|
|
113
|
-
import "./chunk-
|
|
113
|
+
import "./chunk-5NU7NII2.js";
|
|
114
114
|
import {
|
|
115
115
|
getPalette,
|
|
116
116
|
palettes,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
layoutMindmap
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UIUXIDBX.js";
|
|
4
4
|
import "./chunk-24YPR5EH.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-XCKNFFKM.js";
|
|
6
6
|
import "./chunk-KAO7JL4I.js";
|
|
7
7
|
import "./chunk-IYULMRBE.js";
|
|
8
8
|
import "./chunk-L5AFONQU.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
focusFamily,
|
|
3
3
|
layoutFamily
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IJ27L3R4.js";
|
|
5
5
|
import "./chunk-IVKC4GID.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-XCKNFFKM.js";
|
|
7
7
|
import "./chunk-QQJUTGQH.js";
|
|
8
8
|
import "./chunk-KAO7JL4I.js";
|
|
9
9
|
import "./chunk-5WRI5ZAA.js";
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
layoutC4Context,
|
|
7
7
|
layoutC4Deployment,
|
|
8
8
|
rollUpContextRelationships
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-DAX42XVH.js";
|
|
10
|
+
import "./chunk-XCKNFFKM.js";
|
|
11
11
|
import "./chunk-RH2PROYG.js";
|
|
12
12
|
import "./chunk-KAO7JL4I.js";
|
|
13
13
|
import "./chunk-L5AFONQU.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
computeNodeSize,
|
|
3
3
|
layoutBoxesAndLines
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-LIYWJ6DV.js";
|
|
5
|
+
import "./chunk-TW6WMZFW.js";
|
|
6
6
|
import "./chunk-HBCAY3KR.js";
|
|
7
7
|
import "./chunk-6EK55ART.js";
|
|
8
8
|
import "./chunk-ZGHV4QLK.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
measureEdgeLabel
|
|
5
|
-
} from "./chunk-Y7FTHOMD.js";
|
|
2
|
+
computeNodeSize
|
|
3
|
+
} from "./chunk-LIYWJ6DV.js";
|
|
6
4
|
import {
|
|
7
5
|
clipEndpointsToNodes,
|
|
8
6
|
groupedTierCandidates
|
|
9
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-EWSESGC2.js";
|
|
10
8
|
import {
|
|
9
|
+
EDGE_LABEL_FONT_SIZE,
|
|
11
10
|
NODE_HEIGHT,
|
|
12
|
-
NODE_WIDTH
|
|
13
|
-
|
|
11
|
+
NODE_WIDTH,
|
|
12
|
+
measureEdgeLabel
|
|
13
|
+
} from "./chunk-TW6WMZFW.js";
|
|
14
14
|
import "./chunk-HBCAY3KR.js";
|
|
15
15
|
import "./chunk-6EK55ART.js";
|
|
16
16
|
import "./chunk-ZGHV4QLK.js";
|
|
@@ -1779,7 +1779,12 @@ async function layoutBoxesAndLinesSearch(parsed, collapseInfo, opts) {
|
|
|
1779
1779
|
}
|
|
1780
1780
|
if (parsed.groups.length > 0 && collapsedGroupLabels.size === 0) {
|
|
1781
1781
|
try {
|
|
1782
|
-
layered = layered.concat(
|
|
1782
|
+
layered = layered.concat(
|
|
1783
|
+
// The reservation is passed on: a tier candidate that wins the pool on
|
|
1784
|
+
// badness is the layout that gets drawn, so a relayout asked to open a
|
|
1785
|
+
// corridor for a label has to reach this generator too (#778).
|
|
1786
|
+
groupedTierCandidates(parsed, sizes, { reserveEdgeLabels })
|
|
1787
|
+
);
|
|
1783
1788
|
} catch {
|
|
1784
1789
|
}
|
|
1785
1790
|
}
|