@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.
Files changed (92) hide show
  1. package/dist/lib/layouts/graph/areas.d.ts +27 -0
  2. package/dist/lib/layouts/graph/areas.d.ts.map +1 -0
  3. package/dist/lib/layouts/graph/areas.js +187 -0
  4. package/dist/lib/layouts/graph/areas.js.map +1 -0
  5. package/dist/lib/layouts/graph/graph-layout-result.d.ts +95 -0
  6. package/dist/lib/layouts/graph/graph-layout-result.d.ts.map +1 -0
  7. package/dist/lib/layouts/graph/graph-layout-result.js +2 -0
  8. package/dist/lib/layouts/graph/graph-layout-result.js.map +1 -0
  9. package/dist/lib/layouts/graph/graph-layout.d.ts +2 -1
  10. package/dist/lib/layouts/graph/graph-layout.d.ts.map +1 -1
  11. package/dist/lib/layouts/graph/graph-layout.js +5 -3
  12. package/dist/lib/layouts/graph/graph-layout.js.map +1 -1
  13. package/dist/lib/layouts/graph/gutters.d.ts +26 -0
  14. package/dist/lib/layouts/graph/gutters.d.ts.map +1 -0
  15. package/dist/lib/layouts/graph/gutters.js +123 -0
  16. package/dist/lib/layouts/graph/gutters.js.map +1 -0
  17. package/dist/lib/layouts/graph/layout.d.ts +10 -0
  18. package/dist/lib/layouts/graph/layout.d.ts.map +1 -0
  19. package/dist/lib/layouts/graph/layout.js +165 -0
  20. package/dist/lib/layouts/graph/layout.js.map +1 -0
  21. package/dist/lib/layouts/graph/legacy-graph-layout.d.ts +6 -0
  22. package/dist/lib/layouts/graph/legacy-graph-layout.d.ts.map +1 -0
  23. package/dist/lib/layouts/graph/legacy-graph-layout.js +542 -0
  24. package/dist/lib/layouts/graph/legacy-graph-layout.js.map +1 -0
  25. package/dist/lib/layouts/graph/measure.d.ts +44 -0
  26. package/dist/lib/layouts/graph/measure.d.ts.map +1 -0
  27. package/dist/lib/layouts/graph/measure.js +372 -0
  28. package/dist/lib/layouts/graph/measure.js.map +1 -0
  29. package/dist/lib/layouts/graph/node-content.d.ts +16 -0
  30. package/dist/lib/layouts/graph/node-content.d.ts.map +1 -0
  31. package/dist/lib/layouts/graph/node-content.js +323 -0
  32. package/dist/lib/layouts/graph/node-content.js.map +1 -0
  33. package/dist/lib/layouts/graph/text-block.d.ts +19 -0
  34. package/dist/lib/layouts/graph/text-block.d.ts.map +1 -0
  35. package/dist/lib/layouts/graph/text-block.js +86 -0
  36. package/dist/lib/layouts/graph/text-block.js.map +1 -0
  37. package/dist/lib/layouts/graph/tokens.d.ts +58 -0
  38. package/dist/lib/layouts/graph/tokens.d.ts.map +1 -0
  39. package/dist/lib/layouts/graph/tokens.js +108 -0
  40. package/dist/lib/layouts/graph/tokens.js.map +1 -0
  41. package/dist/lib/layouts/graph/tracks.d.ts +20 -0
  42. package/dist/lib/layouts/graph/tracks.d.ts.map +1 -0
  43. package/dist/lib/layouts/graph/tracks.js +47 -0
  44. package/dist/lib/layouts/graph/tracks.js.map +1 -0
  45. package/dist/lib/layouts/text/font-metrics.generated.d.ts +18 -0
  46. package/dist/lib/layouts/text/font-metrics.generated.d.ts.map +1 -0
  47. package/dist/lib/layouts/text/font-metrics.generated.js +1043 -0
  48. package/dist/lib/layouts/text/font-metrics.generated.js.map +1 -0
  49. package/dist/lib/layouts/text/font.d.ts +14 -0
  50. package/dist/lib/layouts/text/font.d.ts.map +1 -0
  51. package/dist/lib/layouts/text/font.js +11 -0
  52. package/dist/lib/layouts/text/font.js.map +1 -0
  53. package/dist/lib/layouts/text/measure-text.d.ts +13 -0
  54. package/dist/lib/layouts/text/measure-text.d.ts.map +1 -0
  55. package/dist/lib/layouts/text/measure-text.js +67 -0
  56. package/dist/lib/layouts/text/measure-text.js.map +1 -0
  57. package/dist/lib/model/diagram-ir.d.ts +14 -1
  58. package/dist/lib/model/diagram-ir.d.ts.map +1 -1
  59. package/dist/lib/model/diagram-ir.js.map +1 -1
  60. package/dist/lib/renderers/canvas/graph-canvas.d.ts.map +1 -1
  61. package/dist/lib/renderers/canvas/graph-canvas.js +148 -138
  62. package/dist/lib/renderers/canvas/graph-canvas.js.map +1 -1
  63. package/dist/lib/renderers/html/graph-html.d.ts.map +1 -1
  64. package/dist/lib/renderers/html/graph-html.js +462 -511
  65. package/dist/lib/renderers/html/graph-html.js.map +1 -1
  66. package/dist/lib/renderers/shared/graph-parts.d.ts +15 -13
  67. package/dist/lib/renderers/shared/graph-parts.d.ts.map +1 -1
  68. package/dist/lib/renderers/shared/graph-parts.js +649 -644
  69. package/dist/lib/renderers/shared/graph-parts.js.map +1 -1
  70. package/dist/lib/renderers/shared/node-parts.d.ts +20 -19
  71. package/dist/lib/renderers/shared/node-parts.d.ts.map +1 -1
  72. package/dist/lib/renderers/shared/node-parts.js +678 -811
  73. package/dist/lib/renderers/shared/node-parts.js.map +1 -1
  74. package/dist/lib/renderers/shared/run-spans.d.ts +8 -0
  75. package/dist/lib/renderers/shared/run-spans.d.ts.map +1 -0
  76. package/dist/lib/renderers/shared/run-spans.js +18 -0
  77. package/dist/lib/renderers/shared/run-spans.js.map +1 -0
  78. package/dist/lib/renderers/shared/text-runs.d.ts +21 -0
  79. package/dist/lib/renderers/shared/text-runs.d.ts.map +1 -0
  80. package/dist/lib/renderers/shared/text-runs.js +44 -0
  81. package/dist/lib/renderers/shared/text-runs.js.map +1 -0
  82. package/dist/lib/renderers/svg/graph-svg.d.ts.map +1 -1
  83. package/dist/lib/renderers/svg/graph-svg.js +304 -465
  84. package/dist/lib/renderers/svg/graph-svg.js.map +1 -1
  85. package/dist/lib/renderers/svg/timeline-svg.d.ts.map +1 -1
  86. package/dist/lib/renderers/svg/timeline-svg.js +10 -5
  87. package/dist/lib/renderers/svg/timeline-svg.js.map +1 -1
  88. package/dist/lib/renderers/webgpu/graph-flow-effects.d.ts +2 -2
  89. package/dist/lib/renderers/webgpu/graph-flow-effects.d.ts.map +1 -1
  90. package/dist/lib/renderers/webgpu/graph-flow-effects.js.map +1 -1
  91. package/package.json +3 -1
  92. package/styles.css +8 -0
