@zukhruf/diagram 0.3.30 → 0.3.31
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/lib/layouts/graph/areas.d.ts +27 -0
- package/dist/lib/layouts/graph/areas.d.ts.map +1 -0
- package/dist/lib/layouts/graph/areas.js +187 -0
- package/dist/lib/layouts/graph/areas.js.map +1 -0
- package/dist/lib/layouts/graph/graph-layout-result.d.ts +95 -0
- package/dist/lib/layouts/graph/graph-layout-result.d.ts.map +1 -0
- package/dist/lib/layouts/graph/graph-layout-result.js +2 -0
- package/dist/lib/layouts/graph/graph-layout-result.js.map +1 -0
- package/dist/lib/layouts/graph/graph-layout.d.ts +2 -1
- package/dist/lib/layouts/graph/graph-layout.d.ts.map +1 -1
- package/dist/lib/layouts/graph/graph-layout.js +5 -3
- package/dist/lib/layouts/graph/graph-layout.js.map +1 -1
- package/dist/lib/layouts/graph/gutters.d.ts +26 -0
- package/dist/lib/layouts/graph/gutters.d.ts.map +1 -0
- package/dist/lib/layouts/graph/gutters.js +123 -0
- package/dist/lib/layouts/graph/gutters.js.map +1 -0
- package/dist/lib/layouts/graph/layout.d.ts +10 -0
- package/dist/lib/layouts/graph/layout.d.ts.map +1 -0
- package/dist/lib/layouts/graph/layout.js +165 -0
- package/dist/lib/layouts/graph/layout.js.map +1 -0
- package/dist/lib/layouts/graph/legacy-graph-layout.d.ts +6 -0
- package/dist/lib/layouts/graph/legacy-graph-layout.d.ts.map +1 -0
- package/dist/lib/layouts/graph/legacy-graph-layout.js +542 -0
- package/dist/lib/layouts/graph/legacy-graph-layout.js.map +1 -0
- package/dist/lib/layouts/graph/measure.d.ts +44 -0
- package/dist/lib/layouts/graph/measure.d.ts.map +1 -0
- package/dist/lib/layouts/graph/measure.js +372 -0
- package/dist/lib/layouts/graph/measure.js.map +1 -0
- package/dist/lib/layouts/graph/node-content.d.ts +16 -0
- package/dist/lib/layouts/graph/node-content.d.ts.map +1 -0
- package/dist/lib/layouts/graph/node-content.js +323 -0
- package/dist/lib/layouts/graph/node-content.js.map +1 -0
- package/dist/lib/layouts/graph/text-block.d.ts +19 -0
- package/dist/lib/layouts/graph/text-block.d.ts.map +1 -0
- package/dist/lib/layouts/graph/text-block.js +86 -0
- package/dist/lib/layouts/graph/text-block.js.map +1 -0
- package/dist/lib/layouts/graph/tokens.d.ts +58 -0
- package/dist/lib/layouts/graph/tokens.d.ts.map +1 -0
- package/dist/lib/layouts/graph/tokens.js +108 -0
- package/dist/lib/layouts/graph/tokens.js.map +1 -0
- package/dist/lib/layouts/graph/tracks.d.ts +20 -0
- package/dist/lib/layouts/graph/tracks.d.ts.map +1 -0
- package/dist/lib/layouts/graph/tracks.js +47 -0
- package/dist/lib/layouts/graph/tracks.js.map +1 -0
- package/dist/lib/layouts/text/font-metrics.generated.d.ts +18 -0
- package/dist/lib/layouts/text/font-metrics.generated.d.ts.map +1 -0
- package/dist/lib/layouts/text/font-metrics.generated.js +1043 -0
- package/dist/lib/layouts/text/font-metrics.generated.js.map +1 -0
- package/dist/lib/layouts/text/font.d.ts +14 -0
- package/dist/lib/layouts/text/font.d.ts.map +1 -0
- package/dist/lib/layouts/text/font.js +11 -0
- package/dist/lib/layouts/text/font.js.map +1 -0
- package/dist/lib/layouts/text/measure-text.d.ts +13 -0
- package/dist/lib/layouts/text/measure-text.d.ts.map +1 -0
- package/dist/lib/layouts/text/measure-text.js +67 -0
- package/dist/lib/layouts/text/measure-text.js.map +1 -0
- package/dist/lib/model/diagram-ir.d.ts +14 -1
- package/dist/lib/model/diagram-ir.d.ts.map +1 -1
- package/dist/lib/model/diagram-ir.js.map +1 -1
- package/dist/lib/renderers/canvas/graph-canvas.d.ts.map +1 -1
- package/dist/lib/renderers/canvas/graph-canvas.js +148 -138
- package/dist/lib/renderers/canvas/graph-canvas.js.map +1 -1
- package/dist/lib/renderers/html/graph-html.d.ts.map +1 -1
- package/dist/lib/renderers/html/graph-html.js +462 -511
- package/dist/lib/renderers/html/graph-html.js.map +1 -1
- package/dist/lib/renderers/shared/graph-parts.d.ts +15 -13
- package/dist/lib/renderers/shared/graph-parts.d.ts.map +1 -1
- package/dist/lib/renderers/shared/graph-parts.js +649 -644
- package/dist/lib/renderers/shared/graph-parts.js.map +1 -1
- package/dist/lib/renderers/shared/node-parts.d.ts +20 -19
- package/dist/lib/renderers/shared/node-parts.d.ts.map +1 -1
- package/dist/lib/renderers/shared/node-parts.js +678 -811
- package/dist/lib/renderers/shared/node-parts.js.map +1 -1
- package/dist/lib/renderers/shared/run-spans.d.ts +8 -0
- package/dist/lib/renderers/shared/run-spans.d.ts.map +1 -0
- package/dist/lib/renderers/shared/run-spans.js +18 -0
- package/dist/lib/renderers/shared/run-spans.js.map +1 -0
- package/dist/lib/renderers/shared/text-runs.d.ts +21 -0
- package/dist/lib/renderers/shared/text-runs.d.ts.map +1 -0
- package/dist/lib/renderers/shared/text-runs.js +44 -0
- package/dist/lib/renderers/shared/text-runs.js.map +1 -0
- package/dist/lib/renderers/svg/graph-svg.d.ts.map +1 -1
- package/dist/lib/renderers/svg/graph-svg.js +304 -465
- package/dist/lib/renderers/svg/graph-svg.js.map +1 -1
- package/dist/lib/renderers/svg/timeline-svg.d.ts.map +1 -1
- package/dist/lib/renderers/svg/timeline-svg.js +10 -5
- package/dist/lib/renderers/svg/timeline-svg.js.map +1 -1
- package/dist/lib/renderers/webgpu/graph-flow-effects.d.ts +2 -2
- package/dist/lib/renderers/webgpu/graph-flow-effects.d.ts.map +1 -1
- package/dist/lib/renderers/webgpu/graph-flow-effects.js.map +1 -1
- package/package.json +3 -1
- package/styles.css +8 -0
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
// Temporary adapter: it builds one GraphLayout from the current engine in
|
|
2
|
+
// graph-layout.ts, so that the renderers paint only from a GraphLayout before
|
|
3
|
+
// the content-sized grid engine replaces it. Step 6 of the redesign deletes
|
|
4
|
+
// this file together with graph-layout.ts.
|
|
5
|
+
import { validateGraph } from "../../compiler/diagram-compile.js";
|
|
6
|
+
import { centeredBaselineOffset } from "../text-metrics.js";
|
|
7
|
+
import { fontAscent, fontDescent, measureText } from "../text/measure-text.js";
|
|
8
|
+
import { EDGE_BADGE_ICON, GROUP_LABEL_H, computePaths, edgeBadgeSize, edgeLabelFontSize, edgeLabelFrameBox, edgeLabelLineHeight, graphContentViewBox, groupBox, groupDividerLines, groupLabelHeight, groupLabelLines, groupPortPlacements, groupTitleGutterHeight, nodeBox, nodeCaptionBounds, nodeCaptionPlacement, nodeFrameRadius, nodePortPlacements, nodeStackCount, nodeStackFrameBox, nodeVisualBox, resolveGraphAnnotations, resolveGraphLayout } from "./graph-layout.js";
|
|
9
|
+
|
|
10
|
+
/** The prefix of the id of the note node that stands for a free annotation. */
|
|
11
|
+
export const ANNOTATION_NOTE_PREFIX = 'annotation:';
|
|
12
|
+
export function legacyGraphLayout(ir) {
|
|
13
|
+
validateGraph(ir);
|
|
14
|
+
const graph = resolveGraphLayout(ir);
|
|
15
|
+
const routedEdges = computePaths(graph);
|
|
16
|
+
const notes = resolveGraphAnnotations(graph).map(noteLayout);
|
|
17
|
+
return {
|
|
18
|
+
nodes: [...graph.nodes.map(node => nodeLayout(node, nodeBox(node, graph.layout))), ...notes.map(({
|
|
19
|
+
note
|
|
20
|
+
}) => note)],
|
|
21
|
+
groups: (graph.groups ?? []).map(group => groupLayout(group, graph)),
|
|
22
|
+
edges: routedEdges.map(edgeLayout),
|
|
23
|
+
leaders: notes.flatMap(({
|
|
24
|
+
leaders
|
|
25
|
+
}) => leaders),
|
|
26
|
+
viewBox: graphContentViewBox(graph, routedEdges)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const FONT_WEIGHTS = [400, 500, 600, 700];
|
|
30
|
+
function fontWeight(value) {
|
|
31
|
+
const weight = FONT_WEIGHTS.find(candidate => candidate === value);
|
|
32
|
+
if (weight === undefined) {
|
|
33
|
+
throw new Error(`Diagram font weight ${value} has no metrics; use 400, 500, 600 or 700.`);
|
|
34
|
+
}
|
|
35
|
+
return weight;
|
|
36
|
+
}
|
|
37
|
+
function labelLines(label, defaultWeight) {
|
|
38
|
+
return (Array.isArray(label) ? label : [label]).map(line => labelLine(line, defaultWeight));
|
|
39
|
+
}
|
|
40
|
+
function labelLine(line, defaultWeight) {
|
|
41
|
+
if (typeof line === 'string') {
|
|
42
|
+
return {
|
|
43
|
+
text: line,
|
|
44
|
+
weight: fontWeight(defaultWeight)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
text: line.text,
|
|
49
|
+
weight: fontWeight(line.fontWeight ?? defaultWeight),
|
|
50
|
+
...(line.textColor ? {
|
|
51
|
+
color: line.textColor
|
|
52
|
+
} : {})
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function plainLines(texts, weight) {
|
|
56
|
+
const resolved = fontWeight(weight);
|
|
57
|
+
return texts.map(text => ({
|
|
58
|
+
text,
|
|
59
|
+
weight: resolved
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
function textRun(line, x, y, anchor, font, letterSpacing = 0) {
|
|
63
|
+
const w = measureText(line.text, font) + letterSpacing * [...line.text].length;
|
|
64
|
+
const left = anchor === 'start' ? x : anchor === 'middle' ? x - w / 2 : x - w;
|
|
65
|
+
const ascent = fontAscent(font);
|
|
66
|
+
return {
|
|
67
|
+
text: line.text,
|
|
68
|
+
x,
|
|
69
|
+
y,
|
|
70
|
+
anchor,
|
|
71
|
+
font,
|
|
72
|
+
...(line.color ? {
|
|
73
|
+
color: line.color
|
|
74
|
+
} : {}),
|
|
75
|
+
bounds: {
|
|
76
|
+
x: left,
|
|
77
|
+
y: y - ascent,
|
|
78
|
+
w,
|
|
79
|
+
h: ascent + fontDescent(font)
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function textBlock(lines, block) {
|
|
84
|
+
return lines.map((line, index) => textRun(line, block.x, block.y + index * block.lineHeight, block.anchor, {
|
|
85
|
+
face: block.face,
|
|
86
|
+
size: block.size,
|
|
87
|
+
weight: line.weight
|
|
88
|
+
}, block.letterSpacing));
|
|
89
|
+
}
|
|
90
|
+
function nonEmpty(lines) {
|
|
91
|
+
return lines.filter(line => line.text.length > 0);
|
|
92
|
+
}
|
|
93
|
+
function unionBox(boxes) {
|
|
94
|
+
const minX = Math.min(...boxes.map(box => box.x));
|
|
95
|
+
const minY = Math.min(...boxes.map(box => box.y));
|
|
96
|
+
const maxX = Math.max(...boxes.map(box => box.x + box.w));
|
|
97
|
+
const maxY = Math.max(...boxes.map(box => box.y + box.h));
|
|
98
|
+
return {
|
|
99
|
+
x: minX,
|
|
100
|
+
y: minY,
|
|
101
|
+
w: maxX - minX,
|
|
102
|
+
h: maxY - minY
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function nodeLayout(node, box) {
|
|
106
|
+
const content = nodeContent(node, box);
|
|
107
|
+
const captionLayout = nodeCaption(node, box);
|
|
108
|
+
const frames = (node.frame ?? 'solid') === 'none' ? [] : Array.from({
|
|
109
|
+
length: nodeStackCount(node) - 1
|
|
110
|
+
}, (_, i) => nodeStackFrameBox(node, box, i + 1));
|
|
111
|
+
const stacked = nodeVisualBox(node, box);
|
|
112
|
+
return {
|
|
113
|
+
node,
|
|
114
|
+
box,
|
|
115
|
+
visual: captionLayout ? unionBox([stacked, captionLayout.box]) : stacked,
|
|
116
|
+
frames,
|
|
117
|
+
radius: content.radius ?? nodeFrameRadius(node),
|
|
118
|
+
...(content.icon ? {
|
|
119
|
+
icon: content.icon
|
|
120
|
+
} : {}),
|
|
121
|
+
text: content.text,
|
|
122
|
+
bullets: content.bullets ?? [],
|
|
123
|
+
...(captionLayout ? {
|
|
124
|
+
caption: captionLayout
|
|
125
|
+
} : {}),
|
|
126
|
+
ports: nodePortPlacements(node, box).map(portLayout),
|
|
127
|
+
...(content.appliance ? {
|
|
128
|
+
appliance: content.appliance
|
|
129
|
+
} : {})
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function nodeContent(node, box) {
|
|
133
|
+
if (node.kind === 'appliance') return applianceContent(node, box);
|
|
134
|
+
if (node.kind === 'connector') return connectorContent(node, box);
|
|
135
|
+
if (node.kind === 'marker') return markerContent(node, box);
|
|
136
|
+
if (node.kind === 'junction') return junctionContent(node, box);
|
|
137
|
+
const descriptionLines = [node.description ?? []].flat();
|
|
138
|
+
const hasBodyLayout = (node.textAlign ?? 'center') === 'start' || Boolean(node.icon) || descriptionLines.length > 0;
|
|
139
|
+
return hasBodyLayout ? cardContent(node, box, descriptionLines) : centredLabelContent(node, box);
|
|
140
|
+
}
|
|
141
|
+
function centredLabelContent(node, box) {
|
|
142
|
+
const lines = labelLines(node.label, node.fontWeight ?? 500);
|
|
143
|
+
const fontSize = node.fontSize ?? 12;
|
|
144
|
+
const lineHeight = Math.max(12, fontSize + 2);
|
|
145
|
+
const centerY = box.y + box.h / 2;
|
|
146
|
+
return {
|
|
147
|
+
text: textBlock(lines, {
|
|
148
|
+
x: box.x + box.w / 2,
|
|
149
|
+
y: centerY - (lines.length - 1) * lineHeight / 2 + centeredBaselineOffset(fontSize, 'mono'),
|
|
150
|
+
lineHeight,
|
|
151
|
+
anchor: 'middle',
|
|
152
|
+
face: 'mono',
|
|
153
|
+
size: fontSize,
|
|
154
|
+
letterSpacing: 0.6
|
|
155
|
+
})
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function cardContent(node, box, descriptionLines) {
|
|
159
|
+
const titleLines = labelLines(node.label, node.fontWeight ?? 700);
|
|
160
|
+
const itemLines = node.items ?? [];
|
|
161
|
+
const hasText = titleLines.some(line => line.text.length > 0);
|
|
162
|
+
const iconSize = node.iconSize ?? (node.icon === 'ellipsis' ? 34 : 42);
|
|
163
|
+
const cardPadX = 28;
|
|
164
|
+
const headerGap = 22;
|
|
165
|
+
const hasBody = descriptionLines.length > 0 || itemLines.length > 0;
|
|
166
|
+
const hasHeaderIcon = Boolean(node.icon && hasText && hasBody);
|
|
167
|
+
const iconX = hasText || hasBody ? box.x + cardPadX : box.x + box.w / 2 - iconSize / 2;
|
|
168
|
+
const iconY = hasText || hasBody ? box.y + 28 : box.y + box.h / 2 - iconSize / 2;
|
|
169
|
+
const titleX = node.icon ? iconX + iconSize + headerGap : box.x + cardPadX;
|
|
170
|
+
const bodyX = hasHeaderIcon ? box.x + cardPadX : titleX;
|
|
171
|
+
const titleSize = node.fontSize ?? 15;
|
|
172
|
+
const titleLineHeight = titleSize + 4;
|
|
173
|
+
const titleY = hasBody ? box.y + 44 : box.y + box.h / 2 - (titleLines.length - 1) * titleLineHeight / 2 + titleSize * 0.35;
|
|
174
|
+
const bodySize = node.bodyFontSize ?? Math.max(11, titleSize - 2);
|
|
175
|
+
const bodyY = titleY + titleLines.length * titleLineHeight + 8;
|
|
176
|
+
const bodyLineHeight = bodySize + (node.bodyLineGap ?? 3);
|
|
177
|
+
const itemY = bodyY + (descriptionLines.length > 0 ? descriptionLines.length * bodyLineHeight + 6 : 0);
|
|
178
|
+
const body = {
|
|
179
|
+
lineHeight: bodyLineHeight,
|
|
180
|
+
anchor: 'start',
|
|
181
|
+
face: 'sans',
|
|
182
|
+
size: bodySize
|
|
183
|
+
};
|
|
184
|
+
const items = textBlock(plainLines(itemLines, 400), {
|
|
185
|
+
...body,
|
|
186
|
+
x: bodyX + 12,
|
|
187
|
+
y: itemY
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
...(node.icon ? {
|
|
191
|
+
icon: {
|
|
192
|
+
x: iconX,
|
|
193
|
+
y: iconY,
|
|
194
|
+
size: iconSize
|
|
195
|
+
}
|
|
196
|
+
} : {}),
|
|
197
|
+
text: [...(hasText ? textBlock(titleLines, {
|
|
198
|
+
x: titleX,
|
|
199
|
+
y: titleY,
|
|
200
|
+
lineHeight: titleLineHeight,
|
|
201
|
+
anchor: 'start',
|
|
202
|
+
face: 'sans',
|
|
203
|
+
size: titleSize
|
|
204
|
+
}) : []), ...textBlock(plainLines(descriptionLines, 400), {
|
|
205
|
+
...body,
|
|
206
|
+
x: bodyX,
|
|
207
|
+
y: bodyY
|
|
208
|
+
}), ...items],
|
|
209
|
+
bullets: items.map(item => ({
|
|
210
|
+
x: bodyX + 3,
|
|
211
|
+
y: item.y - 3
|
|
212
|
+
}))
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function applianceContent(node, box) {
|
|
216
|
+
const fontSize = node.fontSize ?? 12;
|
|
217
|
+
const bodyX = box.x + 4;
|
|
218
|
+
const bodyY = box.y + Math.max(12, Math.min(22, box.h * 0.28));
|
|
219
|
+
const bodyW = Math.max(36, box.w - 8);
|
|
220
|
+
const bodyH = Math.max(24, box.h - (bodyY - box.y) - 12);
|
|
221
|
+
const slant = Math.max(4, Math.min(node.slant ?? 16, bodyW * 0.28, bodyH * 0.75));
|
|
222
|
+
const jackCount = Math.max(0, Math.floor(node.appliancePorts ?? 4));
|
|
223
|
+
const jackY = bodyY + bodyH - 15;
|
|
224
|
+
const jackStartX = bodyX + slant + 16;
|
|
225
|
+
const jackSpacing = Math.min(13, Math.max(8, (bodyW - slant - 42) / Math.max(jackCount, 1)));
|
|
226
|
+
const antenna = node.antenna ?? true ? [[{
|
|
227
|
+
x: bodyX + slant + bodyW * 0.18,
|
|
228
|
+
y: bodyY + 1
|
|
229
|
+
}, {
|
|
230
|
+
x: bodyX + slant + bodyW * 0.2 - 3,
|
|
231
|
+
y: box.y + 3
|
|
232
|
+
}], [{
|
|
233
|
+
x: bodyX + slant + bodyW * 0.2 + 1,
|
|
234
|
+
y: bodyY + 2
|
|
235
|
+
}, {
|
|
236
|
+
x: bodyX + slant + bodyW * 0.2 + 1,
|
|
237
|
+
y: box.y + 8
|
|
238
|
+
}]] : [];
|
|
239
|
+
return {
|
|
240
|
+
text: textBlock(nonEmpty(labelLines(node.label, node.fontWeight ?? 600)), {
|
|
241
|
+
x: box.x + box.w / 2,
|
|
242
|
+
y: bodyY + bodyH + Math.max(12, fontSize + 2),
|
|
243
|
+
lineHeight: Math.max(12, fontSize + 2),
|
|
244
|
+
anchor: 'middle',
|
|
245
|
+
face: 'sans',
|
|
246
|
+
size: fontSize
|
|
247
|
+
}),
|
|
248
|
+
appliance: {
|
|
249
|
+
body: [{
|
|
250
|
+
x: bodyX + slant,
|
|
251
|
+
y: bodyY
|
|
252
|
+
}, {
|
|
253
|
+
x: bodyX + bodyW,
|
|
254
|
+
y: bodyY + 6
|
|
255
|
+
}, {
|
|
256
|
+
x: bodyX + bodyW - slant,
|
|
257
|
+
y: bodyY + bodyH
|
|
258
|
+
}, {
|
|
259
|
+
x: bodyX,
|
|
260
|
+
y: bodyY + bodyH - 6
|
|
261
|
+
}],
|
|
262
|
+
face: [{
|
|
263
|
+
x: bodyX + slant,
|
|
264
|
+
y: bodyY + bodyH - 1
|
|
265
|
+
}, {
|
|
266
|
+
x: bodyX + bodyW - slant,
|
|
267
|
+
y: bodyY + bodyH + 3
|
|
268
|
+
}],
|
|
269
|
+
antenna,
|
|
270
|
+
jacks: Array.from({
|
|
271
|
+
length: jackCount
|
|
272
|
+
}, (_, i) => ({
|
|
273
|
+
x: jackStartX + i * jackSpacing,
|
|
274
|
+
y: jackY,
|
|
275
|
+
w: 5,
|
|
276
|
+
h: 12
|
|
277
|
+
}))
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function connectorContent(node, box) {
|
|
282
|
+
const centerY = box.y + box.h / 2;
|
|
283
|
+
const iconSize = node.iconSize ?? 18;
|
|
284
|
+
const fontSize = node.fontSize ?? 10;
|
|
285
|
+
const lineHeight = Math.max(12, fontSize + 2);
|
|
286
|
+
const lines = nonEmpty(labelLines(node.label, node.fontWeight ?? 700));
|
|
287
|
+
const iconX = box.x + 10;
|
|
288
|
+
return {
|
|
289
|
+
radius: node.rx ?? Math.min(12, box.h / 2),
|
|
290
|
+
...(node.icon ? {
|
|
291
|
+
icon: {
|
|
292
|
+
x: iconX,
|
|
293
|
+
y: centerY - iconSize / 2,
|
|
294
|
+
size: iconSize
|
|
295
|
+
}
|
|
296
|
+
} : {}),
|
|
297
|
+
text: textBlock(lines, {
|
|
298
|
+
x: node.icon ? iconX + iconSize + 8 : box.x + box.w / 2,
|
|
299
|
+
y: centerY - (lines.length - 1) * lineHeight / 2 + fontSize * 0.35,
|
|
300
|
+
lineHeight,
|
|
301
|
+
anchor: node.icon ? 'start' : 'middle',
|
|
302
|
+
face: 'sans',
|
|
303
|
+
size: fontSize
|
|
304
|
+
})
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function markerContent(node, box) {
|
|
308
|
+
const iconSize = node.iconSize ?? 34;
|
|
309
|
+
const fontSize = node.fontSize ?? 11;
|
|
310
|
+
const lineHeight = Math.max(12, fontSize + 2);
|
|
311
|
+
const lines = nonEmpty(labelLines(node.label, node.fontWeight ?? 700));
|
|
312
|
+
const labelGap = lines.length > 0 ? 8 : 0;
|
|
313
|
+
const totalHeight = iconSize + labelGap + lines.length * lineHeight;
|
|
314
|
+
const cx = box.x + box.w / 2;
|
|
315
|
+
const iconX = Math.round(cx - iconSize / 2);
|
|
316
|
+
const iconY = Math.round(box.y + (box.h - totalHeight) / 2);
|
|
317
|
+
return {
|
|
318
|
+
radius: node.rx ?? 0,
|
|
319
|
+
icon: {
|
|
320
|
+
x: iconX,
|
|
321
|
+
y: iconY,
|
|
322
|
+
size: iconSize
|
|
323
|
+
},
|
|
324
|
+
text: textBlock(lines, {
|
|
325
|
+
x: cx,
|
|
326
|
+
y: iconY + iconSize + labelGap + fontSize,
|
|
327
|
+
lineHeight,
|
|
328
|
+
anchor: 'middle',
|
|
329
|
+
face: 'sans',
|
|
330
|
+
size: fontSize
|
|
331
|
+
})
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function junctionContent(node, box) {
|
|
335
|
+
const lines = Array.isArray(node.label) ? node.label : [node.label];
|
|
336
|
+
const weight = node.fontWeight ?? 600;
|
|
337
|
+
return {
|
|
338
|
+
radius: Math.max(4, Math.min(box.w, box.h) / 2),
|
|
339
|
+
text: lines.some(Boolean) ? textBlock(lines.map(line => ({
|
|
340
|
+
text: typeof line === 'string' ? line : line.text,
|
|
341
|
+
weight: fontWeight(weight)
|
|
342
|
+
})), {
|
|
343
|
+
x: box.x + box.w / 2,
|
|
344
|
+
y: box.y + box.h / 2 - Math.max(8, box.h / 2 + 6),
|
|
345
|
+
lineHeight: Math.max(12, (node.fontSize ?? 12) + 2),
|
|
346
|
+
anchor: 'middle',
|
|
347
|
+
face: 'mono',
|
|
348
|
+
size: node.fontSize ?? 10
|
|
349
|
+
}) : []
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function nodeCaption(node, box) {
|
|
353
|
+
const placement = nodeCaptionPlacement(node, box);
|
|
354
|
+
const bounds = nodeCaptionBounds(node, box);
|
|
355
|
+
if (!placement || !bounds) return undefined;
|
|
356
|
+
const lines = plainLines(placement.lines, node.captionFontWeight ?? 600).map(line => node.captionColor ? {
|
|
357
|
+
...line,
|
|
358
|
+
color: node.captionColor
|
|
359
|
+
} : line);
|
|
360
|
+
return {
|
|
361
|
+
box: bounds,
|
|
362
|
+
framed: Boolean(node.captionFrame),
|
|
363
|
+
text: textBlock(lines, {
|
|
364
|
+
x: placement.x,
|
|
365
|
+
y: placement.y,
|
|
366
|
+
lineHeight: placement.lineHeight,
|
|
367
|
+
anchor: placement.align,
|
|
368
|
+
face: 'sans',
|
|
369
|
+
size: placement.fontSize
|
|
370
|
+
})
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function portLayout(port) {
|
|
374
|
+
return {
|
|
375
|
+
id: port.id,
|
|
376
|
+
side: port.side,
|
|
377
|
+
point: {
|
|
378
|
+
x: port.x,
|
|
379
|
+
y: port.y
|
|
380
|
+
},
|
|
381
|
+
...(port.label ? {
|
|
382
|
+
label: textRun({
|
|
383
|
+
text: port.label,
|
|
384
|
+
weight: 600
|
|
385
|
+
}, port.labelX, port.labelY, port.labelAlign, {
|
|
386
|
+
face: 'mono',
|
|
387
|
+
size: 9,
|
|
388
|
+
weight: 600
|
|
389
|
+
})
|
|
390
|
+
} : {})
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function groupLayout(group, graph) {
|
|
394
|
+
const rect = groupBox(group, graph.nodes, graph.layout, graph.groups);
|
|
395
|
+
const bandHeight = group.titleBand ? groupTitleGutterHeight(group) : 0;
|
|
396
|
+
const labelAlign = group.labelAlign ?? 'center';
|
|
397
|
+
const labelInset = 16;
|
|
398
|
+
return {
|
|
399
|
+
group,
|
|
400
|
+
depth: groupDepth(group, graph.groups ?? []),
|
|
401
|
+
rect,
|
|
402
|
+
...(bandHeight > 0 ? {
|
|
403
|
+
band: {
|
|
404
|
+
x: rect.x,
|
|
405
|
+
y: rect.y,
|
|
406
|
+
w: rect.w,
|
|
407
|
+
h: bandHeight
|
|
408
|
+
}
|
|
409
|
+
} : {}),
|
|
410
|
+
label: textBlock(plainLines(groupLabelLines(group), 600), {
|
|
411
|
+
x: labelAlign === 'start' ? rect.x + labelInset : labelAlign === 'end' ? rect.x + rect.w - labelInset : rect.x + rect.w / 2,
|
|
412
|
+
y: group.labelSide === 'bottom' ? rect.y + rect.h - groupLabelHeight(group) + GROUP_LABEL_H - 14 : rect.y + GROUP_LABEL_H,
|
|
413
|
+
lineHeight: 14,
|
|
414
|
+
anchor: labelAlign === 'center' ? 'middle' : labelAlign,
|
|
415
|
+
face: 'sans',
|
|
416
|
+
size: 12
|
|
417
|
+
}),
|
|
418
|
+
dividers: groupDividerLines(group, graph.nodes, graph.layout, graph.groups).map(line => [{
|
|
419
|
+
x: line.x1,
|
|
420
|
+
y: line.y1
|
|
421
|
+
}, {
|
|
422
|
+
x: line.x2,
|
|
423
|
+
y: line.y2
|
|
424
|
+
}]),
|
|
425
|
+
ports: groupPortPlacements(group, rect).map(portLayout)
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function groupDepth(group, groups) {
|
|
429
|
+
const parent = groups.find(candidate => candidate.id === group.parent);
|
|
430
|
+
return parent ? groupDepth(parent, groups) + 1 : 0;
|
|
431
|
+
}
|
|
432
|
+
function edgeLayout(routed) {
|
|
433
|
+
const {
|
|
434
|
+
edge,
|
|
435
|
+
labelPlacement,
|
|
436
|
+
badgePlacement
|
|
437
|
+
} = routed;
|
|
438
|
+
const layout = {
|
|
439
|
+
edge,
|
|
440
|
+
exitSide: routed.exitSide,
|
|
441
|
+
entrySide: routed.entrySide,
|
|
442
|
+
points: routed.points,
|
|
443
|
+
d: routed.d
|
|
444
|
+
};
|
|
445
|
+
if (edge.label?.length && labelPlacement) {
|
|
446
|
+
layout.label = {
|
|
447
|
+
box: edgeLabelFrameBox(edge, labelPlacement),
|
|
448
|
+
text: textBlock(plainLines(edge.label, 400), {
|
|
449
|
+
x: labelPlacement.x,
|
|
450
|
+
y: labelPlacement.y,
|
|
451
|
+
lineHeight: edgeLabelLineHeight(edge),
|
|
452
|
+
anchor: labelPlacement.align,
|
|
453
|
+
face: 'mono',
|
|
454
|
+
size: edgeLabelFontSize(edge)
|
|
455
|
+
}),
|
|
456
|
+
...(labelPlacement.segmentIndex === undefined ? {} : {
|
|
457
|
+
segment: labelPlacement.segmentIndex
|
|
458
|
+
})
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
const badgeLines = edge.badgeLabel ?? [];
|
|
462
|
+
if ((edge.badgeIcon || badgeLines.length > 0) && badgePlacement) {
|
|
463
|
+
const {
|
|
464
|
+
w,
|
|
465
|
+
h
|
|
466
|
+
} = edgeBadgeSize(edge);
|
|
467
|
+
const left = badgePlacement.x - w / 2;
|
|
468
|
+
const iconSize = edge.badgeIcon ? EDGE_BADGE_ICON : 0;
|
|
469
|
+
const iconGap = edge.badgeIcon && badgeLines.length > 0 ? 8 : 0;
|
|
470
|
+
layout.badge = {
|
|
471
|
+
box: {
|
|
472
|
+
x: left,
|
|
473
|
+
y: badgePlacement.y - h / 2,
|
|
474
|
+
w,
|
|
475
|
+
h
|
|
476
|
+
},
|
|
477
|
+
...(edge.badgeIcon ? {
|
|
478
|
+
icon: {
|
|
479
|
+
x: left + 8,
|
|
480
|
+
y: badgePlacement.y - iconSize / 2,
|
|
481
|
+
w: iconSize,
|
|
482
|
+
h: iconSize
|
|
483
|
+
}
|
|
484
|
+
} : {}),
|
|
485
|
+
text: textBlock(plainLines(badgeLines, 600), {
|
|
486
|
+
x: left + 8 + iconSize + iconGap,
|
|
487
|
+
y: badgePlacement.y - (badgeLines.length - 1) * 12 / 2 + 4,
|
|
488
|
+
lineHeight: 12,
|
|
489
|
+
anchor: 'start',
|
|
490
|
+
face: 'sans',
|
|
491
|
+
size: 10
|
|
492
|
+
})
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
return layout;
|
|
496
|
+
}
|
|
497
|
+
function noteLayout(annotation, index) {
|
|
498
|
+
const id = `${ANNOTATION_NOTE_PREFIX}${index}`;
|
|
499
|
+
const fontSize = annotation.fontSize ?? 11;
|
|
500
|
+
const lines = plainLines(annotation.text, annotation.fontWeight ?? 500).map(line => annotation.color ? {
|
|
501
|
+
...line,
|
|
502
|
+
color: annotation.color
|
|
503
|
+
} : line);
|
|
504
|
+
const text = textBlock(lines, {
|
|
505
|
+
x: annotation.x,
|
|
506
|
+
y: annotation.y,
|
|
507
|
+
lineHeight: fontSize + (annotation.lineGap ?? 4),
|
|
508
|
+
anchor: annotation.align ?? 'middle',
|
|
509
|
+
face: 'sans',
|
|
510
|
+
size: fontSize
|
|
511
|
+
});
|
|
512
|
+
const box = text.length > 0 ? unionBox(text.map(run => run.bounds)) : {
|
|
513
|
+
x: annotation.x,
|
|
514
|
+
y: annotation.y,
|
|
515
|
+
w: 0,
|
|
516
|
+
h: 0
|
|
517
|
+
};
|
|
518
|
+
return {
|
|
519
|
+
note: {
|
|
520
|
+
node: {
|
|
521
|
+
id,
|
|
522
|
+
kind: 'note',
|
|
523
|
+
label: annotation.text,
|
|
524
|
+
frame: 'none'
|
|
525
|
+
},
|
|
526
|
+
box,
|
|
527
|
+
visual: box,
|
|
528
|
+
frames: [],
|
|
529
|
+
radius: 0,
|
|
530
|
+
text,
|
|
531
|
+
bullets: [],
|
|
532
|
+
ports: []
|
|
533
|
+
},
|
|
534
|
+
leaders: (annotation.leaders ?? []).map(leader => ({
|
|
535
|
+
note: id,
|
|
536
|
+
target: leader.target,
|
|
537
|
+
points: leader.points,
|
|
538
|
+
d: leader.points.map((point, i) => `${i === 0 ? 'M' : 'L'} ${point.x} ${point.y}`).join(' ')
|
|
539
|
+
}))
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
//# sourceMappingURL=legacy-graph-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-graph-layout.js","names":["validateGraph","centeredBaselineOffset","fontAscent","fontDescent","measureText","EDGE_BADGE_ICON","GROUP_LABEL_H","computePaths","edgeBadgeSize","edgeLabelFontSize","edgeLabelFrameBox","edgeLabelLineHeight","graphContentViewBox","groupBox","groupDividerLines","groupLabelHeight","groupLabelLines","groupPortPlacements","groupTitleGutterHeight","nodeBox","nodeCaptionBounds","nodeCaptionPlacement","nodeFrameRadius","nodePortPlacements","nodeStackCount","nodeStackFrameBox","nodeVisualBox","resolveGraphAnnotations","resolveGraphLayout","ANNOTATION_NOTE_PREFIX","legacyGraphLayout","ir","graph","routedEdges","notes","map","noteLayout","nodes","node","nodeLayout","layout","note","groups","group","groupLayout","edges","edgeLayout","leaders","flatMap","viewBox","FONT_WEIGHTS","fontWeight","value","weight","find","candidate","undefined","Error","labelLines","label","defaultWeight","Array","isArray","line","labelLine","text","textColor","color","plainLines","texts","resolved","textRun","x","y","anchor","font","letterSpacing","w","length","left","ascent","bounds","h","textBlock","lines","block","index","lineHeight","face","size","nonEmpty","filter","unionBox","boxes","minX","Math","min","box","minY","maxX","max","maxY","content","nodeContent","captionLayout","nodeCaption","frames","frame","from","_","i","stacked","visual","radius","icon","bullets","caption","ports","portLayout","appliance","kind","applianceContent","connectorContent","markerContent","junctionContent","descriptionLines","description","flat","hasBodyLayout","textAlign","Boolean","cardContent","centredLabelContent","fontSize","centerY","titleLines","itemLines","items","hasText","some","iconSize","cardPadX","headerGap","hasBody","hasHeaderIcon","iconX","iconY","titleX","bodyX","titleSize","titleLineHeight","titleY","bodySize","bodyFontSize","bodyY","bodyLineHeight","bodyLineGap","itemY","body","item","bodyW","bodyH","slant","jackCount","floor","appliancePorts","jackY","jackStartX","jackSpacing","antenna","jacks","rx","labelGap","totalHeight","cx","round","placement","captionFontWeight","captionColor","framed","captionFrame","align","port","id","side","point","labelX","labelY","labelAlign","rect","bandHeight","titleBand","labelInset","depth","groupDepth","band","labelSide","dividers","x1","y1","x2","y2","parent","routed","edge","labelPlacement","badgePlacement","exitSide","entrySide","points","d","segmentIndex","segment","badgeLines","badgeLabel","badgeIcon","iconGap","badge","annotation","lineGap","run","leader","target","join"],"sources":["../../../../src/lib/layouts/graph/legacy-graph-layout.ts"],"sourcesContent":["// Temporary adapter: it builds one GraphLayout from the current engine in\n// graph-layout.ts, so that the renderers paint only from a GraphLayout before\n// the content-sized grid engine replaces it. Step 6 of the redesign deletes\n// this file together with graph-layout.ts.\nimport { validateGraph } from '../../compiler/diagram-compile.ts';\nimport type {\n Box,\n DiagramGraphIR,\n DiagramGroup,\n DiagramLabelLine,\n DiagramNode,\n DiagramTextColor,\n GraphLayoutSpec,\n Point,\n} from '../../model/diagram-ir.ts';\nimport { centeredBaselineOffset } from '../text-metrics.ts';\nimport type { Font, FontFace, FontWeight } from '../text/font.ts';\nimport { fontAscent, fontDescent, measureText } from '../text/measure-text.ts';\nimport type {\n EdgeLayout,\n GraphLayout,\n GroupLayout,\n LeaderLayout,\n NodeLayout,\n PortLayout,\n TextAnchor,\n TextRun,\n} from './graph-layout-result.ts';\nimport {\n EDGE_BADGE_ICON,\n GROUP_LABEL_H,\n type PortPlacement,\n type ResolvedDiagramAnnotation,\n type RoutedEdge,\n computePaths,\n edgeBadgeSize,\n edgeLabelFontSize,\n edgeLabelFrameBox,\n edgeLabelLineHeight,\n graphContentViewBox,\n groupBox,\n groupDividerLines,\n groupLabelHeight,\n groupLabelLines,\n groupPortPlacements,\n groupTitleGutterHeight,\n nodeBox,\n nodeCaptionBounds,\n nodeCaptionPlacement,\n nodeFrameRadius,\n nodePortPlacements,\n nodeStackCount,\n nodeStackFrameBox,\n nodeVisualBox,\n resolveGraphAnnotations,\n resolveGraphLayout,\n} from './graph-layout.ts';\n\n/** The prefix of the id of the note node that stands for a free annotation. */\nexport const ANNOTATION_NOTE_PREFIX = 'annotation:';\n\nexport function legacyGraphLayout(ir: DiagramGraphIR): GraphLayout {\n validateGraph(ir);\n const graph = resolveGraphLayout(ir);\n const routedEdges = computePaths(graph);\n const notes = resolveGraphAnnotations(graph).map(noteLayout);\n return {\n nodes: [\n ...graph.nodes.map((node) =>\n nodeLayout(node, nodeBox(node, graph.layout)),\n ),\n ...notes.map(({ note }) => note),\n ],\n groups: (graph.groups ?? []).map((group) => groupLayout(group, graph)),\n edges: routedEdges.map(edgeLayout),\n leaders: notes.flatMap(({ leaders }) => leaders),\n viewBox: graphContentViewBox(graph, routedEdges),\n };\n}\n\ntype Line = { text: string; color?: DiagramTextColor; weight: FontWeight };\n\nconst FONT_WEIGHTS: FontWeight[] = [400, 500, 600, 700];\n\nfunction fontWeight(value: number): FontWeight {\n const weight = FONT_WEIGHTS.find((candidate) => candidate === value);\n if (weight === undefined) {\n throw new Error(\n `Diagram font weight ${value} has no metrics; use 400, 500, 600 or 700.`,\n );\n }\n return weight;\n}\n\nfunction labelLines(\n label: DiagramNode['label'],\n defaultWeight: number,\n): Line[] {\n return (Array.isArray(label) ? label : [label]).map((line) =>\n labelLine(line, defaultWeight),\n );\n}\n\nfunction labelLine(line: DiagramLabelLine, defaultWeight: number): Line {\n if (typeof line === 'string') {\n return { text: line, weight: fontWeight(defaultWeight) };\n }\n return {\n text: line.text,\n weight: fontWeight(line.fontWeight ?? defaultWeight),\n ...(line.textColor ? { color: line.textColor } : {}),\n };\n}\n\nfunction plainLines(texts: string[], weight: number): Line[] {\n const resolved = fontWeight(weight);\n return texts.map((text) => ({ text, weight: resolved }));\n}\n\nfunction textRun(\n line: Line,\n x: number,\n y: number,\n anchor: TextAnchor,\n font: Font,\n letterSpacing = 0,\n): TextRun {\n const w =\n measureText(line.text, font) + letterSpacing * [...line.text].length;\n const left = anchor === 'start' ? x : anchor === 'middle' ? x - w / 2 : x - w;\n const ascent = fontAscent(font);\n return {\n text: line.text,\n x,\n y,\n anchor,\n font,\n ...(line.color ? { color: line.color } : {}),\n bounds: { x: left, y: y - ascent, w, h: ascent + fontDescent(font) },\n };\n}\n\nfunction textBlock(\n lines: Line[],\n block: {\n x: number;\n y: number;\n lineHeight: number;\n anchor: TextAnchor;\n face: FontFace;\n size: number;\n letterSpacing?: number;\n },\n): TextRun[] {\n return lines.map((line, index) =>\n textRun(\n line,\n block.x,\n block.y + index * block.lineHeight,\n block.anchor,\n { face: block.face, size: block.size, weight: line.weight },\n block.letterSpacing,\n ),\n );\n}\n\nfunction nonEmpty(lines: Line[]) {\n return lines.filter((line) => line.text.length > 0);\n}\n\nfunction unionBox(boxes: Box[]): Box {\n const minX = Math.min(...boxes.map((box) => box.x));\n const minY = Math.min(...boxes.map((box) => box.y));\n const maxX = Math.max(...boxes.map((box) => box.x + box.w));\n const maxY = Math.max(...boxes.map((box) => box.y + box.h));\n return { x: minX, y: minY, w: maxX - minX, h: maxY - minY };\n}\n\ntype NodeContent = Pick<NodeLayout, 'text'> &\n Partial<Pick<NodeLayout, 'icon' | 'bullets' | 'appliance'>> & {\n radius?: number;\n };\n\nfunction nodeLayout(node: DiagramNode, box: Box): NodeLayout {\n const content = nodeContent(node, box);\n const captionLayout = nodeCaption(node, box);\n const frames =\n (node.frame ?? 'solid') === 'none'\n ? []\n : Array.from({ length: nodeStackCount(node) - 1 }, (_, i) =>\n nodeStackFrameBox(node, box, i + 1),\n );\n const stacked = nodeVisualBox(node, box);\n return {\n node,\n box,\n visual: captionLayout ? unionBox([stacked, captionLayout.box]) : stacked,\n frames,\n radius: content.radius ?? nodeFrameRadius(node),\n ...(content.icon ? { icon: content.icon } : {}),\n text: content.text,\n bullets: content.bullets ?? [],\n ...(captionLayout ? { caption: captionLayout } : {}),\n ports: nodePortPlacements(node, box).map(portLayout),\n ...(content.appliance ? { appliance: content.appliance } : {}),\n };\n}\n\nfunction nodeContent(node: DiagramNode, box: Box): NodeContent {\n if (node.kind === 'appliance') return applianceContent(node, box);\n if (node.kind === 'connector') return connectorContent(node, box);\n if (node.kind === 'marker') return markerContent(node, box);\n if (node.kind === 'junction') return junctionContent(node, box);\n const descriptionLines = [node.description ?? []].flat();\n const hasBodyLayout =\n (node.textAlign ?? 'center') === 'start' ||\n Boolean(node.icon) ||\n descriptionLines.length > 0;\n return hasBodyLayout\n ? cardContent(node, box, descriptionLines)\n : centredLabelContent(node, box);\n}\n\nfunction centredLabelContent(node: DiagramNode, box: Box): NodeContent {\n const lines = labelLines(node.label, node.fontWeight ?? 500);\n const fontSize = node.fontSize ?? 12;\n const lineHeight = Math.max(12, fontSize + 2);\n const centerY = box.y + box.h / 2;\n return {\n text: textBlock(lines, {\n x: box.x + box.w / 2,\n y:\n centerY -\n ((lines.length - 1) * lineHeight) / 2 +\n centeredBaselineOffset(fontSize, 'mono'),\n lineHeight,\n anchor: 'middle',\n face: 'mono',\n size: fontSize,\n letterSpacing: 0.6,\n }),\n };\n}\n\nfunction cardContent(\n node: DiagramNode,\n box: Box,\n descriptionLines: string[],\n): NodeContent {\n const titleLines = labelLines(node.label, node.fontWeight ?? 700);\n const itemLines = node.items ?? [];\n const hasText = titleLines.some((line) => line.text.length > 0);\n const iconSize = node.iconSize ?? (node.icon === 'ellipsis' ? 34 : 42);\n const cardPadX = 28;\n const headerGap = 22;\n const hasBody = descriptionLines.length > 0 || itemLines.length > 0;\n const hasHeaderIcon = Boolean(node.icon && hasText && hasBody);\n const iconX =\n hasText || hasBody ? box.x + cardPadX : box.x + box.w / 2 - iconSize / 2;\n const iconY =\n hasText || hasBody ? box.y + 28 : box.y + box.h / 2 - iconSize / 2;\n const titleX = node.icon ? iconX + iconSize + headerGap : box.x + cardPadX;\n const bodyX = hasHeaderIcon ? box.x + cardPadX : titleX;\n const titleSize = node.fontSize ?? 15;\n const titleLineHeight = titleSize + 4;\n const titleY = hasBody\n ? box.y + 44\n : box.y +\n box.h / 2 -\n ((titleLines.length - 1) * titleLineHeight) / 2 +\n titleSize * 0.35;\n const bodySize = node.bodyFontSize ?? Math.max(11, titleSize - 2);\n const bodyY = titleY + titleLines.length * titleLineHeight + 8;\n const bodyLineHeight = bodySize + (node.bodyLineGap ?? 3);\n const itemY =\n bodyY +\n (descriptionLines.length > 0\n ? descriptionLines.length * bodyLineHeight + 6\n : 0);\n const body = {\n lineHeight: bodyLineHeight,\n anchor: 'start',\n face: 'sans',\n size: bodySize,\n } as const;\n const items = textBlock(plainLines(itemLines, 400), {\n ...body,\n x: bodyX + 12,\n y: itemY,\n });\n return {\n ...(node.icon ? { icon: { x: iconX, y: iconY, size: iconSize } } : {}),\n text: [\n ...(hasText\n ? textBlock(titleLines, {\n x: titleX,\n y: titleY,\n lineHeight: titleLineHeight,\n anchor: 'start',\n face: 'sans',\n size: titleSize,\n })\n : []),\n ...textBlock(plainLines(descriptionLines, 400), {\n ...body,\n x: bodyX,\n y: bodyY,\n }),\n ...items,\n ],\n bullets: items.map((item) => ({ x: bodyX + 3, y: item.y - 3 })),\n };\n}\n\nfunction applianceContent(node: DiagramNode, box: Box): NodeContent {\n const fontSize = node.fontSize ?? 12;\n const bodyX = box.x + 4;\n const bodyY = box.y + Math.max(12, Math.min(22, box.h * 0.28));\n const bodyW = Math.max(36, box.w - 8);\n const bodyH = Math.max(24, box.h - (bodyY - box.y) - 12);\n const slant = Math.max(\n 4,\n Math.min(node.slant ?? 16, bodyW * 0.28, bodyH * 0.75),\n );\n const jackCount = Math.max(0, Math.floor(node.appliancePorts ?? 4));\n const jackY = bodyY + bodyH - 15;\n const jackStartX = bodyX + slant + 16;\n const jackSpacing = Math.min(\n 13,\n Math.max(8, (bodyW - slant - 42) / Math.max(jackCount, 1)),\n );\n const antenna: [Point, Point][] =\n (node.antenna ?? true)\n ? [\n [\n { x: bodyX + slant + bodyW * 0.18, y: bodyY + 1 },\n { x: bodyX + slant + bodyW * 0.2 - 3, y: box.y + 3 },\n ],\n [\n { x: bodyX + slant + bodyW * 0.2 + 1, y: bodyY + 2 },\n { x: bodyX + slant + bodyW * 0.2 + 1, y: box.y + 8 },\n ],\n ]\n : [];\n return {\n text: textBlock(nonEmpty(labelLines(node.label, node.fontWeight ?? 600)), {\n x: box.x + box.w / 2,\n y: bodyY + bodyH + Math.max(12, fontSize + 2),\n lineHeight: Math.max(12, fontSize + 2),\n anchor: 'middle',\n face: 'sans',\n size: fontSize,\n }),\n appliance: {\n body: [\n { x: bodyX + slant, y: bodyY },\n { x: bodyX + bodyW, y: bodyY + 6 },\n { x: bodyX + bodyW - slant, y: bodyY + bodyH },\n { x: bodyX, y: bodyY + bodyH - 6 },\n ],\n face: [\n { x: bodyX + slant, y: bodyY + bodyH - 1 },\n { x: bodyX + bodyW - slant, y: bodyY + bodyH + 3 },\n ],\n antenna,\n jacks: Array.from({ length: jackCount }, (_, i) => ({\n x: jackStartX + i * jackSpacing,\n y: jackY,\n w: 5,\n h: 12,\n })),\n },\n };\n}\n\nfunction connectorContent(node: DiagramNode, box: Box): NodeContent {\n const centerY = box.y + box.h / 2;\n const iconSize = node.iconSize ?? 18;\n const fontSize = node.fontSize ?? 10;\n const lineHeight = Math.max(12, fontSize + 2);\n const lines = nonEmpty(labelLines(node.label, node.fontWeight ?? 700));\n const iconX = box.x + 10;\n return {\n radius: node.rx ?? Math.min(12, box.h / 2),\n ...(node.icon\n ? { icon: { x: iconX, y: centerY - iconSize / 2, size: iconSize } }\n : {}),\n text: textBlock(lines, {\n x: node.icon ? iconX + iconSize + 8 : box.x + box.w / 2,\n y: centerY - ((lines.length - 1) * lineHeight) / 2 + fontSize * 0.35,\n lineHeight,\n anchor: node.icon ? 'start' : 'middle',\n face: 'sans',\n size: fontSize,\n }),\n };\n}\n\nfunction markerContent(node: DiagramNode, box: Box): NodeContent {\n const iconSize = node.iconSize ?? 34;\n const fontSize = node.fontSize ?? 11;\n const lineHeight = Math.max(12, fontSize + 2);\n const lines = nonEmpty(labelLines(node.label, node.fontWeight ?? 700));\n const labelGap = lines.length > 0 ? 8 : 0;\n const totalHeight = iconSize + labelGap + lines.length * lineHeight;\n const cx = box.x + box.w / 2;\n const iconX = Math.round(cx - iconSize / 2);\n const iconY = Math.round(box.y + (box.h - totalHeight) / 2);\n return {\n radius: node.rx ?? 0,\n icon: { x: iconX, y: iconY, size: iconSize },\n text: textBlock(lines, {\n x: cx,\n y: iconY + iconSize + labelGap + fontSize,\n lineHeight,\n anchor: 'middle',\n face: 'sans',\n size: fontSize,\n }),\n };\n}\n\nfunction junctionContent(node: DiagramNode, box: Box): NodeContent {\n const lines = Array.isArray(node.label) ? node.label : [node.label];\n const weight = node.fontWeight ?? 600;\n return {\n radius: Math.max(4, Math.min(box.w, box.h) / 2),\n text: lines.some(Boolean)\n ? textBlock(\n lines.map((line) => ({\n text: typeof line === 'string' ? line : line.text,\n weight: fontWeight(weight),\n })),\n {\n x: box.x + box.w / 2,\n y: box.y + box.h / 2 - Math.max(8, box.h / 2 + 6),\n lineHeight: Math.max(12, (node.fontSize ?? 12) + 2),\n anchor: 'middle',\n face: 'mono',\n size: node.fontSize ?? 10,\n },\n )\n : [],\n };\n}\n\nfunction nodeCaption(node: DiagramNode, box: Box): NodeLayout['caption'] {\n const placement = nodeCaptionPlacement(node, box);\n const bounds = nodeCaptionBounds(node, box);\n if (!placement || !bounds) return undefined;\n const lines = plainLines(placement.lines, node.captionFontWeight ?? 600).map(\n (line) =>\n node.captionColor ? { ...line, color: node.captionColor } : line,\n );\n return {\n box: bounds,\n framed: Boolean(node.captionFrame),\n text: textBlock(lines, {\n x: placement.x,\n y: placement.y,\n lineHeight: placement.lineHeight,\n anchor: placement.align,\n face: 'sans',\n size: placement.fontSize,\n }),\n };\n}\n\nfunction portLayout(port: PortPlacement): PortLayout {\n return {\n id: port.id,\n side: port.side,\n point: { x: port.x, y: port.y },\n ...(port.label\n ? {\n label: textRun(\n { text: port.label, weight: 600 },\n port.labelX,\n port.labelY,\n port.labelAlign,\n { face: 'mono', size: 9, weight: 600 },\n ),\n }\n : {}),\n };\n}\n\nfunction groupLayout(group: DiagramGroup, graph: GraphLayoutSpec): GroupLayout {\n const rect = groupBox(group, graph.nodes, graph.layout, graph.groups);\n const bandHeight = group.titleBand ? groupTitleGutterHeight(group) : 0;\n const labelAlign = group.labelAlign ?? 'center';\n const labelInset = 16;\n return {\n group,\n depth: groupDepth(group, graph.groups ?? []),\n rect,\n ...(bandHeight > 0\n ? { band: { x: rect.x, y: rect.y, w: rect.w, h: bandHeight } }\n : {}),\n label: textBlock(plainLines(groupLabelLines(group), 600), {\n x:\n labelAlign === 'start'\n ? rect.x + labelInset\n : labelAlign === 'end'\n ? rect.x + rect.w - labelInset\n : rect.x + rect.w / 2,\n y:\n group.labelSide === 'bottom'\n ? rect.y + rect.h - groupLabelHeight(group) + GROUP_LABEL_H - 14\n : rect.y + GROUP_LABEL_H,\n lineHeight: 14,\n anchor: labelAlign === 'center' ? 'middle' : labelAlign,\n face: 'sans',\n size: 12,\n }),\n dividers: groupDividerLines(\n group,\n graph.nodes,\n graph.layout,\n graph.groups,\n ).map((line) => [\n { x: line.x1, y: line.y1 },\n { x: line.x2, y: line.y2 },\n ]),\n ports: groupPortPlacements(group, rect).map(portLayout),\n };\n}\n\nfunction groupDepth(group: DiagramGroup, groups: DiagramGroup[]): number {\n const parent = groups.find((candidate) => candidate.id === group.parent);\n return parent ? groupDepth(parent, groups) + 1 : 0;\n}\n\nfunction edgeLayout(routed: RoutedEdge): EdgeLayout {\n const { edge, labelPlacement, badgePlacement } = routed;\n const layout: EdgeLayout = {\n edge,\n exitSide: routed.exitSide,\n entrySide: routed.entrySide,\n points: routed.points,\n d: routed.d,\n };\n if (edge.label?.length && labelPlacement) {\n layout.label = {\n box: edgeLabelFrameBox(edge, labelPlacement),\n text: textBlock(plainLines(edge.label, 400), {\n x: labelPlacement.x,\n y: labelPlacement.y,\n lineHeight: edgeLabelLineHeight(edge),\n anchor: labelPlacement.align,\n face: 'mono',\n size: edgeLabelFontSize(edge),\n }),\n ...(labelPlacement.segmentIndex === undefined\n ? {}\n : { segment: labelPlacement.segmentIndex }),\n };\n }\n const badgeLines = edge.badgeLabel ?? [];\n if ((edge.badgeIcon || badgeLines.length > 0) && badgePlacement) {\n const { w, h } = edgeBadgeSize(edge);\n const left = badgePlacement.x - w / 2;\n const iconSize = edge.badgeIcon ? EDGE_BADGE_ICON : 0;\n const iconGap = edge.badgeIcon && badgeLines.length > 0 ? 8 : 0;\n layout.badge = {\n box: { x: left, y: badgePlacement.y - h / 2, w, h },\n ...(edge.badgeIcon\n ? {\n icon: {\n x: left + 8,\n y: badgePlacement.y - iconSize / 2,\n w: iconSize,\n h: iconSize,\n },\n }\n : {}),\n text: textBlock(plainLines(badgeLines, 600), {\n x: left + 8 + iconSize + iconGap,\n y: badgePlacement.y - ((badgeLines.length - 1) * 12) / 2 + 4,\n lineHeight: 12,\n anchor: 'start',\n face: 'sans',\n size: 10,\n }),\n };\n }\n return layout;\n}\n\nfunction noteLayout(\n annotation: ResolvedDiagramAnnotation,\n index: number,\n): { note: NodeLayout; leaders: LeaderLayout[] } {\n const id = `${ANNOTATION_NOTE_PREFIX}${index}`;\n const fontSize = annotation.fontSize ?? 11;\n const lines = plainLines(annotation.text, annotation.fontWeight ?? 500).map(\n (line) => (annotation.color ? { ...line, color: annotation.color } : line),\n );\n const text = textBlock(lines, {\n x: annotation.x,\n y: annotation.y,\n lineHeight: fontSize + (annotation.lineGap ?? 4),\n anchor: annotation.align ?? 'middle',\n face: 'sans',\n size: fontSize,\n });\n const box =\n text.length > 0\n ? unionBox(text.map((run) => run.bounds))\n : { x: annotation.x, y: annotation.y, w: 0, h: 0 };\n return {\n note: {\n node: { id, kind: 'note', label: annotation.text, frame: 'none' },\n box,\n visual: box,\n frames: [],\n radius: 0,\n text,\n bullets: [],\n ports: [],\n },\n leaders: (annotation.leaders ?? []).map((leader) => ({\n note: id,\n target: leader.target,\n points: leader.points,\n d: leader.points\n .map((point, i) => `${i === 0 ? 'M' : 'L'} ${point.x} ${point.y}`)\n .join(' '),\n })),\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,mCAAmC;AAWjE,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3D,SAASC,UAAU,EAAEC,WAAW,EAAEC,WAAW,QAAQ,yBAAyB;AAW9E,SACEC,eAAe,EACfC,aAAa,EAIbC,YAAY,EACZC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,EACnBC,QAAQ,EACRC,iBAAiB,EACjBC,gBAAgB,EAChBC,eAAe,EACfC,mBAAmB,EACnBC,sBAAsB,EACtBC,OAAO,EACPC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,kBAAkB,EAClBC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,EACbC,uBAAuB,EACvBC,kBAAkB,QACb,mBAAmB;;AAE1B;AACA,OAAO,MAAMC,sBAAsB,GAAG,aAAa;AAEnD,OAAO,SAASC,iBAAiBA,CAACC,EAAkB,EAAe;EACjE/B,aAAa,CAAC+B,EAAE,CAAC;EACjB,MAAMC,KAAK,GAAGJ,kBAAkB,CAACG,EAAE,CAAC;EACpC,MAAME,WAAW,GAAG1B,YAAY,CAACyB,KAAK,CAAC;EACvC,MAAME,KAAK,GAAGP,uBAAuB,CAACK,KAAK,CAAC,CAACG,GAAG,CAACC,UAAU,CAAC;EAC5D,OAAO;IACLC,KAAK,EAAE,CACL,GAAGL,KAAK,CAACK,KAAK,CAACF,GAAG,CAAEG,IAAI,IACtBC,UAAU,CAACD,IAAI,EAAEnB,OAAO,CAACmB,IAAI,EAAEN,KAAK,CAACQ,MAAM,CAAC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