@knowvah/dot-engine 2.0.0 → 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 (50) 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 +174 -137
  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/normalize.d.ts +2 -1
  14. package/dist/layout/fdp/normalize.d.ts.map +1 -1
  15. package/dist/layout/fdp/xlayout.d.ts +1 -1
  16. package/dist/layout/fdp/xlayout.d.ts.map +1 -1
  17. package/dist/layout/neato/dijkstra.d.ts +0 -32
  18. package/dist/layout/neato/dijkstra.d.ts.map +1 -1
  19. package/dist/layout/neato/fdp-adjust.d.ts +14 -3
  20. package/dist/layout/neato/fdp-adjust.d.ts.map +1 -1
  21. package/dist/layout/neato/index.d.ts +5 -5
  22. package/dist/layout/neato/index.d.ts.map +1 -1
  23. package/dist/layout/neato/sc-adjust.d.ts +2 -9
  24. package/dist/layout/neato/sc-adjust.d.ts.map +1 -1
  25. package/dist/layout/neato/simple-scale.d.ts +15 -0
  26. package/dist/layout/neato/simple-scale.d.ts.map +1 -0
  27. package/dist/layout/sfdp/index.d.ts.map +1 -1
  28. package/dist/render/public.d.ts +5 -0
  29. package/dist/render/public.d.ts.map +1 -1
  30. package/dist/render.js +171 -134
  31. package/dist/render.js.map +4 -4
  32. package/package.json +1 -1
  33. package/src/async/collect.ts +2 -14
  34. package/src/async/render-async.ts +1 -9
  35. package/src/gvc/device-labels.ts +98 -0
  36. package/src/gvc/device-transform.ts +58 -0
  37. package/src/gvc/device.ts +8 -132
  38. package/src/layout/dot/graph-label.ts +6 -1
  39. package/src/layout/fdp/normalize.ts +12 -8
  40. package/src/layout/fdp/xlayout.ts +8 -6
  41. package/src/layout/neato/dijkstra.ts +0 -141
  42. package/src/layout/neato/fdp-adjust.ts +33 -8
  43. package/src/layout/neato/index.ts +13 -12
  44. package/src/layout/neato/sc-adjust.ts +2 -16
  45. package/src/layout/neato/simple-scale.ts +54 -0
  46. package/src/layout/sfdp/index.ts +2 -1
  47. package/src/render/public.ts +6 -5
  48. package/dist/layout/neato/overlap.d.ts +0 -85
  49. package/dist/layout/neato/overlap.d.ts.map +0 -1
  50. 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,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;AAkHD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,GAAG,SAAS,CAa1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"render-async.d.ts","sourceRoot":"","sources":["../../src/async/render-async.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAA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U,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACtD,oFAAoF;IACpF,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAC1D,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kFAAkF;IAClF,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,qFAAqF;AACrF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,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"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AAE,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);
@@ -45709,6 +45713,102 @@ function scAdjust(g, equal) {
45709
45713
  return 1;
45710
45714
  }
45711
45715
 