@@ -1,22 +1,23 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { motion, useTransform } from 'motion/react';
3
- import { compileGraph, validateGraph } from "../../compiler/diagram-compile.js";
4
- import { computePaths, graphContentViewBox, groupBox, groupDividerLines, nodeBox, nodeFrameRadius, nodeFrameStrokeWidth, resolveGraphAnnotations, resolveGraphLayout } from "../../layouts/graph/graph-layout.js";
5
- import { centeredBaselineOffset } from "../../layouts/text-metrics.js";
3
+ import { compileGraph } from "../../compiler/diagram-compile.js";
4
+ import { legacyGraphLayout } from "../../layouts/graph/legacy-graph-layout.js";
5
+ import { FONT_FAMILY, TEXT_SHAPING } from "../../layouts/text/font.js";
6
6
  import { DiagramFrame, useDiagramTheme } from "../../react/chrome/index.js";
7
7
  import { DiagramDefs } from "../shared/defs.js";
8
- import { DiagramNodeIcon, EdgeOverlay, EdgeStroke, GroupRect, buildSegments, labelLineFill, nodeFrameFill, nodeFrameStroke, nodeTextFill, nodeTexture, textureFill } from "../shared/graph-parts.js";
8
+ import { DiagramNodeIcon, EdgeOverlay, EdgeStroke, GroupRect, buildSegments, nodeFrameFill, nodeFrameStroke, nodeFrameStrokeWidth, nodeTextFill, nodeTexture, textureFill } from "../shared/graph-parts.js";
9
9
  import { rejectNodeContent } from "../shared/node-content.js";
10
- import { ANNOTATION_REVEAL_START, AnnotationText, NodeCaption, NodePorts, NodeStackFrames, SpecialNode, isSpecialNode } from "../shared/node-parts.js";
10
+ import { ANNOTATION_REVEAL_START, AnnotationText, NodeCaption, NodePorts, NodeStackFrames, SpecialNode, isSpecialNode, splitNotes } from "../shared/node-parts.js";
11
11
  import { DiagramPaperRect } from "../shared/paper.js";
12
+ import { RunSpans } from "../shared/run-spans.js";
13
+ import { nodeTextParts } from "../shared/text-runs.js";
12
14
  import { GraphFlowEffects } from "../webgpu/graph-flow-effects.js";
13
15
  import { svgViewportProps } from "./viewport.js";
