@knowvah/dot-engine 2.0.1 → 2.0.2

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 (40) hide show
  1. package/dist/async/collect.d.ts.map +1 -1
  2. package/dist/async/render-async.d.ts.map +1 -1
  3. package/dist/gvc/device-labels.d.ts +30 -0
  4. package/dist/gvc/device-labels.d.ts.map +1 -0
  5. package/dist/gvc/device-transform.d.ts +22 -0
  6. package/dist/gvc/device-transform.d.ts.map +1 -0
  7. package/dist/gvc/device.d.ts +2 -42
  8. package/dist/gvc/device.d.ts.map +1 -1
  9. package/dist/index.js +73 -69
  10. package/dist/index.js.map +4 -4
  11. package/dist/layout/dot/graph-label.d.ts +10 -0
  12. package/dist/layout/dot/graph-label.d.ts.map +1 -1
  13. package/dist/layout/fdp/xlayout.d.ts +1 -1
  14. package/dist/layout/neato/dijkstra.d.ts +0 -32
  15. package/dist/layout/neato/dijkstra.d.ts.map +1 -1
  16. package/dist/layout/neato/fdp-adjust.d.ts +12 -1
  17. package/dist/layout/neato/fdp-adjust.d.ts.map +1 -1
  18. package/dist/layout/neato/index.d.ts +5 -5
  19. package/dist/layout/neato/index.d.ts.map +1 -1
  20. package/dist/layout/sfdp/index.d.ts.map +1 -1
  21. package/dist/render/public.d.ts +5 -0
  22. package/dist/render/public.d.ts.map +1 -1
  23. package/dist/render.js +70 -66
  24. package/dist/render.js.map +4 -4
  25. package/package.json +1 -1
  26. package/src/async/collect.ts +2 -14
  27. package/src/async/render-async.ts +1 -9
  28. package/src/gvc/device-labels.ts +98 -0
  29. package/src/gvc/device-transform.ts +58 -0
  30. package/src/gvc/device.ts +8 -132
  31. package/src/layout/dot/graph-label.ts +6 -1
  32. package/src/layout/fdp/xlayout.ts +3 -2
  33. package/src/layout/neato/dijkstra.ts +0 -141
  34. package/src/layout/neato/fdp-adjust.ts +25 -3
  35. package/src/layout/neato/index.ts +13 -12
  36. package/src/layout/sfdp/index.ts +2 -1
  37. package/src/render/public.ts +6 -5
  38. package/dist/layout/neato/overlap.d.ts +0 -85
  39. package/dist/layout/neato/overlap.d.ts.map +0 -1
  40. package/src/layout/neato/overlap.ts +0 -158
