@knowvah/dot-engine 2.12.4 → 2.13.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/api.js +1 -0
- package/dist/api.js.map +2 -2
- package/dist/errors.d.ts +11 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/gvc/context.d.ts +7 -0
- package/dist/gvc/context.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -29
- package/dist/index.js.map +3 -3
- package/dist/layout/dot/classify.d.ts.map +1 -1
- package/dist/layout/dot/ns-range.d.ts.map +1 -1
- package/dist/render.js +156 -112
- package/dist/render.js.map +4 -4
- package/package.json +1 -1
- package/src/errors.ts +13 -3
- package/src/gvc/context.ts +21 -6
- package/src/index.ts +1 -0
- package/src/layout/dot/classify.ts +23 -1
- package/src/layout/dot/ns-range.ts +41 -5
package/dist/errors.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface GvError {
|
|
|
32
32
|
};
|
|
33
33
|
/** Peggy's discriminated union, passed through unmapped; SYNTAX_* only. */
|
|
34
34
|
expected?: GvExpectation[];
|
|
35
|
+
/** Named values the message refers to (e.g. `{ node }`); string-valued. */
|
|
36
|
+
context?: Record<string, string>;
|
|
35
37
|
}
|
|
36
38
|
/** Result of a result-style render: `svg` XOR `errors` for v1. */
|
|
37
39
|
export interface RenderResult {
|
|
@@ -50,6 +52,10 @@ export declare const FRIENDLY_MESSAGES: Record<GvErrorCode, string>;
|
|
|
50
52
|
* future i18n library replaces.
|
|
51
53
|
*/
|
|
52
54
|
export declare function friendlyMessageFor(code: GvErrorCode): string;
|
|
55
|
+
/** `ErrorOptions` plus the optional structured {@link GvError.context}. */
|
|
56
|
+
export interface DotEngineErrorOptions extends ErrorOptions {
|
|
57
|
+
context?: Record<string, string>;
|
|
58
|
+
}
|
|
53
59
|
/**
|
|
54
60
|
* Abstract base of every library-originated error: `instanceof
|
|
55
61
|
* DotEngineError` means dot-engine failed on this input (bad input, a fatal
|
|
@@ -60,14 +66,16 @@ export declare abstract class DotEngineError extends Error implements GvError {
|
|
|
60
66
|
abstract readonly type: GvErrorType;
|
|
61
67
|
abstract readonly code: GvErrorCode;
|
|
62
68
|
abstract readonly friendlyMessage: string;
|
|
63
|
-
|
|
69
|
+
/** `declare`: no own property unless the caller supplied a context. */
|
|
70
|
+
context?: Record<string, string>;
|
|
71
|
+
constructor(message: string, options?: DotEngineErrorOptions);
|
|
64
72
|
}
|
|
65
73
|
/** A dot-engine bug: failed assertion, broken invariant or foreign throw. */
|
|
66
74
|
export declare class InternalError extends DotEngineError {
|
|
67
75
|
readonly type = "render";
|
|
68
76
|
readonly code = "INTERNAL_ERROR";
|
|
69
77
|
readonly friendlyMessage: string;
|
|
70
|
-
constructor(message: string, options?:
|
|
78
|
+
constructor(message: string, options?: DotEngineErrorOptions);
|
|
71
79
|
}
|
|
72
80
|
/**
|
|
73
81
|
* Error thrown for known layout/render-stage failures. `type` is `semantic`
|
|
@@ -77,7 +85,7 @@ export declare class RenderError extends DotEngineError {
|
|
|
77
85
|
readonly type: GvErrorType;
|
|
78
86
|
readonly code: GvErrorCode;
|
|
79
87
|
readonly friendlyMessage: string;
|
|
80
|
-
constructor(message: string, code?: GvErrorCode, options?:
|
|
88
|
+
constructor(message: string, code?: GvErrorCode, options?: DotEngineErrorOptions);
|
|
81
89
|
}
|
|
82
90
|
/** Guard shared by every boundary: structural check, works across bundles. */
|
|
83
91
|
export declare function isGvError(e: unknown): e is GvError;
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,+EAA+E;AAC/E,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC;AAExC,0DAA0D;AAC1D,MAAM,MAAM,WAAW,G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;AAC5E,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,SAAS,CAKX;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,UAAU,CAKZ;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEnD;AAED,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAMhD;AAID,mCAAmC;AACnC,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAGrD"}
|
package/dist/gvc/context.d.ts
CHANGED
|
@@ -215,6 +215,13 @@ export declare class GvcContext {
|
|
|
215
215
|
* @see lib/gvc/gvlayout.c:gvLayoutJobs
|
|
216
216
|
*/
|
|
217
217
|
layout(g: Graph, engineName: EngineName): void;
|
|
218
|
+
/**
|
|
219
|
+
* C's `agerrorf("Layout type: \"%s\" not recognized. Use one of:%s\n", ...)`
|
|
220
|
+
* (`gvplugin_list` writes each type as a leading space + name), then the
|
|
221
|
+
* structured error. The thrown wording may differ from the agerr text.
|
|
222
|
+
* @see lib/gvc/gvlayout.c:gvLayoutJobs
|
|
223
|
+
*/
|
|
224
|
+
private unknownLayout;
|
|
218
225
|
/**
|
|
219
226
|
* Release engine layout state after rendering. The records themselves stay,
|
|
220
227
|
* for getLayout, until the next layout replaces them (part-9 AD-11, see
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/gvc/context.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE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EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B;;;OAGG;gBACS,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,YAAY,CAAA;KAAE;IAStE;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,cAAc,GAAG,IAAI;IACjC,QAAQ,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI;IAW/B;;;;;;;;;OASG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc;IAW5C,4EAA4E;IAC5E,OAAO,CAAC,eAAe;IAcvB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IA+B9C;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAarB;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;CAQnD"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAW,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqCnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAgBvE;AAED;;;;;;;;;;;;;G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EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4703,6 +4703,7 @@ var SEMANTIC_RENDER_CODES = /* @__PURE__ */ new Set([
|
|
|
4703
4703
|
var DotEngineError = class extends Error {
|
|
4704
4704
|
constructor(message, options) {
|
|
4705
4705
|
super(message, options);
|
|
4706
|
+
if (options?.context !== void 0) this.context = options.context;
|
|
4706
4707
|
}
|
|
4707
4708
|
};
|
|
4708
4709
|
var InternalError = class extends DotEngineError {
|
|
@@ -6596,12 +6597,7 @@ var GvcContext = class {
|
|
|
6596
6597
|
let engine = selected;
|
|
6597
6598
|
if (attr2 !== void 0 && attr2 !== "") {
|
|
6598
6599
|
const override2 = this.layouts.get(attr2);
|
|
6599
|
-
if (override2 === void 0)
|
|
6600
|
-
throw new RenderError(
|
|
6601
|
-
`Layout type: "${attr2}" not recognized`,
|
|
6602
|
-
"UNKNOWN_LAYOUT"
|
|
6603
|
-
);
|
|
6604
|
-
}
|
|
6600
|
+
if (override2 === void 0) throw this.unknownLayout(attr2);
|
|
6605
6601
|
engine = override2;
|
|
6606
6602
|
}
|
|
6607
6603
|
undoRenderedClusterEdges(g);
|
|
@@ -6617,6 +6613,21 @@ var GvcContext = class {
|
|
|
6617
6613
|
if (g.info) g.info.cleanup = (x) => engine.cleanup(x);
|
|
6618
6614
|
if (g.info) g.info.laidOut = true;
|
|
6619
6615
|
}
|
|
6616
|
+
/**
|
|
6617
|
+
* C's `agerrorf("Layout type: \"%s\" not recognized. Use one of:%s\n", ...)`
|
|
6618
|
+
* (`gvplugin_list` writes each type as a leading space + name), then the
|
|
6619
|
+
* structured error. The thrown wording may differ from the agerr text.
|
|
6620
|
+
* @see lib/gvc/gvlayout.c:gvLayoutJobs
|
|
6621
|
+
*/
|
|
6622
|
+
unknownLayout(attr2) {
|
|
6623
|
+
const list = [...this.layouts.keys()].sort().map((name) => ` ${name}`).join("");
|
|
6624
|
+
agerrorf(`Layout type: "${attr2}" not recognized. Use one of:${list}`);
|
|
6625
|
+
return new RenderError(
|
|
6626
|
+
`Layout type: "${attr2}" not recognized. Use one of:${list}.`,
|
|
6627
|
+
"UNKNOWN_LAYOUT",
|
|
6628
|
+
{ context: { layout: attr2 } }
|
|
6629
|
+
);
|
|
6630
|
+
}
|
|
6620
6631
|
/**
|
|
6621
6632
|
* Release engine layout state after rendering. The records themselves stay,
|
|
6622
6633
|
* for getLayout, until the next layout replaces them (part-9 AD-11, see
|
|
@@ -21785,14 +21796,34 @@ function xVal(e, v, dir) {
|
|
|
21785
21796
|
if (f) d = -d;
|
|
21786
21797
|
return d < 0 ? -rv : rv;
|
|
21787
21798
|
}
|
|
21799
|
+
var INT_MAX2 = 2147483647;
|
|
21800
|
+
var INT_MIN = -2147483648;
|
|
21801
|
+
function sumOverflows(sum, add2) {
|
|
21802
|
+
const s = sum + add2;
|
|
21803
|
+
return s > INT_MAX2 || s < INT_MIN;
|
|
21804
|
+
}
|
|
21805
|
+
function cutvalOverflow(v) {
|
|
21806
|
+
agerrorf("overflow when computing edge weight sum");
|
|
21807
|
+
return new RenderError(
|
|
21808
|
+
`Edge weights at node "${v.name}" sum past the 32-bit integer limit; lower the weight attribute values.`,
|
|
21809
|
+
"RENDER_ERROR",
|
|
21810
|
+
{ context: { node: v.name } }
|
|
21811
|
+
);
|
|
21812
|
+
}
|
|
21813
|
+
function sumXVals(list, v, dir, sum) {
|
|
21814
|
+
if (!list) return sum;
|
|
21815
|
+
for (let i = 0; i < list.size; i++) {
|
|
21816
|
+
const add2 = xVal(list.list[i], v, dir);
|
|
21817
|
+
if (sumOverflows(sum, add2)) throw cutvalOverflow(v);
|
|
21818
|
+
sum += add2;
|
|
21819
|
+
}
|
|
21820
|
+
return sum;
|
|
21821
|
+
}
|
|
21788
21822
|
function xCutval(f) {
|
|
21789
21823
|
const v = f.tail.info.par === f ? f.tail : f.head;
|
|
21790
21824
|
const dir = f.tail.info.par === f ? 1 : -1;
|
|
21791
|
-
let sum = 0;
|
|
21792
|
-
|
|
21793
|
-
if (out) for (let i = 0; i < out.size; i++) sum += xVal(out.list[i], v, dir);
|
|
21794
|
-
const inp = v.info.in;
|
|
21795
|
-
if (inp) for (let i = 0; i < inp.size; i++) sum += xVal(inp.list[i], v, dir);
|
|
21825
|
+
let sum = sumXVals(v.info.out, v, dir, 0);
|
|
21826
|
+
sum = sumXVals(v.info.in, v, dir, sum);
|
|
21796
21827
|
f.info.cutvalue = sum;
|
|
21797
21828
|
}
|
|
21798
21829
|
function cutvalDescend(list, iArr, top, sp, head) {
|
|
@@ -21910,14 +21941,14 @@ function dfsRange(v, par, low) {
|
|
|
21910
21941
|
}
|
|
21911
21942
|
|
|
21912
21943
|
// src/util/overflow.ts
|
|
21913
|
-
var
|
|
21914
|
-
var
|
|
21944
|
+
var INT_MAX3 = 2147483647;
|
|
21945
|
+
var INT_MIN2 = -2147483648;
|
|
21915
21946
|
function saddSaturate(a, b) {
|
|
21916
|
-
if (b > 0 &&
|
|
21917
|
-
return
|
|
21947
|
+
if (b > 0 && INT_MAX3 - b < a) {
|
|
21948
|
+
return INT_MAX3;
|
|
21918
21949
|
}
|
|
21919
|
-
if (b < 0 &&
|
|
21920
|
-
return
|
|
21950
|
+
if (b < 0 && INT_MIN2 - b > a) {
|
|
21951
|
+
return INT_MIN2;
|
|
21921
21952
|
}
|
|
21922
21953
|
return a + b;
|
|
21923
21954
|
}
|
|
@@ -24335,6 +24366,7 @@ function nonconstraintEdge(e) {
|
|
|
24335
24366
|
var WNODE_ORDINARY = 0;
|
|
24336
24367
|
var WNODE_SINGLETON = 1;
|
|
24337
24368
|
var WNODE_VIRTUAL = 2;
|
|
24369
|
+
var INT_MAX4 = 2147483647;
|
|
24338
24370
|
var CLASSIFY_WEIGHT_TABLE = [[1, 1, 1], [1, 2, 2], [1, 2, 4]];
|
|
24339
24371
|
function epClass(n) {
|
|
24340
24372
|
if (n.info.node_type === VIRTUAL) return WNODE_VIRTUAL;
|
|
@@ -24343,7 +24375,19 @@ function epClass(n) {
|
|
|
24343
24375
|
}
|
|
24344
24376
|
function applyVirtualWeight(e) {
|
|
24345
24377
|
const t = CLASSIFY_WEIGHT_TABLE[epClass(e.tail)][epClass(e.head)];
|
|
24346
|
-
|
|
24378
|
+
const w = e.info.weight ?? 1;
|
|
24379
|
+
if (Math.trunc(INT_MAX4 / t) < w) throw virtualWeightOverflow(e, t);
|
|
24380
|
+
e.info.weight = w * t;
|
|
24381
|
+
}
|
|
24382
|
+
function virtualWeightOverflow(e, t) {
|
|
24383
|
+
agerrorf("overflow when calculating virtual weight of edge");
|
|
24384
|
+
const o = e.info.to_orig ?? e;
|
|
24385
|
+
const name = `${o.tail.name}->${o.head.name}`;
|
|
24386
|
+
return new RenderError(
|
|
24387
|
+
`Edge "${name}" has a weight too large for the layout (weight x ${t} exceeds the 32-bit integer limit); lower its weight attribute.`,
|
|
24388
|
+
"RENDER_ERROR",
|
|
24389
|
+
{ context: { edge: name } }
|
|
24390
|
+
);
|
|
24347
24391
|
}
|
|
24348
24392
|
function interclust1TRank(e) {
|
|
24349
24393
|
const clust = e.tail.info.clust;
|
|
@@ -32448,7 +32492,7 @@ function flatEdges(g) {
|
|
|
32448
32492
|
}
|
|
32449
32493
|
|
|
32450
32494
|
// src/layout/dot/position.ts
|
|
32451
|
-
var
|
|
32495
|
+
var INT_MAX5 = 2147483647;
|
|
32452
32496
|
function setXcoordsFromRank(g) {
|
|
32453
32497
|
const rankArr = g.info.rank;
|
|
32454
32498
|
for (let i = graphMinrank(g); i <= graphMaxrank(g); i++) {
|
|
@@ -32497,7 +32541,7 @@ function connectGraph(g) {
|
|
|
32497
32541
|
}
|
|
32498
32542
|
function nsiter2(g) {
|
|
32499
32543
|
const s = g.attrs.get("nslimit") ?? g.graphDefaultsSnapshot?.get("nslimit") ?? g.root.attrs.get("nslimit") ?? agGraphAttr(g.root, "nslimit");
|
|
32500
|
-
if (s === void 0) return
|
|
32544
|
+
if (s === void 0) return INT_MAX5;
|
|
32501
32545
|
return scaleClamp(g.nodes.size, parseFloat(s) || 0);
|
|
32502
32546
|
}
|
|
32503
32547
|
function expandRankSlots(rk, newN) {
|
|
@@ -36904,11 +36948,11 @@ function maxOutputline() {
|
|
|
36904
36948
|
function setMaxOutputline(n) {
|
|
36905
36949
|
maxOutputlineValue = n;
|
|
36906
36950
|
}
|
|
36907
|
-
var
|
|
36951
|
+
var INT_MAX6 = 2147483647;
|
|
36908
36952
|
function linelengthOf(s) {
|
|
36909
36953
|
if (s === void 0 || !/^[0-9]/.test(s)) return void 0;
|
|
36910
36954
|
const len = Number(/^[0-9]+/.exec(s)[0]);
|
|
36911
|
-
if ((len === 0 || len >= MIN_OUTPUTLINE) && len <=
|
|
36955
|
+
if ((len === 0 || len >= MIN_OUTPUTLINE) && len <= INT_MAX6) return len;
|
|
36912
36956
|
return void 0;
|
|
36913
36957
|
}
|
|
36914
36958
|
function withLinelength(g, write) {
|
|
@@ -53818,7 +53862,7 @@ function springElectricalEmbedding(dim, A0, ctrl, x) {
|
|
|
53818
53862
|
|
|
53819
53863
|
// src/layout/sfdp/init.ts
|
|
53820
53864
|
var SMOOTHING_NONE = 0;
|
|
53821
|
-
var
|
|
53865
|
+
var INT_MAX7 = 2147483647;
|
|
53822
53866
|
var ELSCHEME_PENALTY2 = 2;
|
|
53823
53867
|
var EDGE_LABEL_NODE_PREFIX = "|edgelabel|";
|
|
53824
53868
|
function sfdpInitDim(g) {
|
|
@@ -53887,7 +53931,7 @@ function tuneControl(g, ctrl) {
|
|
|
53887
53931
|
}
|
|
53888
53932
|
ctrl.K = lateDouble(aggetGraph(g, "K"), -1, 0);
|
|
53889
53933
|
ctrl.p = -1 * lateDouble(aggetGraph(g, "repulsiveforce"), -AUTOP, 0);
|
|
53890
|
-
ctrl.multilevels = lateInt(aggetGraph(g, "levels"),
|
|
53934
|
+
ctrl.multilevels = lateInt(aggetGraph(g, "levels"), INT_MAX7, 0);
|
|
53891
53935
|
const smoothing = aggetGraph(g, "smoothing");
|
|
53892
53936
|
if (smoothing !== void 0 && smoothing.toLowerCase() !== "none" && smoothing !== String(SMOOTHING_NONE)) {
|
|
53893
53937
|
throw new RenderError(
|
|
@@ -54886,7 +54930,7 @@ var AM_PORTHOXY = 11;
|
|
|
54886
54930
|
var AM_PORTHOYX = 12;
|
|
54887
54931
|
var SCALE = 10;
|
|
54888
54932
|
var SCALE2 = SCALE / 2;
|
|
54889
|
-
var
|
|
54933
|
+
var INT_MAX8 = 2147483647;
|
|
54890
54934
|
var POINTS_PER_INCH6 = 72;
|
|
54891
54935
|
function cmpitem(a, b) {
|
|
54892
54936
|
if (a < b) return -1;
|
|
@@ -55006,7 +55050,7 @@ function mkNConstraintG(g, list, intersect, dist5) {
|
|
|
55006
55050
|
return cg;
|
|
55007
55051
|
}
|
|
55008
55052
|
function buildChain(cg, flat) {
|
|
55009
|
-
let oldval = -
|
|
55053
|
+
let oldval = -INT_MAX8;
|
|
55010
55054
|
let prev;
|
|
55011
55055
|
let n;
|
|
55012
55056
|
let lastn;
|
|
@@ -55028,7 +55072,7 @@ function buildChain(cg, flat) {
|
|
|
55028
55072
|
}
|
|
55029
55073
|
function buildVisibility(flat, intersect) {
|
|
55030
55074
|
const vg = flat.map(() => []);
|
|
55031
|
-
let oldval = -
|
|
55075
|
+
let oldval = -INT_MAX8;
|
|
55032
55076
|
let nxt = flat.length;
|
|
55033
55077
|
for (let i = 0; i < flat.length; i++) {
|
|
55034
55078
|
const p = flat[i];
|
|
@@ -55079,7 +55123,7 @@ function constrainX(g, nlist, ifn, ortho) {
|
|
|
55079
55123
|
list.insert(p);
|
|
55080
55124
|
}
|
|
55081
55125
|
const cg = buildConstraintGraph(g, list, ifn, distX, ortho);
|
|
55082
|
-
rank(cg.g, 2,
|
|
55126
|
+
rank(cg.g, 2, INT_MAX8);
|
|
55083
55127
|
for (const p of nlist) {
|
|
55084
55128
|
const newpos = cnodeOf(p).info.rank ?? 0;
|
|
55085
55129
|
const delta2 = newpos - p.pos.x;
|
|
@@ -55095,7 +55139,7 @@ function constrainY(g, nlist, ifn, ortho) {
|
|
|
55095
55139
|
list.insert(p);
|
|
55096
55140
|
}
|
|
55097
55141
|
const cg = buildConstraintGraph(g, list, ifn, distY, ortho);
|
|
55098
|
-
rank(cg.g, 2,
|
|
55142
|
+
rank(cg.g, 2, INT_MAX8);
|
|
55099
55143
|
for (const p of nlist) {
|
|
55100
55144
|
const newpos = cnodeOf(p).info.rank ?? 0;
|
|
55101
55145
|
const delta2 = newpos - p.pos.y;
|
|
@@ -63335,6 +63379,7 @@ function classifyError(err) {
|
|
|
63335
63379
|
};
|
|
63336
63380
|
if (gv.location !== void 0) out.location = gv.location;
|
|
63337
63381
|
if (gv.expected !== void 0) out.expected = gv.expected;
|
|
63382
|
+
if (gv.context !== void 0) out.context = { ...gv.context };
|
|
63338
63383
|
return out;
|
|
63339
63384
|
}
|
|
63340
63385
|
function renderSvg(dotSource, engine) {
|