14
16
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
17
  function NodeRect(t0) {
16
- const $ = _c(80);
18
+ const $ = _c(61);
17
19
  const {
18
- node,
19
- box,
20
+ layout,
20
21
  progress,
21
22
  start,
22
23
  end
@@ -71,455 +72,326 @@ function NodeRect(t0) {
71
72
  t6 = $[9];
72
73
  }
73
74
  const translateY = useTransform(progress, t4, t5, t6);
75
+ const {
76
+ node,
77
+ box,
78
+ radius
79
+ } = layout;
74
80
  const frame = node.frame ?? "solid";
75
81
  let t7;
76
82
  if ($[10] !== node) {
77
- t7 = nodeFrameRadius(node);
83
+ t7 = nodeFrameStrokeWidth(node);
78
84
  $[10] = node;
79
85
  $[11] = t7;
80
86
  } else {
81
87
  t7 = $[11];
82
88
  }
83
- const rx = t7;
89
+ const strokeWidth = t7;
84
90
  let t8;
85
- if ($[12] !== node) {
86
- t8 = nodeFrameStrokeWidth(node);
87
- $[12] = node;
88
- $[13] = t8;
91
+ if ($[12] !== frame || $[13] !== node || $[14] !== themeAccent) {
92
+ t8 = nodeFrameStroke(node, frame, themeAccent);
93
+ $[12] = frame;
94
+ $[13] = node;
95
+ $[14] = themeAccent;
96
+ $[15] = t8;
89
97
  } else {
90
- t8 = $[13];
98
+ t8 = $[15];
91
99
  }
92
- const strokeWidth = t8;
100
+ const stroke = t8;
93
101
  let t9;
94
- if ($[14] !== frame || $[15] !== node || $[16] !== themeAccent) {
95
- t9 = nodeFrameStroke(node, frame, themeAccent);
96
- $[14] = frame;
97
- $[15] = node;
98
- $[16] = themeAccent;
99
- $[17] = t9;
102
+ if ($[16] !== frame || $[17] !== node) {
103
+ t9 = nodeFrameFill(node, frame);
104
+ $[16] = frame;
105
+ $[17] = node;
106
+ $[18] = t9;
100
107
  } else {
101
- t9 = $[17];
108
+ t9 = $[18];
102
109
  }
103
- const stroke = t9;
110
+ const boxFill = t9;
104
111
  let t10;
105
- if ($[18] !== frame || $[19] !== node) {
106
- t10 = nodeFrameFill(node, frame);
107
- $[18] = frame;
108
- $[19] = node;
109
- $[20] = t10;
112
+ let texture;
113
+ if ($[19] !== frame || $[20] !== ids || $[21] !== node) {
114
+ texture = nodeTexture(node, frame);
115
+ t10 = textureFill(texture, ids);
116
+ $[19] = frame;
117
+ $[20] = ids;
118
+ $[21] = node;
119
+ $[22] = t10;
120
+ $[23] = texture;
110
121
  } else {
111
- t10 = $[20];
122
+ t10 = $[22];
123
+ texture = $[23];
112
124
  }
113
- const boxFill = t10;
125
+ const texturePattern = t10;
114
126
  let t11;
115
- let texture;
116
- if ($[21] !== frame || $[22] !== ids || $[23] !== node) {
117
- texture = nodeTexture(node, frame);
118
- t11 = textureFill(texture, ids);
119
- $[21] = frame;
120
- $[22] = ids;
121
- $[23] = node;
122
- $[24] = t11;
123
- $[25] = texture;
127
+ if ($[24] !== frame || $[25] !== node || $[26] !== themeAccent) {
128
+ t11 = nodeTextFill(node, frame, themeAccent);
129
+ $[24] = frame;
130
+ $[25] = node;
131
+ $[26] = themeAccent;
132
+ $[27] = t11;
124
133
  } else {
125
- t11 = $[24];
126
- texture = $[25];
134
+ t11 = $[27];
127
135
  }
128
- const texturePattern = t11;
129
- let T0;
130
- let t12;
131
- let t13;
132
- let t14;
133
- let t15;
134
- if ($[26] !== box || $[27] !== boxFill || $[28] !== end || $[29] !== frame || $[30] !== node || $[31] !== opacity || $[32] !== progress || $[33] !== rx || $[34] !== start || $[35] !== stroke || $[36] !== strokeWidth || $[37] !== texture || $[38] !== texturePattern || $[39] !== themeAccent || $[40] !== translateY) {
135
- t15 = Symbol.for("react.early_return_sentinel");
136
- bb0: {
137
- const fill = nodeTextFill(node, frame, themeAccent);
138
- const lines = Array.isArray(node.label) ? node.label : [node.label];
139
- let t16;
140
- if ($[46] !== node.description) {
141
- t16 = node.description === undefined ? [] : Array.isArray(node.description) ? node.description : [node.description];
142
- $[46] = node.description;
143
- $[47] = t16;
144
- } else {
145
- t16 = $[47];
146
- }
147
- const descriptionLines = t16;
148
- let t17;
149
- if ($[48] !== node.items) {
150
- t17 = node.items ?? [];
151
- $[48] = node.items;
152
- $[49] = t17;
153
- } else {
154
- t17 = $[49];
155
- }
156
- const itemLines = t17;
157
- const fontSize = node.fontSize ?? 12;
158
- const lineHeight = Math.max(12, fontSize + 2);
159
- const centerY = box.y + box.h / 2;
160
- const firstLineY = centerY - (lines.length - 1) * lineHeight / 2 + centeredBaselineOffset(fontSize, "mono");
161
- const cx = box.x + box.w / 2;
162
- const textAlign = node.textAlign ?? "center";
163
- const hasBodyLayout = textAlign === "start" || Boolean(node.icon) || descriptionLines.length > 0;
164
- if (node.hidden) {
165
- t15 = null;
166
- break bb0;
167
- }
168
- if (isSpecialNode(node)) {
169
- let t18;
170
- if ($[50] !== box || $[51] !== end || $[52] !== node || $[53] !== progress || $[54] !== start) {
171
- t18 = /*#__PURE__*/_jsx(SpecialNode, {
172
- node: node,
173
- box: box,
174
- progress: progress,
175
- start: start,
176
- end: end
177
- });
178
- $[50] = box;
179
- $[51] = end;
180
- $[52] = node;
181
- $[53] = progress;
182
- $[54] = start;
183
- $[55] = t18;
184
- } else {
185
- t18 = $[55];
186
- }
187
- t15 = t18;
188
- break bb0;
189
- }
190
- T0 = motion.g;
191
- if ($[56] !== opacity || $[57] !== translateY) {
192
- t12 = {
193
- opacity,
194
- y: translateY
195
- };
196
- $[56] = opacity;
197
- $[57] = translateY;
198
- $[58] = t12;
199
- } else {
200
- t12 = $[58];
201
- }
202
- if ($[59] !== box || $[60] !== boxFill || $[61] !== frame || $[62] !== node || $[63] !== rx || $[64] !== stroke || $[65] !== strokeWidth || $[66] !== texture || $[67] !== texturePattern) {
203
- t13 = frame !== "none" && /*#__PURE__*/_jsxs(_Fragment, {
204
- children: [/*#__PURE__*/_jsx(NodeStackFrames, {
205
- node: node,
206
- box: box,
207
- rx: rx,
208
- fill: boxFill,
209
- stroke: stroke,
210
- strokeWidth: strokeWidth
211
- }), /*#__PURE__*/_jsx("rect", {
212
- "data-diagram-node": node.id,
213
- "data-diagram-node-tone": node.tone,
214
- x: box.x,
215
- y: box.y,
216
- width: box.w,
217
- height: box.h,
218
- rx: rx,
219
- fill: boxFill,
220
- stroke: stroke,
221
- strokeWidth: strokeWidth
222
- }), texturePattern && /*#__PURE__*/_jsx("rect", {
223
- "data-diagram-node-texture": `${node.id}:${texture}`,
224
- x: box.x,
225
- y: box.y,
226
- width: box.w,
227
- height: box.h,
228
- rx: rx,
229
- fill: texturePattern,
230
- pointerEvents: "none"
231
- })]
232
- });
233
- $[59] = box;
234
- $[60] = boxFill;
235
- $[61] = frame;
236
- $[62] = node;
237
- $[63] = rx;
238
- $[64] = stroke;
239
- $[65] = strokeWidth;
240
- $[66] = texture;
241
- $[67] = texturePattern;
242
- $[68] = t13;
243
- } else {
244
- t13 = $[68];
245
- }
246
- t14 = hasBodyLayout ? /*#__PURE__*/_jsx(NodeBodyLayout, {
247
- node: node,
248
- box: box,
249
- titleLines: lines,
250
- descriptionLines: descriptionLines,
251
- itemLines: itemLines,
252
- fill: fill,
253
- accent: themeAccent
254
- }) : /*#__PURE__*/_jsx("text", {
255
- x: cx,
256
- y: firstLineY,
257
- textAnchor: "middle",
258
- fontFamily: "ui-monospace, 'Geist Mono', monospace",
259
- fontSize: fontSize,
260
- fontWeight: node.fontWeight ?? 500,
261
- fill: fill,
262
- letterSpacing: 0.6,
263
- children: lines.map((line, i) => {
264
- const lineText = typeof line === "string" ? line : line.text;
265
- const lineFill = labelLineFill(line, fill, themeAccent);
266
- return /*#__PURE__*/_jsx("tspan", {
267
- x: cx,
268
- dy: i === 0 ? 0 : lineHeight,
269
- fill: lineFill,
270
- fontWeight: typeof line === "string" ? node.fontWeight ?? 500 : line.fontWeight ?? node.fontWeight ?? 500,
271
- children: lineText
272
- }, i);
273
- })
136
+ const fill = t11;
137
+ if (node.hidden) {
138
+ return null;
139
+ }
140
+ if (isSpecialNode(node)) {
141
+ let t12;
142
+ if ($[28] !== end || $[29] !== layout || $[30] !== progress || $[31] !== start) {
143
+ t12 = /*#__PURE__*/_jsx(SpecialNode, {
144
+ layout: layout,
145
+ progress: progress,
146
+ start: start,
147
+ end: end
274
148
  });
149
+ $[28] = end;
150
+ $[29] = layout;
151
+ $[30] = progress;
152
+ $[31] = start;
153
+ $[32] = t12;
154
+ } else {
155
+ t12 = $[32];
275
156
  }
276
- $[26] = box;
277
- $[27] = boxFill;
278
- $[28] = end;
279
- $[29] = frame;
280
- $[30] = node;
281
- $[31] = opacity;
282
- $[32] = progress;
283
- $[33] = rx;
284
- $[34] = start;
285
- $[35] = stroke;
286
- $[36] = strokeWidth;
287
- $[37] = texture;
288
- $[38] = texturePattern;
289
- $[39] = themeAccent;
290
- $[40] = translateY;
291
- $[41] = T0;
292
- $[42] = t12;
293
- $[43] = t13;
294
- $[44] = t14;
295
- $[45] = t15;
157
+ return t12;
158
+ }
159
+ let t12;
160
+ if ($[33] !== opacity || $[34] !== translateY) {
161
+ t12 = {
162
+ opacity,
163
+ y: translateY
164
+ };
165
+ $[33] = opacity;
166
+ $[34] = translateY;
167
+ $[35] = t12;
296
168
  } else {
297
- T0 = $[41];
298
- t12 = $[42];
299
- t13 = $[43];
300
- t14 = $[44];
301
- t15 = $[45];
169
+ t12 = $[35];
302
170
  }
303
- if (t15 !== Symbol.for("react.early_return_sentinel")) {
304
- return t15;
171
+ let t13;
172
+ if ($[36] !== box || $[37] !== boxFill || $[38] !== frame || $[39] !== layout || $[40] !== node.id || $[41] !== node.tone || $[42] !== radius || $[43] !== stroke || $[44] !== strokeWidth || $[45] !== texture || $[46] !== texturePattern) {
173
+ t13 = frame !== "none" && /*#__PURE__*/_jsxs(_Fragment, {
174
+ children: [/*#__PURE__*/_jsx(NodeStackFrames, {
175
+ layout: layout,
176
+ fill: boxFill,
177
+ stroke: stroke,
178
+ strokeWidth: strokeWidth
179
+ }), /*#__PURE__*/_jsx("rect", {
180
+ "data-diagram-node": node.id,
181
+ "data-diagram-node-tone": node.tone,
182
+ x: box.x,
183
+ y: box.y,
184
+ width: box.w,
185
+ height: box.h,
186
+ rx: radius,
187
+ fill: boxFill,
188
+ stroke: stroke,
189
+ strokeWidth: strokeWidth
190
+ }), texturePattern && /*#__PURE__*/_jsx("rect", {
191
+ "data-diagram-node-texture": `${node.id}:${texture}`,
192
+ x: box.x,
193
+ y: box.y,
194
+ width: box.w,
195
+ height: box.h,
196
+ rx: radius,
197
+ fill: texturePattern,
198
+ pointerEvents: "none"
199
+ })]
200
+ });
201
+ $[36] = box;
202
+ $[37] = boxFill;
203
+ $[38] = frame;
204
+ $[39] = layout;
205
+ $[40] = node.id;
206
+ $[41] = node.tone;
207
+ $[42] = radius;
208
+ $[43] = stroke;
209
+ $[44] = strokeWidth;
210
+ $[45] = texture;
211
+ $[46] = texturePattern;
212
+ $[47] = t13;
213
+ } else {
214
+ t13 = $[47];
215
+ }
216
+ let t14;
217
+ if ($[48] !== fill || $[49] !== layout || $[50] !== themeAccent) {
218
+ t14 = /*#__PURE__*/_jsx(NodeBody, {
219
+ layout: layout,
220
+ fill: fill,
221
+ accent: themeAccent
222
+ });
223
+ $[48] = fill;
224
+ $[49] = layout;
225
+ $[50] = themeAccent;
226
+ $[51] = t14;
227
+ } else {
228
+ t14 = $[51];
305
229
  }
230
+ let t15;
306
231
  let t16;
307
- let t17;
308
- if ($[69] !== box || $[70] !== node) {
309
- t16 = /*#__PURE__*/_jsx(NodePorts, {
310
- node: node,
311
- box: box
232
+ if ($[52] !== layout) {
233
+ t15 = /*#__PURE__*/_jsx(NodePorts, {
234
+ layout: layout
312
235
  });
313
- t17 = /*#__PURE__*/_jsx(NodeCaption, {
314
- node: node,
315
- box: box
236
+ t16 = /*#__PURE__*/_jsx(NodeCaption, {
237
+ layout: layout
316
238
  });
317
- $[69] = box;
318
- $[70] = node;
319
- $[71] = t16;
320
- $[72] = t17;
239
+ $[52] = layout;
240
+ $[53] = t15;
241
+ $[54] = t16;
321
242
  } else {
322
- t16 = $[71];
323
- t17 = $[72];
243
+ t15 = $[53];
244
+ t16 = $[54];
324
245
  }
325
- let t18;
326
- if ($[73] !== T0 || $[74] !== t12 || $[75] !== t13 || $[76] !== t14 || $[77] !== t16 || $[78] !== t17) {
327
- t18 = /*#__PURE__*/_jsxs(T0, {
246
+ let t17;
247
+ if ($[55] !== t12 || $[56] !== t13 || $[57] !== t14 || $[58] !== t15 || $[59] !== t16) {
248
+ t17 = /*#__PURE__*/_jsxs(motion.g, {
328
249
  style: t12,
329
- children: [t13, t14, t16, t17]
250
+ children: [t13, t14, t15, t16]
330
251
  });
331
- $[73] = T0;
332
- $[74] = t12;
333
- $[75] = t13;
334
- $[76] = t14;
335
- $[77] = t16;
336
- $[78] = t17;
337
- $[79] = t18;
252
+ $[55] = t12;
253
+ $[56] = t13;
254
+ $[57] = t14;
255
+ $[58] = t15;
256
+ $[59] = t16;
257
+ $[60] = t17;
338
258
  } else {
339
- t18 = $[79];
259
+ t17 = $[60];
340
260
  }
341
- return t18;
261
+ return t17;
342
262
  }
343
- function NodeBodyLayout(t0) {
344
- const $ = _c(45);
263
+ function NodeBody(t0) {
264
+ const $ = _c(24);
345
265
  const {
346
- node,
347
- box,
348
- titleLines,
349
- descriptionLines,
350
- itemLines,
266
+ layout,
351
267
  fill,
352
268
  accent
353
269
  } = t0;
270
+ const {
271
+ node,
272
+ icon
273
+ } = layout;
354
274
  let t1;
355
- if ($[0] !== titleLines) {
356
- t1 = titleLines.some(_temp);
357
- $[0] = titleLines;
358
- $[1] = t1;
359
- } else {
360
- t1 = $[1];
361
- }
362
- const hasText = t1;
363
- const iconSize = node.iconSize ?? (node.icon === "ellipsis" ? 34 : 42);
364
- const hasBody = descriptionLines.length > 0 || itemLines.length > 0;
365
- const hasHeaderIcon = Boolean(node.icon && hasText && hasBody);
366
- const iconX = hasText || hasBody ? box.x + 28 : box.x + box.w / 2 - iconSize / 2;
367
- const iconY = hasText || hasBody ? box.y + 28 : box.y + box.h / 2 - iconSize / 2;
368
- const titleX = node.icon ? iconX + iconSize + 22 : box.x + 28;
369
- const bodyX = hasHeaderIcon ? box.x + 28 : titleX;
370
- const titleSize = node.fontSize ?? 15;
371
- const titleLineHeight = titleSize + 4;
372
- const titleY = hasBody ? box.y + 44 : box.y + box.h / 2 - (titleLines.length - 1) * titleLineHeight / 2 + titleSize * 0.35;
373
- const bodySize = node.bodyFontSize ?? Math.max(11, titleSize - 2);
374
- const bodyY = titleY + titleLines.length * titleLineHeight + 8;
375
- const bodyLineGap = node.bodyLineGap ?? 3;
376
- const bodyLineHeight = bodySize + bodyLineGap;
377
- const itemY = bodyY + (descriptionLines.length > 0 ? descriptionLines.length * bodyLineHeight + 6 : 0);
378
275
  let t2;
379
- if ($[2] !== accent || $[3] !== fill || $[4] !== iconSize || $[5] !== iconX || $[6] !== iconY || $[7] !== node.icon || $[8] !== node.textColor) {
380
- t2 = node.icon && /*#__PURE__*/_jsx(DiagramNodeIcon, {
381
- icon: node.icon,
382
- x: iconX,
383
- y: iconY,
384
- size: iconSize,
385
- color: node.textColor === "accent" ? accent : fill
386
- });
387
- $[2] = accent;
388
- $[3] = fill;
389
- $[4] = iconSize;
390
- $[5] = iconX;
391
- $[6] = iconY;
392
- $[7] = node.icon;
393
- $[8] = node.textColor;
394
- $[9] = t2;
395
- } else {
396
- t2 = $[9];
397
- }
398
276
  let t3;
399
- if ($[10] !== accent || $[11] !== fill || $[12] !== hasText || $[13] !== node.fontWeight || $[14] !== titleLineHeight || $[15] !== titleLines || $[16] !== titleSize || $[17] !== titleX || $[18] !== titleY) {
400
- t3 = hasText && /*#__PURE__*/_jsx("text", {
401
- x: titleX,
402
- y: titleY,
403
- textAnchor: "start",
404
- fontFamily: "ui-sans-serif, system-ui, sans-serif",
405
- fontSize: titleSize,
406
- fontWeight: node.fontWeight ?? 700,
277
+ let t4;
278
+ if ($[0] !== accent || $[1] !== fill || $[2] !== icon || $[3] !== layout || $[4] !== node.bodyFontSize || $[5] !== node.bodyLineGap || $[6] !== node.icon || $[7] !== node.id || $[8] !== node.textColor) {
279
+ const {
280
+ title,
281
+ description,
282
+ items
283
+ } = nodeTextParts(layout);
284
+ const [firstTitle] = title;
285
+ const [firstDescription] = description;
286
+ if ($[13] !== accent || $[14] !== fill || $[15] !== icon || $[16] !== node.icon || $[17] !== node.textColor) {
287
+ t1 = node.icon && icon && /*#__PURE__*/_jsx(DiagramNodeIcon, {
288
+ icon: node.icon,
289
+ x: icon.x,
290
+ y: icon.y,
291
+ size: icon.size,
292
+ color: node.textColor === "accent" ? accent : fill
293
+ });
294
+ $[13] = accent;
295
+ $[14] = fill;
296
+ $[15] = icon;
297
+ $[16] = node.icon;
298
+ $[17] = node.textColor;
299
+ $[18] = t1;
300
+ } else {
301
+ t1 = $[18];
302
+ }
303
+ t2 = firstTitle && /*#__PURE__*/_jsx("text", {
304
+ x: firstTitle.x,
305
+ y: firstTitle.y,
306
+ textAnchor: firstTitle.anchor,
307
+ fontFamily: FONT_FAMILY[firstTitle.font.face],
308
+ fontSize: firstTitle.font.size,
309
+ fontWeight: firstTitle.font.weight,
407
310
  fill: fill,
408
- children: titleLines.map((line_0, i) => {
409
- const lineText = typeof line_0 === "string" ? line_0 : line_0.text;
410
- const lineFill = labelLineFill(line_0, fill, accent);
411
- return /*#__PURE__*/_jsx("tspan", {
412
- x: titleX,
413
- dy: i === 0 ? 0 : titleLineHeight,
414
- fill: lineFill,
415
- fontWeight: typeof line_0 === "string" ? node.fontWeight ?? 700 : line_0.fontWeight ?? node.fontWeight ?? 700,
416
- children: lineText
417
- }, i);
311
+ letterSpacing: firstTitle.font.face === "mono" ? 0.6 : undefined,
312
+ children: /*#__PURE__*/_jsx(RunSpans, {
313
+ runs: title,
314
+ fill: fill,
315
+ accent: accent
418
316
  })
419
317
  });
420
- $[10] = accent;
421
- $[11] = fill;
422
- $[12] = hasText;
423
- $[13] = node.fontWeight;
424
- $[14] = titleLineHeight;
425
- $[15] = titleLines;
426
- $[16] = titleSize;
427
- $[17] = titleX;
428
- $[18] = titleY;
429
- $[19] = t3;
430
- } else {
431
- t3 = $[19];
432
- }
433
- let t4;
434
- if ($[20] !== bodyLineHeight || $[21] !== bodySize || $[22] !== bodyX || $[23] !== bodyY || $[24] !== descriptionLines || $[25] !== fill || $[26] !== node.bodyFontSize || $[27] !== node.bodyLineGap || $[28] !== node.id) {
435
- t4 = descriptionLines.length > 0 && /*#__PURE__*/_jsx("text", {
318
+ t3 = firstDescription && /*#__PURE__*/_jsx("text", {
436
319
  "data-diagram-node-description": node.id,
437
320
  "data-diagram-node-body-font-size": node.bodyFontSize,
438
321
  "data-diagram-node-body-line-gap": node.bodyLineGap,
439
- x: bodyX,
440
- y: bodyY,
322
+ x: firstDescription.x,
323
+ y: firstDescription.y,
441
324
  textAnchor: "start",
442
- fontFamily: "ui-sans-serif, system-ui, sans-serif",
443
- fontSize: bodySize,
444
- fontWeight: 400,
325
+ fontFamily: FONT_FAMILY[firstDescription.font.face],
326
+ fontSize: firstDescription.font.size,
327
+ fontWeight: firstDescription.font.weight,
445
328
  fill: fill,
446
- children: descriptionLines.map((line_1, i_0) => /*#__PURE__*/_jsx("tspan", {
447
- x: bodyX,
448
- dy: i_0 === 0 ? 0 : bodyLineHeight,
449
- children: line_1
450
- }, i_0))
329
+ children: /*#__PURE__*/_jsx(RunSpans, {
330
+ runs: description
331
+ })
451
332
  });
452
- $[20] = bodyLineHeight;
453
- $[21] = bodySize;
454
- $[22] = bodyX;
455
- $[23] = bodyY;
456
- $[24] = descriptionLines;
457
- $[25] = fill;
458
- $[26] = node.bodyFontSize;
459
- $[27] = node.bodyLineGap;
460
- $[28] = node.id;
461
- $[29] = t4;
462
- } else {
463
- t4 = $[29];
464
- }
465
- let t5;
466
- if ($[30] !== bodyLineHeight || $[31] !== bodySize || $[32] !== bodyX || $[33] !== fill || $[34] !== itemLines || $[35] !== itemY || $[36] !== node.bodyFontSize || $[37] !== node.bodyLineGap || $[38] !== node.id) {
467
- t5 = itemLines.length > 0 && /*#__PURE__*/_jsx("g", {
468
- children: itemLines.map((line_2, i_1) => {
469
- const y = itemY + i_1 * bodyLineHeight;
333
+ t4 = items.length > 0 && /*#__PURE__*/_jsx("g", {
334
+ children: items.map((t5, i) => {
335
+ const {
336
+ run,
337
+ bullet
338
+ } = t5;
470
339
  return /*#__PURE__*/_jsxs("g", {
471
- "data-diagram-node-item": `${node.id}:${i_1}`,
340
+ "data-diagram-node-item": `${node.id}:${i}`,
472
341
  "data-diagram-node-body-font-size": node.bodyFontSize,
473
342
  "data-diagram-node-body-line-gap": node.bodyLineGap,
474
- transform: `translate(0 ${y})`,
343
+ transform: `translate(0 ${run.y})`,
475
344
  children: [/*#__PURE__*/_jsx("circle", {
476
- cx: bodyX + 3,
477
- cy: -3,
345
+ cx: bullet.x,
346
+ cy: bullet.y - run.y,
478
347
  r: 2.2,
479
348
  fill: fill
480
349
  }), /*#__PURE__*/_jsx("text", {
481
- x: bodyX + 12,
350
+ x: run.x,
482
351
  y: 0,
483
352
  textAnchor: "start",
484
- fontFamily: "ui-sans-serif, system-ui, sans-serif",
485
- fontSize: bodySize,
486
- fontWeight: 400,
353
+ fontFamily: FONT_FAMILY[run.font.face],
354
+ fontSize: run.font.size,
355
+ fontWeight: run.font.weight,
487
356
  fill: fill,
488
- children: line_2
357
+ children: run.text
489
358
  })]
490
- }, i_1);
359
+ }, i);
491
360
  })
492
361
  });
493
- $[30] = bodyLineHeight;
494
- $[31] = bodySize;
495
- $[32] = bodyX;
496
- $[33] = fill;
497
- $[34] = itemLines;
498
- $[35] = itemY;
499
- $[36] = node.bodyFontSize;
500
- $[37] = node.bodyLineGap;
501
- $[38] = node.id;
502
- $[39] = t5;
362
+ $[0] = accent;
363
+ $[1] = fill;
364
+ $[2] = icon;
365
+ $[3] = layout;
366
+ $[4] = node.bodyFontSize;
367
+ $[5] = node.bodyLineGap;
368
+ $[6] = node.icon;
369
+ $[7] = node.id;
370
+ $[8] = node.textColor;
371
+ $[9] = t1;
372
+ $[10] = t2;
373
+ $[11] = t3;
374
+ $[12] = t4;
503
375
  } else {
504
- t5 = $[39];
376
+ t1 = $[9];
377
+ t2 = $[10];
378
+ t3 = $[11];
379
+ t4 = $[12];
505
380
  }
506
- let t6;
507
- if ($[40] !== t2 || $[41] !== t3 || $[42] !== t4 || $[43] !== t5) {
508
- t6 = /*#__PURE__*/_jsxs(_Fragment, {
509
- children: [t2, t3, t4, t5]
381
+ let t5;
382
+ if ($[19] !== t1 || $[20] !== t2 || $[21] !== t3 || $[22] !== t4) {
383
+ t5 = /*#__PURE__*/_jsxs(_Fragment, {
384
+ children: [t1, t2, t3, t4]
510
385
  });
511
- $[40] = t2;
512
- $[41] = t3;
513
- $[42] = t4;
514
- $[43] = t5;
515
- $[44] = t6;
386
+ $[19] = t1;
387
+ $[20] = t2;
388
+ $[21] = t3;
389
+ $[22] = t4;
390
+ $[23] = t5;
516
391
  } else {
517
- t6 = $[44];
392
+ t5 = $[23];
518
393
  }
519
- return t6;
520
- }
521
- function _temp(line) {
522
- return typeof line === "string" ? line.length > 0 : line.text.length > 0;
394
+ return t5;
523
395
  }
524
396
  export function SvgGraphDiagram(t0) {
525
397
  const $ = _c(24);
@@ -616,7 +488,7 @@ export function SvgGraphDiagram(t0) {
616
488
  return t4;
617
489
  }
618
490
  function GraphSVG(t0) {
619
- const $ = _c(24);
491
+ const $ = _c(22);
620
492
  const {
621
493
  ir,
622
494
  title,
@@ -629,21 +501,13 @@ function GraphSVG(t0) {
629
501
  const {
630
502
  stylePreset
631
503
  } = useDiagramTheme();
632
- validateGraph(ir);
633
504
  let t1;
634
505
  if ($[0] !== effects || $[1] !== ir || $[2] !== mode || $[3] !== paper || $[4] !== progress || $[5] !== stylePreset || $[6] !== title || $[7] !== viewport) {
635
- const graph = resolveGraphLayout(ir);
636
- const layout = graph.layout;
637
- const nodeBoxes = new Map();
638
- for (const n of graph.nodes) {
639
- nodeBoxes.set(n.id, nodeBox(n, layout));
640
- }
641
- const groupBoxes = new Map();
642
- for (const g of graph.groups ?? []) {
643
- groupBoxes.set(g.id, groupBox(g, graph.nodes, layout, graph.groups));
644
- }
645
- const annotations = resolveGraphAnnotations(graph);
646
- const segments = buildSegments(graph.nodes.length, graph.edges.length);
506
+ const layout = legacyGraphLayout(ir);
507
+ const {
508
+ viewBox
509
+ } = layout;
510
+ const segments = buildSegments(ir.nodes.length, ir.edges.length);
647
511
  const seg = (kind, t2) => {
648
512
  const index = t2 === undefined ? 0 : t2;
649
513
  const segment = segments.find(candidate => candidate.kind === kind && candidate.index === index);
@@ -653,14 +517,16 @@ function GraphSVG(t0) {
653
517
  return segment;
654
518
  };
655
519
  const groupsSeg = seg("groups");
656
- const routedEdges = computePaths(graph);
657
- const indexedEdges = routedEdges.map((routedEdge, index_0) => ({
658
- ...routedEdge,
520
+ const indexedEdges = layout.edges.map((edgeLayout, index_0) => ({
521
+ ...edgeLayout,
659
522
  index: index_0,
660
523
  segment: seg("edge", index_0),
661
- layer: routedEdge.edge.layer ?? "foreground"
662
- })).filter(_temp2);
663
- const viewBox = graphContentViewBox(graph, routedEdges);
524
+ layer: edgeLayout.edge.layer ?? "foreground"
525
+ })).filter(_temp);
526
+ const {
527
+ graphNodes,
528
+ notes
529
+ } = splitNotes(layout.nodes);
664
530
  const viewportProps = svgViewportProps(viewBox, viewport);
665
531
  let t3;
666
532
  if ($[9] !== title) {
@@ -741,45 +607,24 @@ function GraphSVG(t0) {
741
607
  }
742
608
  let t9;
743
609
  if ($[20] !== progress) {
744
- t9 = t10 => {
745
- const {
746
- edge: edge_1,
747
- labelPlacement,
748
- badgePlacement,
749
- index: index_3,
750
- segment: segment_2
751
- } = t10;
752
- return /*#__PURE__*/_jsx(EdgeOverlay, {
753
- edge: edge_1,
754
- labelPlacement: labelPlacement,
755
- badgePlacement: badgePlacement,
756
- progress: progress,
757
- start: segment_2.start,
758
- end: segment_2.end
759
- }, `edge-overlay-${index_3}`);
760
- };
610
+ t9 = edgeLayout_0 => /*#__PURE__*/_jsx(EdgeOverlay, {
611
+ layout: edgeLayout_0,
612
+ progress: progress,
613
+ start: edgeLayout_0.segment.start,
614
+ end: edgeLayout_0.segment.end
615
+ }, `edge-overlay-${edgeLayout_0.index}`);
761
616
  $[20] = progress;
762
617
  $[21] = t9;
763
618
  } else {
764
619
  t9 = $[21];
765
620
  }
766
- let t10;
767
- if ($[22] !== progress) {
768
- t10 = (annotation, i_0) => /*#__PURE__*/_jsx(AnnotationText, {
769
- annotation: annotation,
770
- progress: progress,
771
- start: ANNOTATION_REVEAL_START,
772
- end: 1,
773
- index: i_0
774
- }, `annot-${i_0}`);
775
- $[22] = progress;
776
- $[23] = t10;
777
- } else {
778
- t10 = $[23];
779
- }
780
621
  t1 = /*#__PURE__*/_jsxs("svg", {
781
622
  "data-diagram-style-preset": stylePreset,
782
623
  ...viewportProps,
624
+ style: {
625
+ ...viewportProps.style,
626
+ ...TEXT_SHAPING
627
+ },
783
628
  viewBox: `${viewBox.x} ${viewBox.y} ${viewBox.w} ${viewBox.h}`,
784
629
  preserveAspectRatio: "xMidYMid meet",
785
630
  role: "img",
@@ -791,39 +636,33 @@ function GraphSVG(t0) {
791
636
  y: viewBox.y,
792
637
  width: viewBox.w,
793
638
  height: viewBox.h
794
- }), (graph.groups ?? []).map(g_0 => {
795
- const box = groupBoxes.get(g_0.id);
796
- if (!box) {
797
- return null;
798
- }
799
- return /*#__PURE__*/_jsx(GroupRect, {
800
- group: g_0,
801
- box: box,
802
- dividers: groupDividerLines(g_0, graph.nodes, layout, graph.groups),
803
- progress: progress,
804
- start: groupsSeg.start,
805
- end: groupsSeg.end
806
- }, `group-${g_0.id}`);
807
- }), indexedEdges.filter(_temp3).map(t7), graph.nodes.map((node, i) => {
808
- const box_0 = nodeBoxes.get(node.id);
809
- if (!box_0) {
810
- return null;
811
- }
639
+ }), layout.groups.map(groupLayout => /*#__PURE__*/_jsx(GroupRect, {
640
+ layout: groupLayout,
641
+ progress: progress,
642
+ start: groupsSeg.start,
643
+ end: groupsSeg.end
644
+ }, `group-${groupLayout.group.id}`)), indexedEdges.filter(_temp2).map(t7), graphNodes.map((nodeLayout, i) => {
812
645
  const segNode = seg("node", i);
813
646
  return /*#__PURE__*/_jsx(NodeRect, {
814
- node: node,
815
- box: box_0,
647
+ layout: nodeLayout,
816
648
  progress: progress,
817
649
  start: segNode.start,
818
650
  end: segNode.end
819
- }, `node-${node.id}`);
820
- }), indexedEdges.filter(_temp4).map(t8), effects && /*#__PURE__*/_jsx(GraphFlowEffects, {
651
+ }, `node-${nodeLayout.node.id}`);
652
+ }), indexedEdges.filter(_temp3).map(t8), effects && /*#__PURE__*/_jsx(GraphFlowEffects, {
821
653
  edges: indexedEdges,
822
654
  viewBox: viewBox,
823
655
  progress: progress,
824
656
  mode: mode,
825
657
  playhead: typeof effects === "object" ? effects.flow : undefined
826
- }), indexedEdges.map(t9), annotations.map(t10)]
658
+ }), indexedEdges.map(t9), notes.map(note => /*#__PURE__*/_jsx(AnnotationText, {
659
+ note: note,
660
+ annotations: ir.annotations,
661
+ leaders: layout.leaders,
662
+ progress: progress,
663
+ start: ANNOTATION_REVEAL_START,
664
+ end: 1
665
+ }, note.node.id))]
827
666
  });
828
667
  $[0] = effects;
829
668
  $[1] = ir;
@@ -839,19 +678,19 @@ function GraphSVG(t0) {
839
678
  }
840
679
  return t1;
841
680
  }
842
- function _temp4(t0) {
681
+ function _temp3(t0) {
843
682
  const {
844
683
  layer: layer_0
845
684
  } = t0;
846
685
  return layer_0 === "foreground";
847
686
  }
848
- function _temp3(t0) {
687
+ function _temp2(t0) {
849
688
  const {
850
689
  layer
851
690
  } = t0;
852
691
  return layer === "background";
853
692
  }
854
- function _temp2(t0) {
693
+ function _temp(t0) {
855
694
  const {
856
695
  d
857
696
  } = t0;