@knowvah/dot-engine 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/async/collect.d.ts.map +1 -1
- package/dist/async/render-async.d.ts.map +1 -1
- package/dist/common/arith.d.ts +6 -0
- package/dist/common/arith.d.ts.map +1 -1
- package/dist/common/poly-sizing.d.ts.map +1 -1
- package/dist/common/textmeasure-factory.d.ts +2 -1
- package/dist/common/textmeasure-factory.d.ts.map +1 -1
- package/dist/common/textmeasure.d.ts +1 -1
- package/dist/common/textmeasure.d.ts.map +1 -1
- package/dist/gvc/device-labels.d.ts +30 -0
- package/dist/gvc/device-labels.d.ts.map +1 -0
- package/dist/gvc/device-transform.d.ts +22 -0
- package/dist/gvc/device-transform.d.ts.map +1 -0
- package/dist/gvc/device.d.ts +2 -42
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/index.js +98 -79
- package/dist/index.js.map +4 -4
- package/dist/layout/dot/graph-label.d.ts +10 -0
- package/dist/layout/dot/graph-label.d.ts.map +1 -1
- package/dist/layout/dot/splines-label.d.ts.map +1 -1
- package/dist/layout/fdp/normalize.d.ts.map +1 -1
- package/dist/layout/fdp/xlayout.d.ts +1 -1
- package/dist/layout/neato/dijkstra.d.ts +0 -32
- package/dist/layout/neato/dijkstra.d.ts.map +1 -1
- package/dist/layout/neato/fdp-adjust.d.ts +12 -1
- package/dist/layout/neato/fdp-adjust.d.ts.map +1 -1
- package/dist/layout/neato/index.d.ts +5 -5
- package/dist/layout/neato/index.d.ts.map +1 -1
- package/dist/layout/sfdp/index.d.ts.map +1 -1
- package/dist/render/public.d.ts +5 -0
- package/dist/render/public.d.ts.map +1 -1
- package/dist/render.js +95 -76
- package/dist/render.js.map +4 -4
- package/package.json +1 -1
- package/src/async/collect.ts +2 -14
- package/src/async/render-async.ts +7 -12
- package/src/common/arith.ts +9 -0
- package/src/common/poly-sizing.ts +2 -1
- package/src/common/textmeasure-factory.ts +20 -1
- package/src/common/textmeasure.ts +1 -1
- package/src/gvc/device-labels.ts +98 -0
- package/src/gvc/device-transform.ts +58 -0
- package/src/gvc/device.ts +8 -132
- package/src/layout/dot/graph-label.ts +6 -1
- package/src/layout/dot/splines-label.ts +2 -1
- package/src/layout/fdp/normalize.ts +2 -1
- package/src/layout/fdp/xlayout.ts +3 -2
- package/src/layout/neato/dijkstra.ts +0 -141
- package/src/layout/neato/fdp-adjust.ts +25 -3
- package/src/layout/neato/index.ts +13 -12
- package/src/layout/sfdp/index.ts +2 -1
- package/src/render/public.ts +6 -5
- package/dist/layout/neato/overlap.d.ts +0 -85
- package/dist/layout/neato/overlap.d.ts.map +0 -1
- 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;
|
|
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,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"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ChC,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;AAuDD;;;;;;;;;;;;;;;;;;;;;;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"}
|
package/dist/common/arith.d.ts
CHANGED
|
@@ -32,4 +32,10 @@
|
|
|
32
32
|
* @see C99 7.12.9.6 (round)
|
|
33
33
|
*/
|
|
34
34
|
export declare function cround(v: number): number;
|
|
35
|
+
/**
|
|
36
|
+
* Degrees to radians in C's operation order, `(deg)/180.0 * M_PI`.
|
|
37
|
+
* `deg * Math.PI / 180` rounds differently for some angles (e.g. 33°).
|
|
38
|
+
* @see lib/common/arith.h:49 (RADIANS)
|
|
39
|
+
*/
|
|
40
|
+
export declare function RADIANS(deg: number): number;
|
|
35
41
|
//# sourceMappingURL=arith.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arith.d.ts","sourceRoot":"","sources":["../../src/common/arith.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAExC"}
|
|
1
|
+
{"version":3,"file":"arith.d.ts","sourceRoot":"","sources":["../../src/common/arith.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poly-sizing.d.ts","sourceRoot":"","sources":["../../src/common/poly-sizing.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"poly-sizing.d.ts","sourceRoot":"","sources":["../../src/common/poly-sizing.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAM9C,4FAA4F;AAC5F,eAAO,MAAM,GAAG,IAAI,CAAC;AAUrB;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,UAAU,EAAE,KAAK,CAAC;IAClB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,8DAA8D;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;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CAGvF;AAiCD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,cAAc,GAAG,cAAc,CA+B1D"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* 1. explicit override via setTextMeasurer (tests, host-faithful Node opt-in)
|
|
6
6
|
* 2. GV_TEXT_MEASURER=estimate|lut — test/CI hook to force a specific measurer
|
|
7
7
|
* 3. browser (document present) — CanvasTextMeasurer over the page canvas
|
|
8
|
-
* (host-faithful: the same font the browser renders the SVG with)
|
|
8
|
+
* (host-faithful: the same font the browser renders the SVG with);
|
|
9
|
+
* Worker (no document) — the same over an OffscreenCanvas
|
|
9
10
|
* 4. Node default — EstimateTextMeasurer (deterministic; matches
|
|
10
11
|
* graphviz's own headless estimate_textspan_size)
|
|
11
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textmeasure-factory.d.ts","sourceRoot":"","sources":["../../src/common/textmeasure-factory.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"textmeasure-factory.d.ts","sourceRoot":"","sources":["../../src/common/textmeasure-factory.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACsD,KAAK,YAAY,EAC7E,MAAM,kBAAkB,CAAC;AAM1B;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CASjE;AAED,uEAAuE;AACvE,wBAAgB,eAAe,IAAI,YAAY,GAAG,SAAS,CAE1D;AA0CD,8EAA8E;AAC9E,wBAAgB,cAAc,IAAI,YAAY,CAmB7C"}
|
|
@@ -107,7 +107,7 @@ export declare class CanvasTextMeasurer implements TextMeasurer {
|
|
|
107
107
|
* font reuse (plugin/pango/gvtextlayout_pango.c:99-100).
|
|
108
108
|
*/
|
|
109
109
|
private readonly fonts;
|
|
110
|
-
constructor(ctx: CanvasRenderingContext2D);
|
|
110
|
+
constructor(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D);
|
|
111
111
|
measure(text: string, fontname: string, fontsize: number, flags?: TextVariantFlags): TextSize;
|
|
112
112
|
/** Cached font string; built and validated once per distinct font. */
|
|
113
113
|
private fontFor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textmeasure.d.ts","sourceRoot":"","sources":["../../src/common/textmeasure.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAMH,qDAAqD;AACrD,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,iDAAiD;AACjD,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,gBAAgB,GACvB,QAAQ,CAAC;CACb;AA8CD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,OAAO,GACd,MAAM,CASR;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,QAAY,CAAC;AAW/C;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,UAAQ,EACZ,MAAM,UAAQ,GACb,MAAM,C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B,GAAG,iCAAiC;IAE9F,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,gBAAgB,GACvB,QAAQ;IAMX,sEAAsE;IACtE,OAAO,CAAC,OAAO;IAaf,kEAAkE;IAClE,OAAO,CAAC,OAAO;CAQhB;AAED,+EAA+E;AAC/E,eAAO,MAAM,WAAW,MAAO,CAAC;AAEhC;;;;;;;GAOG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,gBAAgB,GACvB,QAAQ;CAWZ"}
|
|
@@ -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"}
|
package/dist/gvc/device.d.ts
CHANGED
|
@@ -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
|
-
|
|
20
|
-
export
|
|
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,
|
package/dist/gvc/device.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/gvc/device.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/gvc/device.ts"],"names":[],"mappings":"AAkBA,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,CAAC;AAKnD,OAAO,EAAE,SAAS,EAA0D,MAAM,UAAU,CAAC;AAuB7F,OAAO,EAAE,cAAc,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
|
@@ -16901,6 +16901,14 @@ function fms(a, b, c) {
|
|
|
16901
16901
|
return fma(-a, b, c);
|
|
16902
16902
|
}
|
|
16903
16903
|
|
|
16904
|
+
// src/common/arith.ts
|
|
16905
|
+
function cround(v) {
|
|
16906
|
+
return v >= 0 ? Math.floor(v + 0.5) : Math.ceil(v - 0.5);
|
|
16907
|
+
}
|
|
16908
|
+
function RADIANS(deg) {
|
|
16909
|
+
return deg / 180 * Math.PI;
|
|
16910
|
+
}
|
|
16911
|
+
|
|
16904
16912
|
// src/common/poly-sizing.ts
|
|
16905
16913
|
var GAP = 4;
|
|
16906
16914
|
var XPAD = 4 * GAP;
|
|
@@ -16989,7 +16997,7 @@ function ellipsePeripheryBB(bb, peripheries, penwidth, hasOutline) {
|
|
|
16989
16997
|
}
|
|
16990
16998
|
function transformUnitVertex(R2, g, c, bb) {
|
|
16991
16999
|
const D = { x: R2.x * (c.skewdist + R2.y * c.gdistortion) + R2.y * c.gskew, y: R2.y };
|
|
16992
|
-
const alpha = g.orientation
|
|
17000
|
+
const alpha = RADIANS(g.orientation) + Math.atan2(D.y, D.x);
|
|
16993
17001
|
const r = Math.sqrt(D.x * D.x + D.y * D.y);
|
|
16994
17002
|
return { x: r * Math.cos(alpha) * bb.x, y: r * Math.sin(alpha) * bb.y };
|
|
16995
17003
|
}
|
|
@@ -19059,11 +19067,6 @@ function makeSelfEdge(edges, cnt, sizex, sizey, sinfo) {
|
|
|
19059
19067
|
}
|
|
19060
19068
|
}
|
|
19061
19069
|
|
|
19062
|
-
// src/common/arith.ts
|
|
19063
|
-
function cround(v) {
|
|
19064
|
-
return v >= 0 ? Math.floor(v + 0.5) : Math.ceil(v - 0.5);
|
|
19065
|
-
}
|
|
19066
|
-
|
|
19067
19070
|
// src/layout/dot/position-aux.ts
|
|
19068
19071
|
var CL_OFFSET = 8;
|
|
19069
19072
|
function clusterMarginOf(g) {
|
|
@@ -26571,10 +26574,7 @@ function walkNodesAndEdges(g, renderer, job, info) {
|
|
|
26571
26574
|
}
|
|
26572
26575
|
}
|
|
26573
26576
|
|
|
26574
|
-
// src/gvc/device.ts
|
|
26575
|
-
function renderClusterLabel(sg, renderer, job) {
|
|
26576
|
-
renderOneLabel(sg.info.label, renderer, job, false);
|
|
26577
|
-
}
|
|
26577
|
+
// src/gvc/device-transform.ts
|
|
26578
26578
|
function transformPoint(p, job) {
|
|
26579
26579
|
if ((job.flags & GVRENDER_DOES_TRANSFORM) !== 0) {
|
|
26580
26580
|
return p;
|
|
@@ -26594,6 +26594,50 @@ function buildPoint(x, y) {
|
|
|
26594
26594
|
const pt = { x, y };
|
|
26595
26595
|
return pt;
|
|
26596
26596
|
}
|
|
26597
|
+
|
|
26598
|
+
// src/gvc/device-labels.ts
|
|
26599
|
+
var VALIGN_TOP = "t".charCodeAt(0);
|
|
26600
|
+
var VALIGN_BOTTOM = "b".charCodeAt(0);
|
|
26601
|
+
function labelFirstSpanY(lp) {
|
|
26602
|
+
if (lp.valign === VALIGN_TOP) return lp.pos.y + lp.space.y / 2 - lp.fontsize;
|
|
26603
|
+
if (lp.valign === VALIGN_BOTTOM) {
|
|
26604
|
+
return lp.pos.y - lp.space.y / 2 + lp.dimen.y - lp.fontsize;
|
|
26605
|
+
}
|
|
26606
|
+
return lp.pos.y + lp.dimen.y / 2 - lp.fontsize;
|
|
26607
|
+
}
|
|
26608
|
+
function labelSpanX(lp, just) {
|
|
26609
|
+
if (just === "l") return lp.pos.x - lp.space.x / 2;
|
|
26610
|
+
if (just === "r") return lp.pos.x + lp.space.x / 2;
|
|
26611
|
+
return lp.pos.x;
|
|
26612
|
+
}
|
|
26613
|
+
function renderOneLabel(lp, renderer, job, requireSet = true) {
|
|
26614
|
+
if (!lp) return;
|
|
26615
|
+
if (requireSet && !lp.set) return;
|
|
26616
|
+
if (lp.html) {
|
|
26617
|
+
if (lp.u.kind === "html") {
|
|
26618
|
+
const html = lp.u.html;
|
|
26619
|
+
const pos = lp.pos;
|
|
26620
|
+
withLabelEmitState(job, () => emitHtmlLabel(html, pos, renderer, job));
|
|
26621
|
+
}
|
|
26622
|
+
return;
|
|
26623
|
+
}
|
|
26624
|
+
if (lp.u.kind !== "txt" || lp.u.nspans < 1) return;
|
|
26625
|
+
let y = labelFirstSpanY(lp);
|
|
26626
|
+
for (let i = 0; i < lp.u.nspans; i++) {
|
|
26627
|
+
const span = lp.u.span[i];
|
|
26628
|
+
if (!span) break;
|
|
26629
|
+
gvrenderTextspan(renderer, { x: labelSpanX(lp, span.just), y }, span, job);
|
|
26630
|
+
y -= span.size.y;
|
|
26631
|
+
}
|
|
26632
|
+
}
|
|
26633
|
+
function renderNodeXLabel(n, renderer, job) {
|
|
26634
|
+
renderOneLabel(n.info.xlabel, renderer, job);
|
|
26635
|
+
}
|
|
26636
|
+
function renderClusterLabel(sg, renderer, job) {
|
|
26637
|
+
renderOneLabel(sg.info.label, renderer, job, false);
|
|
26638
|
+
}
|
|
26639
|
+
|
|
26640
|
+
// src/gvc/device.ts
|
|
26597
26641
|
function labelTextOf2(lp) {
|
|
26598
26642
|
return lp?.text ?? null;
|
|
26599
26643
|
}
|
|
@@ -26668,43 +26712,6 @@ function renderEdge(e, renderer, job) {
|
|
|
26668
26712
|
job.popObj();
|
|
26669
26713
|
}
|
|
26670
26714
|
}
|
|
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
26715
|
function renderGraphLabel(g, renderer, job) {
|
|
26709
26716
|
setHtmlAnchorObj(svgGraphId(g, job), labelTextOf2(g.info.label), job.obj ?? void 0);
|
|
26710
26717
|
renderOneLabel(g.info.label, renderer, job, false);
|
|
@@ -26841,6 +26848,15 @@ function adviseHostFaithful() {
|
|
|
26841
26848
|
"@knowvah/dot-engine: measuring text with built-in metrics (kerning/shaping not applied). For host-faithful sizing matching the rendering font, install `canvas` and call setTextMeasurer(new CanvasTextMeasurer(createCanvas(0,0).getContext('2d'))). Silence with GV_FONT_QUIET=1.\n"
|
|
26842
26849
|
);
|
|
26843
26850
|
}
|
|
26851
|
+
function offscreenMeasurer() {
|
|
26852
|
+
if (typeof OffscreenCanvas === "undefined") return void 0;
|
|
26853
|
+
try {
|
|
26854
|
+
const ctx2d = new OffscreenCanvas(0, 0).getContext("2d");
|
|
26855
|
+
return ctx2d ? new CanvasTextMeasurer(ctx2d) : void 0;
|
|
26856
|
+
} catch {
|
|
26857
|
+
return void 0;
|
|
26858
|
+
}
|
|
26859
|
+
}
|
|
26844
26860
|
function createMeasurer() {
|
|
26845
26861
|
if (override) return override;
|
|
26846
26862
|
const forced = envMeasurer();
|
|
@@ -26852,6 +26868,9 @@ function createMeasurer() {
|
|
|
26852
26868
|
if (ctx2d) return new CanvasTextMeasurer(ctx2d);
|
|
26853
26869
|
} catch {
|
|
26854
26870
|
}
|
|
26871
|
+
} else {
|
|
26872
|
+
const offscreen = offscreenMeasurer();
|
|
26873
|
+
if (offscreen) return offscreen;
|
|
26855
26874
|
}
|
|
26856
26875
|
adviseHostFaithful();
|
|
26857
26876
|
return new EstimateTextMeasurer();
|
|
@@ -32863,7 +32882,7 @@ function applyPortlabelPos(e, headP) {
|
|
|
32863
32882
|
}
|
|
32864
32883
|
function writePortlabelPos(l, pe, pf, angleStr, distanceStr) {
|
|
32865
32884
|
const angleDeg = lateDouble(angleStr, PORT_LABEL_ANGLE, -180);
|
|
32866
|
-
const angle = Math.atan2(pf.y - pe.y, pf.x - pe.x) +
|
|
32885
|
+
const angle = Math.atan2(pf.y - pe.y, pf.x - pe.x) + RADIANS(angleDeg);
|
|
32867
32886
|
const distMult = lateDouble(distanceStr || void 0, 1, 0);
|
|
32868
32887
|
const dist4 = PORT_LABEL_DISTANCE * distMult;
|
|
32869
32888
|
l.pos.x = pe.x + dist4 * Math.cos(angle);
|
|
@@ -45750,7 +45769,7 @@ function angleSet(g) {
|
|
|
45750
45769
|
if (a === void 0 || a === "") return null;
|
|
45751
45770
|
const ang = parseAngle2(a);
|
|
45752
45771
|
if (ang === null) return null;
|
|
45753
|
-
return wrapDegrees(ang)
|
|
45772
|
+
return RADIANS(wrapDegrees(ang));
|
|
45754
45773
|
}
|
|
45755
45774
|
function parseAngle2(a) {
|
|
45756
45775
|
const m = /^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/.exec(a);
|
|
@@ -47665,7 +47684,15 @@ var ADJUST_MODES = /* @__PURE__ */ new Map([
|
|
|
47665
47684
|
["porthoxy", [AM_PORTHOXY, "xy pseudo-orthogonal constraints"]],
|
|
47666
47685
|
["porthoyx", [AM_PORTHOYX, "yx pseudo-orthogonal constraints"]]
|
|
47667
47686
|
]);
|
|
47687
|
+
function warnUnrecognizedOverlap(flag) {
|
|
47688
|
+
if (flag === void 0 || flag === "") return;
|
|
47689
|
+
const s = flag.toLowerCase();
|
|
47690
|
+
if (s.startsWith("prism") || NAMED_MODES.has(s)) return;
|
|
47691
|
+
if (mapBoolDflt(flag, false) === mapBoolDflt(flag, true)) return;
|
|
47692
|
+
console.warn(`Unrecognized overlap value "${flag}" - using false`);
|
|
47693
|
+
}
|
|
47668
47694
|
function getAdjustMode(flag) {
|
|
47695
|
+
warnUnrecognizedOverlap(flag);
|
|
47669
47696
|
const ntry = overlapPrismTries(flag);
|
|
47670
47697
|
if (ntry !== null) return { mode: AM_PRISM, print: "prism", value: ntry };
|
|
47671
47698
|
const named = ADJUST_MODES.get((flag ?? "").toLowerCase());
|
|
@@ -47714,8 +47741,11 @@ function removeOverlapWith(g, am) {
|
|
|
47714
47741
|
return nret + (am.mode === AM_SCALE ? sAdjustGraph(g) : adjustVoronoi(g, am));
|
|
47715
47742
|
}
|
|
47716
47743
|
function adjustNodesFull(g) {
|
|
47717
|
-
|
|
47718
|
-
return removeOverlapWith(g,
|
|
47744
|
+
if (g.nodes.size < 2) return 0;
|
|
47745
|
+
return removeOverlapWith(g, graphAdjustMode(g));
|
|
47746
|
+
}
|
|
47747
|
+
function graphAdjustMode(g) {
|
|
47748
|
+
return getAdjustMode(g.attrs.get("overlap") ?? g.root.attrs.get("overlap"));
|
|
47719
47749
|
}
|
|
47720
47750
|
|
|
47721
47751
|
// src/layout/twopi/init.ts
|
|
@@ -48082,8 +48112,8 @@ function parseModel(g) {
|
|
|
48082
48112
|
if (!s) return MODEL_SHORTPATH2;
|
|
48083
48113
|
return MODEL_MAP[s] ?? MODEL_SHORTPATH2;
|
|
48084
48114
|
}
|
|
48085
|
-
function maybeRemoveOverlap(g) {
|
|
48086
|
-
|
|
48115
|
+
function maybeRemoveOverlap(g, am) {
|
|
48116
|
+
removeOverlapWith(g, am);
|
|
48087
48117
|
}
|
|
48088
48118
|
function neatoLayout(g) {
|
|
48089
48119
|
graphInit(g, false);
|
|
@@ -48098,13 +48128,14 @@ function neatoLayout(g) {
|
|
|
48098
48128
|
for (const e of g.edges) initEdgeLabels(e, g, measurer);
|
|
48099
48129
|
}
|
|
48100
48130
|
const mode = parseMode(g);
|
|
48131
|
+
const am = graphAdjustMode(g);
|
|
48101
48132
|
const model = parseModel(g);
|
|
48102
48133
|
const { graphs: comps, pinned } = neatoPack(g, mode) >= 0 ? pccomps(g, "_neato_cc") : { graphs: [g], pinned: false };
|
|
48103
48134
|
if (comps.length > 1) {
|
|
48104
|
-
layoutComponents(g, comps, mode, model, pinned);
|
|
48135
|
+
layoutComponents(g, comps, { mode, model, am }, pinned);
|
|
48105
48136
|
} else {
|
|
48106
48137
|
solveModel2(g, mode, model);
|
|
48107
|
-
maybeRemoveOverlap(g);
|
|
48138
|
+
maybeRemoveOverlap(g, am);
|
|
48108
48139
|
splineEdgesShifted(g);
|
|
48109
48140
|
}
|
|
48110
48141
|
addClusters(g);
|
|
@@ -48140,11 +48171,11 @@ function addClusters(g) {
|
|
|
48140
48171
|
g.info.clust = clusters;
|
|
48141
48172
|
g.info.n_cluster = clusters.length;
|
|
48142
48173
|
}
|
|
48143
|
-
function layoutComponents(g, comps,
|
|
48174
|
+
function layoutComponents(g, comps, solve2, pinned) {
|
|
48144
48175
|
for (const gc of comps) {
|
|
48145
48176
|
setEdgeTypeFromAttr(gc, EDGETYPE_LINE);
|
|
48146
|
-
solveModel2(gc, mode, model);
|
|
48147
|
-
maybeRemoveOverlap(gc);
|
|
48177
|
+
solveModel2(gc, solve2.mode, solve2.model);
|
|
48178
|
+
maybeRemoveOverlap(gc, solve2.am);
|
|
48148
48179
|
splineEdgesShifted(gc);
|
|
48149
48180
|
}
|
|
48150
48181
|
const pinfo = {
|
|
@@ -49022,6 +49053,7 @@ function fdpXLayout(g, xpms) {
|
|
|
49022
49053
|
}
|
|
49023
49054
|
function removeOverlapAs(g, flag) {
|
|
49024
49055
|
if (g.nodes.size < 2) return;
|
|
49056
|
+
warnUnrecognizedOverlap(flag);
|
|
49025
49057
|
normalizeG(g);
|
|
49026
49058
|
simpleScale(g);
|
|
49027
49059
|
const ntry = overlapPrismTries(flag);
|
|
@@ -50172,6 +50204,7 @@ function resolveControl(g) {
|
|
|
50172
50204
|
const pad = { x: DFLT_MARGIN / 72, y: DFLT_MARGIN / 72 };
|
|
50173
50205
|
const overlap5 = aggetGraph(g, "overlap");
|
|
50174
50206
|
const flag = overlap5 === void 0 ? "prism0" : overlap5;
|
|
50207
|
+
warnUnrecognizedOverlap(flag);
|
|
50175
50208
|
const ntry = overlapPrismTries(flag);
|
|
50176
50209
|
if (ntry !== null) {
|
|
50177
50210
|
ctrl.overlap = ntry;
|
|
@@ -55483,16 +55516,9 @@ function collectEdge(acc, e) {
|
|
|
55483
55516
|
addLabel(acc, e.attrs.get("headlabel"), lfi);
|
|
55484
55517
|
addLabel(acc, e.attrs.get("taillabel"), lfi);
|
|
55485
55518
|
}
|
|
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
55519
|
function collectGraphLabels(acc, sg, root) {
|
|
55494
55520
|
if (isACluster(sg)) {
|
|
55495
|
-
addLabel(acc, sg.attrs.get("label") ?? sg.graphDefaultsSnapshot?.get("label"),
|
|
55521
|
+
addLabel(acc, sg.attrs.get("label") ?? sg.graphDefaultsSnapshot?.get("label"), readFontParams(sg));
|
|
55496
55522
|
}
|
|
55497
55523
|
for (const child of sg.subgraphs.values()) collectGraphLabels(acc, child, root);
|
|
55498
55524
|
}
|
|
@@ -55552,17 +55578,10 @@ async function loadFonts(fontSet, fonts, timeoutMs) {
|
|
|
55552
55578
|
|
|
55553
55579
|
// src/async/render-async.ts
|
|
55554
55580
|
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
55581
|
function defaultFontSet() {
|
|
55563
55582
|
const doc = Reflect.get(globalThis, "document");
|
|
55564
|
-
|
|
55565
|
-
const fonts = Reflect.get(
|
|
55583
|
+
const owner = typeof doc === "object" && doc !== null ? doc : globalThis;
|
|
55584
|
+
const fonts = Reflect.get(owner, "fonts");
|
|
55566
55585
|
if (typeof fonts !== "object" || fonts === null) return void 0;
|
|
55567
55586
|
return fonts;
|
|
55568
55587
|
}
|
|
@@ -55594,7 +55613,7 @@ async function prefetchAll(g, opts) {
|
|
|
55594
55613
|
return { fontIssues, sizes, bytes };
|
|
55595
55614
|
}
|
|
55596
55615
|
async function renderAsync(g, format, opts) {
|
|
55597
|
-
|
|
55616
|
+
checkRenderArgs(g, format, opts);
|
|
55598
55617
|
const engine = opts?.engine ?? "dot";
|
|
55599
55618
|
try {
|
|
55600
55619
|
const { fontIssues, sizes, bytes } = await prefetchAll(g, opts);
|
|
@@ -55810,7 +55829,7 @@ async function renderSvgInto(id, src, engine, opts) {
|
|
|
55810
55829
|
}
|
|
55811
55830
|
|
|
55812
55831
|
// src/index.ts
|
|
55813
|
-
function
|
|
55832
|
+
function checkRenderArgs2(dotSource, engine) {
|
|
55814
55833
|
if (typeof dotSource !== "string") {
|
|
55815
55834
|
throw invalidArgType("dotSource", "string", dotSource);
|
|
55816
55835
|
}
|
|
@@ -55831,7 +55850,7 @@ function classifyError(err) {
|
|
|
55831
55850
|
return out;
|
|
55832
55851
|
}
|
|
55833
55852
|
function renderSvg(dotSource, engine) {
|
|
55834
|
-
|
|
55853
|
+
checkRenderArgs2(dotSource, engine);
|
|
55835
55854
|
const ctx = createDefaultContext();
|
|
55836
55855
|
try {
|
|
55837
55856
|
const g = parse(dotSource);
|
|
@@ -55844,7 +55863,7 @@ function renderSvg(dotSource, engine) {
|
|
|
55844
55863
|
}
|
|
55845
55864
|
}
|
|
55846
55865
|
function tryRenderSvg(dotSource, engine) {
|
|
55847
|
-
|
|
55866
|
+
checkRenderArgs2(dotSource, engine);
|
|
55848
55867
|
try {
|
|
55849
55868
|
return { svg: renderSvg(dotSource, engine) };
|
|
55850
55869
|
} catch (err) {
|