@@ -1 +1 @@
1
- {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/async/collect.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAYjE,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,2BAA2B;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED,qDAAqD;AACrD,MAAM,WAAW,SAAS;IACxB,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AA8HD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,GAAG,SAAS,CAa1E"}
1
+ {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/async/collect.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,EAAE,gBA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AAC,CAAC;AAEjE,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAED,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAoDD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,WAAW,CAC/B,CAAC,EAAE,KAAK,EACR,MAAM,EAAE,YAAY,EACpB,IAAI,CAAC,EAAE,kBAAkB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAsB5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,EAClB,IAAI,CAAC,EAAE,eAAe,GACrB,OAAO,CAAC,cAAc,CAAC,CAWzB"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Label emission shared by edge labels, node xlabels and cluster/graph
3
+ * labels (split from device.ts for the file-size cap; re-exported there).
4
+ *
5
+ * @see lib/common/labels.c:emit_label
6
+ * @see lib/common/emit.c:emit_label
7
+ */
8
+ import type { Graph } from '../model/graph.js';
9
+ import type { Node } from '../model/node.js';
10
+ import type { RendererPlugin } from './context.js';
11
+ import type { RenderJob } from './job.js';
12
+ import type { TextlabelT } from '../common/types.js';
13
+ /**
14
+ * Emit one label's text spans if present and placed.
15
+ * Shared by edge-label, node-xlabel, and graph-label slots.
16
+ * URL/anchor/map machinery and E_decorate attachment (emit.c:emit_attachment)
17
+ * are not ported, matching the live path's AD-2 scope.
18
+ * @see lib/common/emit.c:emit_label
19
+ * @see lib/common/labels.c:emit_label
20
+ */
21
+ export declare function renderOneLabel(lp: TextlabelT | undefined, renderer: RendererPlugin, job: RenderJob, requireSet?: boolean): void;
22
+ /**
23
+ * Emit node external label (ND_xlabel) if placed.
24
+ * Must run inside the node group, after codefn (shape draw), matching C order.
25
+ * @see lib/common/emit.c:emit_node (1829-1830)
26
+ */
27
+ export declare function renderNodeXLabel(n: Node, renderer: RendererPlugin, job: RenderJob): void;
28
+ /** Cluster labels go through the single emit_label port. @see labels.c:emit_label */
29
+ export declare function renderClusterLabel(sg: Graph, renderer: RendererPlugin, job: RenderJob): void;
30
+ //# sourceMappingURL=device-labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-labels.d.ts","sourceRoot":"","sources":["../../src/gvc/device-labels.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AA0BrD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,UAAU,GAAG,SAAS,EAC1B,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,SAAS,EACd,UAAU,UAAO,GAChB,IAAI,CA8BN;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAExF;AAED,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAE5F"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Graph-to-device point transform (split from device.ts for the file-size
3
+ * cap; re-exported there).
4
+ *
5
+ * @see lib/gvc/gvrender.c:gvrender_ptf
6
+ */
7
+ import type { Point } from '../model/geom.js';
8
+ import { type RenderJob } from './job.js';
9
+ /**
10
+ * Transform a point from graph to device coordinates.
11
+ * Short-circuits when GVRENDER_DOES_TRANSFORM is set (renderer owns mapping).
12
+ *
13
+ * @see lib/gvc/gvrender.c:gvrender_ptf
14
+ */
15
+ export declare function transformPoint(p: Point, job: RenderJob): Point;
16
+ /** Rotation branch: out.x = -(p.y+ty)*sx, out.y = (p.x+tx)*sy @see gvrender_ptf */
17
+ export declare function applyRotation(p: Point, tx: number, ty: number, sx: number, sy: number): Point;
18
+ /** No-rotation branch: out.x = (p.x+tx)*sx, out.y = (p.y+ty)*sy @see gvrender_ptf */
19
+ export declare function applyScale(p: Point, tx: number, ty: number, sx: number, sy: number): Point;
20
+ /** Construct a Point value. Extracted to avoid inline object literals in return position. */
21
+ export declare function buildPoint(x: number, y: number): Point;
22
+ //# sourceMappingURL=device-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-transform.d.ts","sourceRoot":"","sources":["../../src/gvc/device-transform.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,UAAU,CAAC;AAMnE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,GAAG,KAAK,CAe9D;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,CAI7F;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,CAI1F;AAED,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,CAGtD"}
@@ -1,42 +1,17 @@
1
- /**
2
- * Device render loop and coordinate transform.
3
- *
4
- * Ports gvrender_ptf, gvrender_begin_graph, and gvrender_end_graph from
5
- * lib/gvc/gvrender.c. render() is the top-level entry point; it lives here
6
- * (not on GvcContext) to avoid a circular import.
7
- *
8
- * @see lib/gvc/gvrender.c
9
- * @see lib/gvc/gvdevice.c
10
- */
11
- import type { Point } from '../model/geom.js';
12
1
  import type { Graph } from '../model/graph.js';
13
2
  import type { Node } from '../model/node.js';
14
3
  import type { Edge } from '../model/edge.js';
15
4
  import type { RendererPlugin } from './context.js';
16
5
  import { GvcContext } from './context.js';
17
- import type { TextlabelT } from '../common/types.js';
18
6
  import { RenderJob } from './job.js';
19
- /** Cluster labels go through the single emit_label port. @see labels.c:emit_label */
20
- export declare function renderClusterLabel(sg: Graph, renderer: RendererPlugin, job: RenderJob): void;
7
+ export { transformPoint, applyRotation, applyScale, buildPoint } from './device-transform.js';
8
+ export { renderOneLabel, renderNodeXLabel, renderClusterLabel } from './device-labels.js';
21
9
  declare module './job.js' {
22
10
  interface RenderJob {
23
11
  /** When true, usershape() inlines resolved image bytes as a data: URI. */
24
12
  inlineImages?: boolean;
25
13
  }
26
14
  }
27
- /**
28
- * Transform a point from graph to device coordinates.
29
- * Short-circuits when GVRENDER_DOES_TRANSFORM is set (renderer owns mapping).
30
- *
31
- * @see lib/gvc/gvrender.c:gvrender_ptf
32
- */
33
- export declare function transformPoint(p: Point, job: RenderJob): Point;
34
- /** Rotation branch: out.x = -(p.y+ty)*sx, out.y = (p.x+tx)*sy @see gvrender_ptf */
35
- export declare function applyRotation(p: Point, tx: number, ty: number, sx: number, sy: number): Point;
36
- /** No-rotation branch: out.x = (p.x+tx)*sx, out.y = (p.y+ty)*sy @see gvrender_ptf */
37
- export declare function applyScale(p: Point, tx: number, ty: number, sx: number, sy: number): Point;
38
- /** Construct a Point value. Extracted to avoid inline object literals in return position. */
39
- export declare function buildPoint(x: number, y: number): Point;
40
15
  /**
41
16
  * Render a single node if not already rendered.
42
17
  * push_obj_state before emit_begin_node; pop_obj_state in emit_end_node.
@@ -46,21 +21,6 @@ export declare function buildPoint(x: number, y: number): Point;
46
21
  */
47
22
  export declare function renderNode(n: Node, renderer: RendererPlugin, job: RenderJob, done: Set<Node>): void;
48
23
  export declare function renderEdge(e: Edge, renderer: RendererPlugin, job: RenderJob): void;
49
- /**
50
- * Emit one label's text spans if present and placed.
51
- * Shared by edge-label, node-xlabel, and graph-label slots.
52
- * URL/anchor/map machinery and E_decorate attachment (emit.c:emit_attachment)
53
- * are not ported, matching the live path's AD-2 scope.
54
- * @see lib/common/emit.c:emit_label
55
- * @see lib/common/labels.c:emit_label
56
- */
57
- export declare function renderOneLabel(lp: TextlabelT | undefined, renderer: RendererPlugin, job: RenderJob, requireSet?: boolean): void;
58
- /**
59
- * Emit node external label (ND_xlabel) if placed.
60
- * Must run inside the node group, after codefn (shape draw), matching C order.
61
- * @see lib/common/emit.c:emit_node (1829-1830)
62
- */
63
- export declare function renderNodeXLabel(n: Node, renderer: RendererPlugin, job: RenderJob): void;
64
24
  /**
65
25
  * Emit root-graph label (GD_label) if present and placed.
66
26
  * Must run before clusters and nodes (emit_page order: background, then label,
@@ -1 +1 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/gvc/device.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAO,MAAM,kBAAkB,CAAC;AAInD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,UAAU,EAAW,MAAM,cAAc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Ac,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAa1F,OAAO,QAAQ,UAAU,CAAC;IACxB,UAAU,SAAS;QACjB,0EAA0E;QAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB;CACF;AAuED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CA4BnG;AA2BD,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CA8BlF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAIzF;AAkFD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAQvF;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,CAyBtF;AA8BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ,GAAG,MAAM,CA8E9F"}
package/dist/index.js CHANGED
@@ -26571,10 +26571,7 @@ function walkNodesAndEdges(g, renderer, job, info) {
26571
26571
  }
26572
26572
  }
26573
26573
 
26574
- // src/gvc/device.ts
26575
- function renderClusterLabel(sg, renderer, job) {
26576
- renderOneLabel(sg.info.label, renderer, job, false);
26577
- }
26574
+ // src/gvc/device-transform.ts
26578
26575
  function transformPoint(p, job) {
26579
26576
  if ((job.flags & GVRENDER_DOES_TRANSFORM) !== 0) {
26580
26577
  return p;
@@ -26594,6 +26591,50 @@ function buildPoint(x, y) {
26594
26591
  const pt = { x, y };
26595
26592
  return pt;
26596
26593
  }
26594
+
26595
+ // src/gvc/device-labels.ts
26596
+ var VALIGN_TOP = "t".charCodeAt(0);
26597
+ var VALIGN_BOTTOM = "b".charCodeAt(0);
26598
+ function labelFirstSpanY(lp) {
26599
+ if (lp.valign === VALIGN_TOP) return lp.pos.y + lp.space.y / 2 - lp.fontsize;
26600
+ if (lp.valign === VALIGN_BOTTOM) {
26601
+ return lp.pos.y - lp.space.y / 2 + lp.dimen.y - lp.fontsize;
26602
+ }
26603
+ return lp.pos.y + lp.dimen.y / 2 - lp.fontsize;
26604
+ }
26605
+ function labelSpanX(lp, just) {
26606
+ if (just === "l") return lp.pos.x - lp.space.x / 2;
26607
+ if (just === "r") return lp.pos.x + lp.space.x / 2;
26608
+ return lp.pos.x;
26609
+ }
26610
+ function renderOneLabel(lp, renderer, job, requireSet = true) {
26611
+ if (!lp) return;
26612
+ if (requireSet && !lp.set) return;
26613
+ if (lp.html) {
26614
+ if (lp.u.kind === "html") {
26615
+ const html = lp.u.html;
26616
+ const pos = lp.pos;
26617
+ withLabelEmitState(job, () => emitHtmlLabel(html, pos, renderer, job));
26618
+ }
26619
+ return;
26620
+ }
26621
+ if (lp.u.kind !== "txt" || lp.u.nspans < 1) return;
26622
+ let y = labelFirstSpanY(lp);
26623
+ for (let i = 0; i < lp.u.nspans; i++) {
26624
+ const span = lp.u.span[i];
26625
+ if (!span) break;
26626
+ gvrenderTextspan(renderer, { x: labelSpanX(lp, span.just), y }, span, job);
26627
+ y -= span.size.y;
26628
+ }
26629
+ }
26630
+ function renderNodeXLabel(n, renderer, job) {
26631
+ renderOneLabel(n.info.xlabel, renderer, job);
26632
+ }
26633
+ function renderClusterLabel(sg, renderer, job) {
26634
+ renderOneLabel(sg.info.label, renderer, job, false);
26635
+ }
26636
+
26637
+ // src/gvc/device.ts
26597
26638
  function labelTextOf2(lp) {
26598
26639
  return lp?.text ?? null;
26599
26640
  }
@@ -26668,43 +26709,6 @@ function renderEdge(e, renderer, job) {
26668
26709
  job.popObj();
26669
26710
  }
26670
26711
  }
26671
- var VALIGN_TOP = "t".charCodeAt(0);
26672
- var VALIGN_BOTTOM = "b".charCodeAt(0);
26673
- function labelFirstSpanY(lp) {
26674
- if (lp.valign === VALIGN_TOP) return lp.pos.y + lp.space.y / 2 - lp.fontsize;
26675
- if (lp.valign === VALIGN_BOTTOM) {
26676
- return lp.pos.y - lp.space.y / 2 + lp.dimen.y - lp.fontsize;
26677
- }
26678
- return lp.pos.y + lp.dimen.y / 2 - lp.fontsize;
26679
- }
26680
- function labelSpanX(lp, just) {
26681
- if (just === "l") return lp.pos.x - lp.space.x / 2;
26682
- if (just === "r") return lp.pos.x + lp.space.x / 2;
26683
- return lp.pos.x;
26684
- }
26685
- function renderOneLabel(lp, renderer, job, requireSet = true) {
26686
- if (!lp) return;
26687
- if (requireSet && !lp.set) return;
26688
- if (lp.html) {
26689
- if (lp.u.kind === "html") {
26690
- const html = lp.u.html;
26691
- const pos = lp.pos;
26692
- withLabelEmitState(job, () => emitHtmlLabel(html, pos, renderer, job));
26693
- }
26694
- return;
26695
- }
26696
- if (lp.u.kind !== "txt" || lp.u.nspans < 1) return;
26697
- let y = labelFirstSpanY(lp);
26698
- for (let i = 0; i < lp.u.nspans; i++) {
26699
- const span = lp.u.span[i];
26700
- if (!span) break;
26701
- gvrenderTextspan(renderer, { x: labelSpanX(lp, span.just), y }, span, job);
26702
- y -= span.size.y;
26703
- }
26704
- }
26705
- function renderNodeXLabel(n, renderer, job) {
26706
- renderOneLabel(n.info.xlabel, renderer, job);
26707
- }
26708
26712
  function renderGraphLabel(g, renderer, job) {
26709
26713
  setHtmlAnchorObj(svgGraphId(g, job), labelTextOf2(g.info.label), job.obj ?? void 0);
26710
26714
  renderOneLabel(g.info.label, renderer, job, false);
@@ -47665,7 +47669,15 @@ var ADJUST_MODES = /* @__PURE__ */ new Map([
47665
47669
  ["porthoxy", [AM_PORTHOXY, "xy pseudo-orthogonal constraints"]],
47666
47670
  ["porthoyx", [AM_PORTHOYX, "yx pseudo-orthogonal constraints"]]
47667
47671
  ]);
47672
+ function warnUnrecognizedOverlap(flag) {
47673
+ if (flag === void 0 || flag === "") return;
47674
+ const s = flag.toLowerCase();
47675
+ if (s.startsWith("prism") || NAMED_MODES.has(s)) return;
47676
+ if (mapBoolDflt(flag, false) === mapBoolDflt(flag, true)) return;
47677
+ console.warn(`Unrecognized overlap value "${flag}" - using false`);
47678
+ }
47668
47679
  function getAdjustMode(flag) {
47680
+ warnUnrecognizedOverlap(flag);
47669
47681
  const ntry = overlapPrismTries(flag);
47670
47682
  if (ntry !== null) return { mode: AM_PRISM, print: "prism", value: ntry };
47671
47683
  const named = ADJUST_MODES.get((flag ?? "").toLowerCase());
@@ -47714,8 +47726,11 @@ function removeOverlapWith(g, am) {
47714
47726
  return nret + (am.mode === AM_SCALE ? sAdjustGraph(g) : adjustVoronoi(g, am));
47715
47727
  }
47716
47728
  function adjustNodesFull(g) {
47717
- const flag = g.attrs.get("overlap") ?? g.root.attrs.get("overlap");
47718
- return removeOverlapWith(g, getAdjustMode(flag));
47729
+ if (g.nodes.size < 2) return 0;
47730
+ return removeOverlapWith(g, graphAdjustMode(g));
47731
+ }
47732
+ function graphAdjustMode(g) {
47733
+ return getAdjustMode(g.attrs.get("overlap") ?? g.root.attrs.get("overlap"));
47719
47734
  }
47720
47735
 
47721
47736
  // src/layout/twopi/init.ts
@@ -48082,8 +48097,8 @@ function parseModel(g) {
48082
48097
  if (!s) return MODEL_SHORTPATH2;
48083
48098
  return MODEL_MAP[s] ?? MODEL_SHORTPATH2;
48084
48099
  }
48085
- function maybeRemoveOverlap(g) {
48086
- adjustNodesFull(g);
48100
+ function maybeRemoveOverlap(g, am) {
48101
+ removeOverlapWith(g, am);
48087
48102
  }
48088
48103
  function neatoLayout(g) {
48089
48104
  graphInit(g, false);
@@ -48098,13 +48113,14 @@ function neatoLayout(g) {
48098
48113
  for (const e of g.edges) initEdgeLabels(e, g, measurer);
48099
48114
  }
48100
48115
  const mode = parseMode(g);
48116
+ const am = graphAdjustMode(g);
48101
48117
  const model = parseModel(g);
48102
48118
  const { graphs: comps, pinned } = neatoPack(g, mode) >= 0 ? pccomps(g, "_neato_cc") : { graphs: [g], pinned: false };
48103
48119
  if (comps.length > 1) {
48104
- layoutComponents(g, comps, mode, model, pinned);
48120
+ layoutComponents(g, comps, { mode, model, am }, pinned);
48105
48121
  } else {
48106
48122
  solveModel2(g, mode, model);
48107
- maybeRemoveOverlap(g);
48123
+ maybeRemoveOverlap(g, am);
48108
48124
  splineEdgesShifted(g);
48109
48125
  }
48110
48126
  addClusters(g);
@@ -48140,11 +48156,11 @@ function addClusters(g) {
48140
48156
  g.info.clust = clusters;
48141
48157
  g.info.n_cluster = clusters.length;
48142
48158
  }
48143
- function layoutComponents(g, comps, mode, model, pinned) {
48159
+ function layoutComponents(g, comps, solve2, pinned) {
48144
48160
  for (const gc of comps) {
48145
48161
  setEdgeTypeFromAttr(gc, EDGETYPE_LINE);
48146
- solveModel2(gc, mode, model);
48147
- maybeRemoveOverlap(gc);
48162
+ solveModel2(gc, solve2.mode, solve2.model);
48163
+ maybeRemoveOverlap(gc, solve2.am);
48148
48164
  splineEdgesShifted(gc);
48149
48165
  }
48150
48166
  const pinfo = {
@@ -49022,6 +49038,7 @@ function fdpXLayout(g, xpms) {
49022
49038
  }
49023
49039
  function removeOverlapAs(g, flag) {
49024
49040
  if (g.nodes.size < 2) return;
49041
+ warnUnrecognizedOverlap(flag);
49025
49042
  normalizeG(g);
49026
49043
  simpleScale(g);
49027
49044
  const ntry = overlapPrismTries(flag);
@@ -50172,6 +50189,7 @@ function resolveControl(g) {
50172
50189
  const pad = { x: DFLT_MARGIN / 72, y: DFLT_MARGIN / 72 };
50173
50190
  const overlap5 = aggetGraph(g, "overlap");
50174
50191
  const flag = overlap5 === void 0 ? "prism0" : overlap5;
50192
+ warnUnrecognizedOverlap(flag);
50175
50193
  const ntry = overlapPrismTries(flag);
50176
50194
  if (ntry !== null) {
50177
50195
  ctrl.overlap = ntry;
@@ -55483,16 +55501,9 @@ function collectEdge(acc, e) {
55483
55501
  addLabel(acc, e.attrs.get("headlabel"), lfi);
55484
55502
  addLabel(acc, e.attrs.get("taillabel"), lfi);
55485
55503
  }
55486
- function graphLabelFont(sg) {
55487
- const get = (k) => sg.attrs.get(k) ?? sg.graphDefaultsSnapshot?.get(k);
55488
- return {
55489
- fontname: get("fontname") ?? DEFAULT_FONTNAME,
55490
- fontsize: parseFloat(get("fontsize") ?? "") || DEFAULT_FONTSIZE2
55491
- };
55492
- }
55493
55504
  function collectGraphLabels(acc, sg, root) {
55494
55505
  if (isACluster(sg)) {
55495
- addLabel(acc, sg.attrs.get("label") ?? sg.graphDefaultsSnapshot?.get("label"), graphLabelFont(sg));
55506
+ addLabel(acc, sg.attrs.get("label") ?? sg.graphDefaultsSnapshot?.get("label"), readFontParams(sg));
55496
55507
  }
55497
55508
  for (const child of sg.subgraphs.values()) collectGraphLabels(acc, child, root);
55498
55509
  }
@@ -55552,13 +55563,6 @@ async function loadFonts(fontSet, fonts, timeoutMs) {
55552
55563
 
55553
55564
  // src/async/render-async.ts
55554
55565
  var DEFAULT_FONT_TIMEOUT_MS = 3e3;
55555
- function checkRenderArgs2(g, format, opts) {
55556
- if (typeof g !== "object" || g === null) throw invalidArgType("g", "object", g);
55557
- if (typeof format !== "string") throw invalidArgType("format", "string", format);
55558
- if (opts !== void 0 && (typeof opts !== "object" || opts === null)) {
55559
- throw invalidArgType("opts", "object or undefined", opts);
55560
- }
55561
- }
55562
55566
  function defaultFontSet() {
55563
55567
  const doc = Reflect.get(globalThis, "document");
55564
55568
  if (typeof doc !== "object" || doc === null) return void 0;
@@ -55594,7 +55598,7 @@ async function prefetchAll(g, opts) {
55594
55598
  return { fontIssues, sizes, bytes };
55595
55599
  }
55596
55600
  async function renderAsync(g, format, opts) {
55597
- checkRenderArgs2(g, format, opts);
55601
+ checkRenderArgs(g, format, opts);
55598
55602
  const engine = opts?.engine ?? "dot";
55599
55603
  try {
55600
55604
  const { fontIssues, sizes, bytes } = await prefetchAll(g, opts);
@@ -55810,7 +55814,7 @@ async function renderSvgInto(id, src, engine, opts) {
55810
55814
  }
55811
55815
 
55812
55816
  // src/index.ts
55813
- function checkRenderArgs3(dotSource, engine) {
55817
+ function checkRenderArgs2(dotSource, engine) {
55814
55818
  if (typeof dotSource !== "string") {
55815
55819
  throw invalidArgType("dotSource", "string", dotSource);
55816
55820
  }
@@ -55831,7 +55835,7 @@ function classifyError(err) {
55831
55835
  return out;
55832
55836
  }
55833
55837
  function renderSvg(dotSource, engine) {
55834
- checkRenderArgs3(dotSource, engine);
55838
+ checkRenderArgs2(dotSource, engine);
55835
55839
  const ctx = createDefaultContext();
55836
55840
  try {
55837
55841
  const g = parse(dotSource);
@@ -55844,7 +55848,7 @@ function renderSvg(dotSource, engine) {
55844
55848
  }
55845
55849
  }
55846
55850
  function tryRenderSvg(dotSource, engine) {
55847
- checkRenderArgs3(dotSource, engine);
55851
+ checkRenderArgs2(dotSource, engine);
55848
55852
  try {
55849
55853
  return { svg: renderSvg(dotSource, engine) };
55850
55854
  } catch (err) {