45716
+ // src/layout/neato/simple-scale.ts
45717
+ var ISZERO = (d) => Math.abs(d) < 1e-9;
45718
+ var LF = /^\s*([+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)/;
45719
+ function scanPair(p) {
45720
+ const m1 = LF.exec(p);
45721
+ if (m1 === null) return [];
45722
+ const rest = p.slice(m1[0].length);
45723
+ if (!rest.startsWith(",")) return [parseFloat(m1[1])];
45724
+ const m2 = LF.exec(rest.slice(1));
45725
+ return m2 === null ? [parseFloat(m1[1])] : [parseFloat(m1[1]), parseFloat(m2[1])];
45726
+ }
45727
+ function simpleScale(g) {
45728
+ const p = aggetGraph(g, "scale");
45729
+ if (p === void 0) return 0;
45730
+ const sc = scanPair(p);
45731
+ if (sc.length === 0) return 0;
45732
+ const x = sc[0];
45733
+ if (ISZERO(x)) return 0;
45734
+ const y = sc.length === 1 ? x : sc[1];
45735
+ if (ISZERO(y)) return 0;
45736
+ if (y === 1 && x === 1) return 0;
45737
+ for (const n of g.nodes.values()) {
45738
+ n.info.pos[0] *= x;
45739
+ n.info.pos[1] *= y;
45740
+ }
45741
+ return 1;
45742
+ }
45743
+
45744
+ // src/layout/fdp/normalize.ts
45745
+ function mapbool5(s) {
45746
+ const t = s.toLowerCase();
45747
+ if (t === "false" || t === "no") return false;
45748
+ if (t === "true" || t === "yes") return true;
45749
+ const v = parseInt(s, 10);
45750
+ return !Number.isNaN(v) && v !== 0;
45751
+ }
45752
+ function angleSet(g) {
45753
+ const a = aggetGraph(g, "normalize");
45754
+ if (a === void 0 || a === "") return null;
45755
+ const ang = parseAngle2(a);
45756
+ if (ang === null) return null;
45757
+ return wrapDegrees(ang) / 180 * Math.PI;
45758
+ }
45759
+ function parseAngle2(a) {
45760
+ const m = /^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/.exec(a);
45761
+ if (m !== null) return parseFloat(m[0]);
45762
+ return mapbool5(a) ? 0 : null;
45763
+ }
45764
+ function wrapDegrees(ang) {
45765
+ while (ang > 180) ang -= 360;
45766
+ while (ang <= -180) ang += 360;
45767
+ return ang;
45768
+ }
45769
+ function normalizeG(g) {
45770
+ const phi0 = angleSet(g);
45771
+ if (phi0 === null) return 0;
45772
+ const nodes = [...g.nodes.values()];
45773
+ const first = nodes[0];
45774
+ if (first === void 0) return 0;
45775
+ const px = first.info.pos[0];
45776
+ const py = first.info.pos[1];
45777
+ for (const v of nodes) {
45778
+ v.info.pos[0] -= px;
45779
+ v.info.pos[1] -= py;
45780
+ }
45781
+ const ret = px || py ? 1 : 0;
45782
+ let e = null;
45783
+ for (const v of nodes) {
45784
+ const out = v.outEdges(g);
45785
+ if (out.length > 0) {
45786
+ e = out[0];
45787
+ break;
45788
+ }
45789
+ }
45790
+ if (e === null) return ret;
45791
+ const phi = phi0 - Math.atan2(
45792
+ e.head.info.pos[1] - e.tail.info.pos[1],
45793
+ e.head.info.pos[0] - e.tail.info.pos[0]
45794
+ );
45795
+ if (!phi) return ret;
45796
+ rotateAll(nodes, e.tail, phi);
45797
+ return 1;
45798
+ }
45799
+ function rotateAll(nodes, orig, phi) {
45800
+ const ox = orig.info.pos[0];
45801
+ const oy = orig.info.pos[1];
45802
+ const cosv = Math.cos(phi);
45803
+ const sinv = Math.sin(phi);
45804
+ for (const v of nodes) {
45805
+ const x = v.info.pos[0] - ox;
45806
+ const y = v.info.pos[1] - oy;
45807
+ v.info.pos[0] = x * cosv - y * sinv + ox;
45808
+ v.info.pos[1] = x * sinv + y * cosv + oy;
45809
+ }
45810
+ }
45811
+
45712
45812
  // src/layout/neato/constraint-adjust.ts
45713
45813
  var AM_ORTHO = 5;
45714
45814
  var AM_ORTHO_YX = 6;
@@ -47569,7 +47669,15 @@ var ADJUST_MODES = /* @__PURE__ */ new Map([
47569
47669
  ["porthoxy", [AM_PORTHOXY, "xy pseudo-orthogonal constraints"]],
47570
47670
  ["porthoyx", [AM_PORTHOYX, "yx pseudo-orthogonal constraints"]]
47571
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
+ }
47572
47679
  function getAdjustMode(flag) {
47680
+ warnUnrecognizedOverlap(flag);
47573
47681
  const ntry = overlapPrismTries(flag);
47574
47682
  if (ntry !== null) return { mode: AM_PRISM, print: "prism", value: ntry };
47575
47683
  const named = ADJUST_MODES.get((flag ?? "").toLowerCase());
@@ -47612,13 +47720,17 @@ function adjustVoronoi(g, am) {
47612
47720
  }
47613
47721
  function removeOverlapWith(g, am) {
47614
47722
  if (g.nodes.size < 2) return 0;
47615
- if (am.mode === AM_NONE) return 0;
47616
- if (am.mode > AM_SCALE) return adjustLate(g, am);
47617
- return am.mode === AM_SCALE ? sAdjustGraph(g) : adjustVoronoi(g, am);
47723
+ const nret = normalizeG(g) + simpleScale(g);
47724
+ if (am.mode === AM_NONE) return nret;
47725
+ if (am.mode > AM_SCALE) return nret + adjustLate(g, am);
47726
+ return nret + (am.mode === AM_SCALE ? sAdjustGraph(g) : adjustVoronoi(g, am));
47618
47727
  }
47619
47728
  function adjustNodesFull(g) {
47620
- const flag = g.attrs.get("overlap") ?? g.root.attrs.get("overlap");
47621
- 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"));
47622
47734
  }
47623
47735
 
47624
47736
  // src/layout/twopi/init.ts
@@ -47985,8 +48097,8 @@ function parseModel(g) {
47985
48097
  if (!s) return MODEL_SHORTPATH2;
47986
48098
  return MODEL_MAP[s] ?? MODEL_SHORTPATH2;
47987
48099
  }
47988
- function maybeRemoveOverlap(g) {
47989
- adjustNodesFull(g);
48100
+ function maybeRemoveOverlap(g, am) {
48101
+ removeOverlapWith(g, am);
47990
48102
  }
47991
48103
  function neatoLayout(g) {
47992
48104
  graphInit(g, false);
@@ -48001,13 +48113,14 @@ function neatoLayout(g) {
48001
48113
  for (const e of g.edges) initEdgeLabels(e, g, measurer);
48002
48114
  }
48003
48115
  const mode = parseMode(g);
48116
+ const am = graphAdjustMode(g);
48004
48117
  const model = parseModel(g);
48005
48118
  const { graphs: comps, pinned } = neatoPack(g, mode) >= 0 ? pccomps(g, "_neato_cc") : { graphs: [g], pinned: false };
48006
48119
  if (comps.length > 1) {
48007
- layoutComponents(g, comps, mode, model, pinned);
48120
+ layoutComponents(g, comps, { mode, model, am }, pinned);
48008
48121
  } else {
48009
48122
  solveModel2(g, mode, model);
48010
- maybeRemoveOverlap(g);
48123
+ maybeRemoveOverlap(g, am);
48011
48124
  splineEdgesShifted(g);
48012
48125
  }
48013
48126
  addClusters(g);
@@ -48043,11 +48156,11 @@ function addClusters(g) {
48043
48156
  g.info.clust = clusters;
48044
48157
  g.info.n_cluster = clusters.length;
48045
48158
  }
48046
- function layoutComponents(g, comps, mode, model, pinned) {
48159
+ function layoutComponents(g, comps, solve2, pinned) {
48047
48160
  for (const gc of comps) {
48048
48161
  setEdgeTypeFromAttr(gc, EDGETYPE_LINE);
48049
- solveModel2(gc, mode, model);
48050
- maybeRemoveOverlap(gc);
48162
+ solveModel2(gc, solve2.mode, solve2.model);
48163
+ maybeRemoveOverlap(gc, solve2.am);
48051
48164
  splineEdgesShifted(gc);
48052
48165
  }
48053
48166
  const pinfo = {
@@ -48750,71 +48863,6 @@ function fdpTLayout(g, xpms) {
48750
48863
  if (reset2) resetParams();
48751
48864
  }
48752
48865
 
48753
- // src/layout/fdp/normalize.ts
48754
- function mapbool5(s) {
48755
- const t = s.toLowerCase();
48756
- if (t === "false" || t === "no") return false;
48757
- if (t === "true" || t === "yes") return true;
48758
- const v = parseInt(s, 10);
48759
- return !Number.isNaN(v) && v !== 0;
48760
- }
48761
- function angleSet(g) {
48762
- const a = aggetGraph(g, "normalize");
48763
- if (a === void 0 || a === "") return null;
48764
- const ang = parseAngle2(a);
48765
- if (ang === null) return null;
48766
- return wrapDegrees(ang) * (Math.PI / 180);
48767
- }
48768
- function parseAngle2(a) {
48769
- const m = /^-?[\d.]+(?:[eE][-+]?\d+)?/.exec(a);
48770
- if (m !== null) return parseFloat(m[0]);
48771
- return mapbool5(a) ? 0 : null;
48772
- }
48773
- function wrapDegrees(ang) {
48774
- while (ang > 180) ang -= 360;
48775
- while (ang <= -180) ang += 360;
48776
- return ang;
48777
- }
48778
- function normalizeG(g) {
48779
- const phi0 = angleSet(g);
48780
- if (phi0 === null) return;
48781
- const nodes = [...g.nodes.values()];
48782
- const first = nodes[0];
48783
- if (first === void 0) return;
48784
- const px = first.info.pos[0];
48785
- const py = first.info.pos[1];
48786
- for (const v of nodes) {
48787
- v.info.pos[0] -= px;
48788
- v.info.pos[1] -= py;
48789
- }
48790
- let e = null;
48791
- for (const v of nodes) {
48792
- const out = v.outEdges(g);
48793
- if (out.length > 0) {
48794
- e = out[0];
48795
- break;
48796
- }
48797
- }
48798
- if (e === null) return;
48799
- const phi = phi0 - Math.atan2(
48800
- e.head.info.pos[1] - e.tail.info.pos[1],
48801
- e.head.info.pos[0] - e.tail.info.pos[0]
48802
- );
48803
- if (phi) rotateAll(nodes, e.tail, phi);
48804
- }
48805
- function rotateAll(nodes, orig, phi) {
48806
- const ox = orig.info.pos[0];
48807
- const oy = orig.info.pos[1];
48808
- const cosv = Math.cos(phi);
48809
- const sinv = Math.sin(phi);
48810
- for (const v of nodes) {
48811
- const x = v.info.pos[0] - ox;
48812
- const y = v.info.pos[1] - oy;
48813
- v.info.pos[0] = x * cosv - y * sinv + ox;
48814
- v.info.pos[1] = x * sinv + y * cosv + oy;
48815
- }
48816
- }
48817
-
48818
48866
  // src/layout/fdp/xlayout.ts
48819
48867
  var DFLT_OVERLAP = "9:prism";
48820
48868
  var PS2INCH3 = (x) => x / 72;
@@ -48990,7 +49038,9 @@ function fdpXLayout(g, xpms) {
48990
49038
  }
48991
49039
  function removeOverlapAs(g, flag) {
48992
49040
  if (g.nodes.size < 2) return;
49041
+ warnUnrecognizedOverlap(flag);
48993
49042
  normalizeG(g);
49043
+ simpleScale(g);
48994
49044
  const ntry = overlapPrismTries(flag);
48995
49045
  if (ntry !== null) {
48996
49046
  fdpAdjust(g, ntry);
@@ -50139,6 +50189,7 @@ function resolveControl(g) {
50139
50189
  const pad = { x: DFLT_MARGIN / 72, y: DFLT_MARGIN / 72 };
50140
50190
  const overlap5 = aggetGraph(g, "overlap");
50141
50191
  const flag = overlap5 === void 0 ? "prism0" : overlap5;
50192
+ warnUnrecognizedOverlap(flag);
50142
50193
  const ntry = overlapPrismTries(flag);
50143
50194
  if (ntry !== null) {
50144
50195
  ctrl.overlap = ntry;
@@ -55450,16 +55501,9 @@ function collectEdge(acc, e) {
55450
55501
  addLabel(acc, e.attrs.get("headlabel"), lfi);
55451
55502
  addLabel(acc, e.attrs.get("taillabel"), lfi);
55452
55503
  }
55453
- function graphLabelFont(sg) {
55454
- const get = (k) => sg.attrs.get(k) ?? sg.graphDefaultsSnapshot?.get(k);
55455
- return {
55456
- fontname: get("fontname") ?? DEFAULT_FONTNAME,
55457
- fontsize: parseFloat(get("fontsize") ?? "") || DEFAULT_FONTSIZE2
55458
- };
55459
- }
55460
55504
  function collectGraphLabels(acc, sg, root) {
55461
55505
  if (isACluster(sg)) {
55462
- 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));
55463
55507
  }
55464
55508
  for (const child of sg.subgraphs.values()) collectGraphLabels(acc, child, root);
55465
55509
  }
@@ -55519,13 +55563,6 @@ async function loadFonts(fontSet, fonts, timeoutMs) {
55519
55563
 
55520
55564
  // src/async/render-async.ts
55521
55565
  var DEFAULT_FONT_TIMEOUT_MS = 3e3;
55522
- function checkRenderArgs2(g, format, opts) {
55523
- if (typeof g !== "object" || g === null) throw invalidArgType("g", "object", g);
55524
- if (typeof format !== "string") throw invalidArgType("format", "string", format);
55525
- if (opts !== void 0 && (typeof opts !== "object" || opts === null)) {
55526
- throw invalidArgType("opts", "object or undefined", opts);
55527
- }
55528
- }
55529
55566
  function defaultFontSet() {
55530
55567
  const doc = Reflect.get(globalThis, "document");
55531
55568
  if (typeof doc !== "object" || doc === null) return void 0;
@@ -55561,7 +55598,7 @@ async function prefetchAll(g, opts) {
55561
55598
  return { fontIssues, sizes, bytes };
55562
55599
  }
55563
55600
  async function renderAsync(g, format, opts) {
55564
- checkRenderArgs2(g, format, opts);
55601
+ checkRenderArgs(g, format, opts);
55565
55602
  const engine = opts?.engine ?? "dot";
55566
55603
  try {
55567
55604
  const { fontIssues, sizes, bytes } = await prefetchAll(g, opts);
@@ -55777,7 +55814,7 @@ async function renderSvgInto(id, src, engine, opts) {
55777
55814
  }
55778
55815
 
55779
55816
  // src/index.ts
55780
- function checkRenderArgs3(dotSource, engine) {
55817
+ function checkRenderArgs2(dotSource, engine) {
55781
55818
  if (typeof dotSource !== "string") {
55782
55819
  throw invalidArgType("dotSource", "string", dotSource);
55783
55820
  }
@@ -55798,7 +55835,7 @@ function classifyError(err) {
55798
55835
  return out;
55799
55836
  }
55800
55837
  function renderSvg(dotSource, engine) {
55801
- checkRenderArgs3(dotSource, engine);
55838
+ checkRenderArgs2(dotSource, engine);
55802
55839
  const ctx = createDefaultContext();
55803
55840
  try {
55804
55841
  const g = parse(dotSource);
@@ -55811,7 +55848,7 @@ function renderSvg(dotSource, engine) {
55811
55848
  }
55812
55849
  }
55813
55850
  function tryRenderSvg(dotSource, engine) {
55814
- checkRenderArgs3(dotSource, engine);
55851
+ checkRenderArgs2(dotSource, engine);
55815
55852
  try {
55816
55853
  return { svg: renderSvg(dotSource, engine) };
55817
55854
  } catch (err) {