@knowvah/dot-engine 2.12.1 → 2.12.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.
- package/dist/api/builder.d.ts +7 -1
- package/dist/api/builder.d.ts.map +1 -1
- package/dist/api.js +14 -7
- package/dist/api.js.map +2 -2
- package/dist/common/edge-label-init.d.ts +26 -1
- package/dist/common/edge-label-init.d.ts.map +1 -1
- package/dist/common/nodeinit.d.ts +16 -2
- package/dist/common/nodeinit.d.ts.map +1 -1
- package/dist/common/splines-path-begin.d.ts.map +1 -1
- package/dist/common/splines-path-end.d.ts.map +1 -1
- package/dist/gvc/context.d.ts +8 -0
- package/dist/gvc/context.d.ts.map +1 -1
- package/dist/gvc/emit-gates.d.ts +5 -10
- package/dist/gvc/emit-gates.d.ts.map +1 -1
- package/dist/gvc/emit-xdot.d.ts +7 -6
- package/dist/gvc/emit-xdot.d.ts.map +1 -1
- package/dist/gvc/job.d.ts +5 -2
- package/dist/gvc/job.d.ts.map +1 -1
- package/dist/gvc/viewport.d.ts +10 -5
- package/dist/gvc/viewport.d.ts.map +1 -1
- package/dist/index.js +361 -194
- package/dist/index.js.map +4 -4
- package/dist/layout/dot/edge-route.d.ts +7 -3
- package/dist/layout/dot/edge-route.d.ts.map +1 -1
- package/dist/layout/dot/fastgr.d.ts +5 -3
- package/dist/layout/dot/fastgr.d.ts.map +1 -1
- package/dist/layout/dot/flat-adj-record.d.ts +22 -0
- package/dist/layout/dot/flat-adj-record.d.ts.map +1 -0
- package/dist/layout/dot/init.d.ts +49 -9
- package/dist/layout/dot/init.d.ts.map +1 -1
- package/dist/layout/dot/mincross-build.d.ts +6 -0
- package/dist/layout/dot/mincross-build.d.ts.map +1 -1
- package/dist/layout/dot/position-aux.d.ts +7 -1
- package/dist/layout/dot/position-aux.d.ts.map +1 -1
- package/dist/layout/dot/splines-clone.d.ts +2 -1
- package/dist/layout/dot/splines-clone.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat.d.ts +18 -0
- package/dist/layout/dot/splines-flat.d.ts.map +1 -1
- package/dist/layout/dot/splines-groups.d.ts.map +1 -1
- package/dist/layout/fdp/ports.d.ts.map +1 -1
- package/dist/layout/neato/conjgrad-mkernel.d.ts.map +1 -1
- package/dist/layout/neato/sgd.d.ts.map +1 -1
- package/dist/model/cgraph-ops.d.ts +10 -2
- package/dist/model/cgraph-ops.d.ts.map +1 -1
- package/dist/model/edge.d.ts +7 -2
- package/dist/model/edge.d.ts.map +1 -1
- package/dist/model/edgeInfo.d.ts +17 -2
- package/dist/model/edgeInfo.d.ts.map +1 -1
- package/dist/model/graph.d.ts +4 -3
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/lazy-attrs.d.ts.map +1 -1
- package/dist/parser/builder.d.ts.map +1 -1
- package/dist/render/dot/agwrite.d.ts +5 -1
- package/dist/render/dot/agwrite.d.ts.map +1 -1
- package/dist/render/dot/attrs.d.ts +15 -4
- package/dist/render/dot/attrs.d.ts.map +1 -1
- package/dist/render/dot/write-back.d.ts +14 -0
- package/dist/render/dot/write-back.d.ts.map +1 -1
- package/dist/render/dot/xdot-ops.d.ts +20 -29
- package/dist/render/dot/xdot-ops.d.ts.map +1 -1
- package/dist/render/dot.d.ts +4 -2
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/json-cluster-edge.d.ts +17 -4
- package/dist/render/json-cluster-edge.d.ts.map +1 -1
- package/dist/render/json-nonfinite.d.ts +17 -0
- package/dist/render/json-nonfinite.d.ts.map +1 -0
- package/dist/render/json.d.ts +4 -0
- package/dist/render/json.d.ts.map +1 -1
- package/dist/render/map.d.ts +3 -0
- package/dist/render/map.d.ts.map +1 -1
- package/dist/render/svg-graph.d.ts.map +1 -1
- package/dist/render/svg-id.d.ts +10 -1
- package/dist/render/svg-id.d.ts.map +1 -1
- package/dist/render/svg.d.ts +3 -1
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render.js +360 -193
- package/dist/render.js.map +4 -4
- package/dist/util/bsd-qsort.d.ts.map +1 -1
- package/dist/xdot/parse.d.ts.map +1 -1
- package/dist/xdot/strtod.d.ts +23 -0
- package/dist/xdot/strtod.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/api/builder.ts +8 -2
- package/src/common/edge-label-init.ts +43 -17
- package/src/common/nodeinit.ts +28 -8
- package/src/common/splines-path-begin.ts +4 -3
- package/src/common/splines-path-end.ts +4 -3
- package/src/gvc/context.ts +8 -0
- package/src/gvc/device.ts +6 -6
- package/src/gvc/emit-gates.ts +6 -15
- package/src/gvc/emit-xdot.ts +10 -11
- package/src/gvc/job.ts +5 -2
- package/src/gvc/viewport.ts +13 -7
- package/src/layout/dot/__fixtures__/flat-adj-aux-syms.native-16.1.json +1210 -0
- package/src/layout/dot/edge-route.ts +44 -49
- package/src/layout/dot/fastgr.ts +9 -3
- package/src/layout/dot/flat-adj-record.ts +68 -0
- package/src/layout/dot/init.ts +59 -13
- package/src/layout/dot/mincross-build.ts +14 -1
- package/src/layout/dot/position-aux.ts +10 -3
- package/src/layout/dot/splines-clone.ts +8 -2
- package/src/layout/dot/splines-flat-labeled.ts +3 -2
- package/src/layout/dot/splines-flat.ts +9 -19
- package/src/layout/dot/splines-groups.ts +5 -3
- package/src/layout/fdp/ports.ts +6 -2
- package/src/layout/neato/conjgrad-mkernel.ts +6 -2
- package/src/layout/neato/sgd.ts +2 -1
- package/src/model/cgraph-ops.ts +4 -3
- package/src/model/edge.ts +11 -4
- package/src/model/edgeInfo.ts +18 -2
- package/src/model/graph.ts +4 -3
- package/src/model/lazy-attrs.ts +3 -1
- package/src/parser/builder.ts +12 -3
- package/src/render/dot/agwrite.ts +10 -3
- package/src/render/dot/attrs.ts +18 -7
- package/src/render/dot/write-back.ts +27 -3
- package/src/render/dot/xdot-ops.ts +25 -56
- package/src/render/dot.ts +7 -5
- package/src/render/json-cluster-edge.ts +42 -5
- package/src/render/json-nonfinite.ts +51 -0
- package/src/render/json.ts +23 -26
- package/src/render/map.ts +3 -0
- package/src/render/svg-graph.ts +3 -15
- package/src/render/svg-id.ts +11 -2
- package/src/render/svg.ts +4 -1
- package/src/util/bsd-qsort.ts +2 -1
- package/src/xdot/parse.ts +9 -19
- package/src/xdot/strtod.ts +167 -0
package/dist/index.js
CHANGED
|
@@ -3605,9 +3605,10 @@ var Graph = class {
|
|
|
3605
3605
|
* True when the graph was declared with NO name (`digraph {`), as opposed to
|
|
3606
3606
|
* an explicit empty name (`digraph "" {`). Both store `name === ''`, but
|
|
3607
3607
|
* cgraph gives the truly-anonymous root the internal id `%1` (agnameof) while
|
|
3608
|
-
* the empty-named one keeps `""`.
|
|
3609
|
-
*
|
|
3610
|
-
*
|
|
3608
|
+
* the empty-named one keeps `""`. Read through `agNameOf` by the imagemap
|
|
3609
|
+
* `<map id/name>`, the neato messages and the dot/xdot writer's header,
|
|
3610
|
+
* which prints `digraph {` for an anonymous root and `digraph "" {` for the
|
|
3611
|
+
* empty-named one. `name` stays `''` for both.
|
|
3611
3612
|
* @see lib/cgraph/id.c:idmap (anon → `%1`) ; lib/cgraph/agraph.c:agnameof
|
|
3612
3613
|
*/
|
|
3613
3614
|
anonymous;
|
|
@@ -3934,6 +3935,7 @@ function makePort() {
|
|
|
3934
3935
|
name: null
|
|
3935
3936
|
};
|
|
3936
3937
|
}
|
|
3938
|
+
var AUX_EDGE_PORT = Object.freeze({ ...makePort(), p: Object.freeze({ x: 0, y: 0 }) });
|
|
3937
3939
|
function makeEdgeInfo(tailPort, headPort) {
|
|
3938
3940
|
return {
|
|
3939
3941
|
tail_port: tailPort,
|
|
@@ -4029,14 +4031,19 @@ var Edge = class _Edge {
|
|
|
4029
4031
|
* @see lib/cgraph/cgraph.h:agbindrec
|
|
4030
4032
|
*/
|
|
4031
4033
|
info;
|
|
4032
|
-
/**
|
|
4033
|
-
|
|
4034
|
+
/**
|
|
4035
|
+
* `auxPorts` is for dot's auxiliary edges only: both ends take the shared
|
|
4036
|
+
* {@link AUX_EDGE_PORT} in place of a private port each.
|
|
4037
|
+
* @see lib/cgraph/edge.c:agedge
|
|
4038
|
+
* @see lib/dotgen/position.c:make_aux_edge
|
|
4039
|
+
*/
|
|
4040
|
+
constructor(tail, head, name, lazyAttrs = false, auxPorts = false) {
|
|
4034
4041
|
this.seq = _Edge._nextSeq++;
|
|
4035
4042
|
this.tail = tail;
|
|
4036
4043
|
this.head = head;
|
|
4037
4044
|
this.name = name;
|
|
4038
4045
|
this.attrs = lazyAttrs ? EMPTY_ATTRS : /* @__PURE__ */ new Map();
|
|
4039
|
-
this.info = makeEdgeInfo(makePort(), makePort());
|
|
4046
|
+
this.info = auxPorts ? makeEdgeInfo(AUX_EDGE_PORT, AUX_EDGE_PORT) : makeEdgeInfo(makePort(), makePort());
|
|
4040
4047
|
}
|
|
4041
4048
|
};
|
|
4042
4049
|
|
|
@@ -4398,8 +4405,9 @@ function buildFromAst(ast) {
|
|
|
4398
4405
|
else if (ast.directed) kind = "directed";
|
|
4399
4406
|
else if (ast.strict) kind = "strict-undirected";
|
|
4400
4407
|
else kind = "undirected";
|
|
4401
|
-
const
|
|
4402
|
-
|
|
4408
|
+
const id = ast.id ?? "";
|
|
4409
|
+
const graph = new Graph(isHtmlValue(id) ? htmlValueContent(id) : id, kind, ast.id == null);
|
|
4410
|
+
if (ast.id == null) processor.advanceAnonId();
|
|
4403
4411
|
buildGraph(ast.stmts, graph, graph, ast.directed, processor);
|
|
4404
4412
|
return graph;
|
|
4405
4413
|
}
|
|
@@ -5800,11 +5808,115 @@ function bindDotRoot(g) {
|
|
|
5800
5808
|
// src/xdot/types.ts
|
|
5801
5809
|
var XDOT_PARSE_ERROR = 1;
|
|
5802
5810
|
|
|
5811
|
+
// src/xdot/strtod.ts
|
|
5812
|
+
var INF_WORD = "inf";
|
|
5813
|
+
var INF_TAIL = "inity";
|
|
5814
|
+
var NAN_WORD = "nan";
|
|
5815
|
+
var SIGNIFICAND_BITS = 53;
|
|
5816
|
+
var MIN_SUBNORMAL_EXP = -1074;
|
|
5817
|
+
var MAX_BINARY_EXP = 1023;
|
|
5818
|
+
var MIN_NORMAL_EXP = -1022;
|
|
5819
|
+
var EXP_BIAS = 1023;
|
|
5820
|
+
var FRACTION_SCALE = 2n ** 52n;
|
|
5821
|
+
var HEX_DIGIT_BITS = 4n;
|
|
5822
|
+
function isSpace(c) {
|
|
5823
|
+
return c === " " || c >= " " && c <= "\r";
|
|
5824
|
+
}
|
|
5825
|
+
function isDecDigit(c) {
|
|
5826
|
+
return c >= "0" && c <= "9";
|
|
5827
|
+
}
|
|
5828
|
+
function isHexDigit(c) {
|
|
5829
|
+
return isDecDigit(c) || c >= "a" && c <= "f" || c >= "A" && c <= "F";
|
|
5830
|
+
}
|
|
5831
|
+
function skipWhile(s, i, pred) {
|
|
5832
|
+
while (i < s.length && pred(s[i])) i++;
|
|
5833
|
+
return i;
|
|
5834
|
+
}
|
|
5835
|
+
function matchesWord(s, i, word) {
|
|
5836
|
+
return s.slice(i, i + word.length).toLowerCase() === word;
|
|
5837
|
+
}
|
|
5838
|
+
function exponentEnd(s, i, marker) {
|
|
5839
|
+
if (i >= s.length || s[i].toLowerCase() !== marker) return i;
|
|
5840
|
+
let j = i + 1;
|
|
5841
|
+
if (s[j] === "+" || s[j] === "-") j++;
|
|
5842
|
+
const end = skipWhile(s, j, isDecDigit);
|
|
5843
|
+
return end === j ? i : end;
|
|
5844
|
+
}
|
|
5845
|
+
function pow2(q) {
|
|
5846
|
+
let bits = BigInt(q + EXP_BIAS) * FRACTION_SCALE;
|
|
5847
|
+
if (q < MIN_NORMAL_EXP) bits = 2n ** BigInt(q - MIN_SUBNORMAL_EXP);
|
|
5848
|
+
return new Float64Array(new BigUint64Array([bits]).buffer)[0];
|
|
5849
|
+
}
|
|
5850
|
+
function shiftRoundHalfEven(m, shift) {
|
|
5851
|
+
if (shift <= 0n) return m << -shift;
|
|
5852
|
+
const kept = m >> shift;
|
|
5853
|
+
const rem = m - (kept << shift);
|
|
5854
|
+
const half = 1n << shift - 1n;
|
|
5855
|
+
const roundUp = rem > half || rem === half && (kept & 1n) === 1n;
|
|
5856
|
+
return roundUp ? kept + 1n : kept;
|
|
5857
|
+
}
|
|
5858
|
+
function hexToDouble(m, e2) {
|
|
5859
|
+
if (m === 0n) return 0;
|
|
5860
|
+
const top = BigInt(m.toString(2).length - 1) + e2;
|
|
5861
|
+
if (top > BigInt(MAX_BINARY_EXP)) return Infinity;
|
|
5862
|
+
if (top < BigInt(MIN_SUBNORMAL_EXP - 1)) return 0;
|
|
5863
|
+
const q = Math.max(Number(top) - (SIGNIFICAND_BITS - 1), MIN_SUBNORMAL_EXP);
|
|
5864
|
+
return Number(shiftRoundHalfEven(m, BigInt(q) - e2)) * pow2(q);
|
|
5865
|
+
}
|
|
5866
|
+
function scanHex(s, i) {
|
|
5867
|
+
const intStart = i + 2;
|
|
5868
|
+
const intEnd = skipWhile(s, intStart, isHexDigit);
|
|
5869
|
+
const hasDot = s[intEnd] === ".";
|
|
5870
|
+
const end = hasDot ? skipWhile(s, intEnd + 1, isHexDigit) : intEnd;
|
|
5871
|
+
const digits = s.slice(intStart, intEnd) + (hasDot ? s.slice(intEnd + 1, end) : "");
|
|
5872
|
+
if (digits.length === 0) return null;
|
|
5873
|
+
const fracDigits = BigInt(hasDot ? end - intEnd - 1 : 0);
|
|
5874
|
+
const expEnd = exponentEnd(s, end, "p");
|
|
5875
|
+
const exp = expEnd > end ? BigInt(s.slice(end + 1, expEnd)) : 0n;
|
|
5876
|
+
const val2 = hexToDouble(BigInt(`0x${digits}`), exp - HEX_DIGIT_BITS * fracDigits);
|
|
5877
|
+
return { val: val2, pos: expEnd };
|
|
5878
|
+
}
|
|
5879
|
+
function scanDecimal(s, i) {
|
|
5880
|
+
const intEnd = skipWhile(s, i, isDecDigit);
|
|
5881
|
+
const hasDot = s[intEnd] === ".";
|
|
5882
|
+
const mantEnd = hasDot ? skipWhile(s, intEnd + 1, isDecDigit) : intEnd;
|
|
5883
|
+
const digitCount = mantEnd - i - (hasDot ? 1 : 0);
|
|
5884
|
+
if (digitCount === 0) return null;
|
|
5885
|
+
const end = exponentEnd(s, mantEnd, "e");
|
|
5886
|
+
return { val: parseFloat(s.slice(i, end)), pos: end };
|
|
5887
|
+
}
|
|
5888
|
+
function scanSpecial(s, i) {
|
|
5889
|
+
if (matchesWord(s, i, INF_WORD)) {
|
|
5890
|
+
const tail = i + INF_WORD.length;
|
|
5891
|
+
return { val: Infinity, pos: matchesWord(s, tail, INF_TAIL) ? tail + INF_TAIL.length : tail };
|
|
5892
|
+
}
|
|
5893
|
+
if (!matchesWord(s, i, NAN_WORD)) return null;
|
|
5894
|
+
const end = i + NAN_WORD.length;
|
|
5895
|
+
const close = s[end] === "(" ? s.indexOf(")", end) : -1;
|
|
5896
|
+
return { val: NaN, pos: close === -1 ? end : close + 1 };
|
|
5897
|
+
}
|
|
5898
|
+
function scanMagnitude(s, i) {
|
|
5899
|
+
if (s[i] === "0" && (s[i + 1] === "x" || s[i + 1] === "X")) {
|
|
5900
|
+
const hex = scanHex(s, i);
|
|
5901
|
+
if (hex !== null) return hex;
|
|
5902
|
+
}
|
|
5903
|
+
return scanDecimal(s, i) ?? scanSpecial(s, i);
|
|
5904
|
+
}
|
|
5905
|
+
function scanStrtod(s, pos) {
|
|
5906
|
+
let i = skipWhile(s, pos, isSpace);
|
|
5907
|
+
const negative = s[i] === "-";
|
|
5908
|
+
if (negative || s[i] === "+") i++;
|
|
5909
|
+
const mag = scanMagnitude(s, i);
|
|
5910
|
+
if (mag === null) return null;
|
|
5911
|
+
return { val: negative ? -mag.val : mag.val, pos: mag.pos };
|
|
5912
|
+
}
|
|
5913
|
+
|
|
5803
5914
|
// src/xdot/parse.ts
|
|
5804
5915
|
var ULONG_MAX = 0xffffffffffffffffn;
|
|
5805
5916
|
var XdotParser = class _XdotParser {
|
|
5917
|
+
/** @see lib/util/gv_ctype.h:gv_isspace */
|
|
5806
5918
|
static isWs(c) {
|
|
5807
|
-
return c
|
|
5919
|
+
return isSpace(c);
|
|
5808
5920
|
}
|
|
5809
5921
|
static skipWs(s, pos) {
|
|
5810
5922
|
while (pos < s.length && _XdotParser.isWs(s[pos])) pos++;
|
|
@@ -5814,27 +5926,13 @@ var XdotParser = class _XdotParser {
|
|
|
5814
5926
|
while (i < s.length && s[i] >= "0" && s[i] <= "9") i++;
|
|
5815
5927
|
return i;
|
|
5816
5928
|
}
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
}
|
|
5823
|
-
return i;
|
|
5824
|
-
}
|
|
5929
|
+
/**
|
|
5930
|
+
* C reads every xdot double with strtod, so a number may be a decimal, a
|
|
5931
|
+
* hex float, inf/infinity or nan/nan(...); null is C's `p == s`.
|
|
5932
|
+
* @see lib/xdot/xdot.c:parseReal
|
|
5933
|
+
*/
|
|
5825
5934
|
static parseReal(s, pos) {
|
|
5826
|
-
|
|
5827
|
-
const start = i;
|
|
5828
|
-
if (i < s.length && (s[i] === "-" || s[i] === "+")) i++;
|
|
5829
|
-
const digStart = i;
|
|
5830
|
-
i = _XdotParser.consumeDigits(s, i);
|
|
5831
|
-
if (i < s.length && s[i] === ".") {
|
|
5832
|
-
i++;
|
|
5833
|
-
i = _XdotParser.consumeDigits(s, i);
|
|
5834
|
-
}
|
|
5835
|
-
i = _XdotParser.consumeExponent(s, i);
|
|
5836
|
-
if (i === start || i === digStart) return null;
|
|
5837
|
-
return { val: parseFloat(s.slice(start, i)), pos: i };
|
|
5935
|
+
return scanStrtod(s, pos);
|
|
5838
5936
|
}
|
|
5839
5937
|
static parseInt_(s, pos) {
|
|
5840
5938
|
let i = _XdotParser.skipWs(s, pos);
|
|
@@ -6616,10 +6714,13 @@ var RenderJob = class {
|
|
|
6616
6714
|
measurer;
|
|
6617
6715
|
format;
|
|
6618
6716
|
bb = { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
6717
|
+
/** `pad=`, or else the render device's default pad (`RendererPlugin.defaultPad`).
|
|
6718
|
+
* @see lib/common/emit.c:3290-3304 init_job_pad */
|
|
6619
6719
|
pad = { x: 0, y: 0 };
|
|
6620
6720
|
/** Current page clip in graph units, as setup_page computes it from the
|
|
6621
|
-
* viewport focus/view (see setupPageClip). Read by the
|
|
6622
|
-
*
|
|
6721
|
+
* viewport focus/view (see setupPageClip). Read by the node and edge gates
|
|
6722
|
+
* and by the SVG page translate and background.
|
|
6723
|
+
* @see lib/gvc/gvcjob.h:GVJ_s.clip; lib/common/emit.c:setup_page */
|
|
6623
6724
|
clip = { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
6624
6725
|
/** Graph-level `margin=` (init_job_margin); page-pagination margin, distinct
|
|
6625
6726
|
* from node/cluster label margin. @see lib/common/emit.c:3309-3331 */
|
|
@@ -7656,10 +7757,10 @@ var COMPLETE_END = (end, attError) => attError === void 0 ? { kind: "complete",
|
|
|
7656
7757
|
var PARTIAL = { kind: "partial" };
|
|
7657
7758
|
var INVALID = (offset) => ({ kind: "invalid", offset });
|
|
7658
7759
|
var XML_NAME = /^[A-Za-z_:\u0080-\uFFFF][\w.:\u0080-\uFFFF-]*/;
|
|
7659
|
-
var
|
|
7760
|
+
var isSpace2 = (c) => c !== void 0 && /\s/.test(c);
|
|
7660
7761
|
function skipSpace(text, i) {
|
|
7661
7762
|
let j = i;
|
|
7662
|
-
while (
|
|
7763
|
+
while (isSpace2(text[j])) j++;
|
|
7663
7764
|
return j;
|
|
7664
7765
|
}
|
|
7665
7766
|
var byteLength = (s) => new TextEncoder().encode(s).length;
|
|
@@ -7733,7 +7834,7 @@ function scanStartTag(text, p) {
|
|
|
7733
7834
|
if ("kind" in name) return name;
|
|
7734
7835
|
const c = text[name.next];
|
|
7735
7836
|
if (c === void 0) return PARTIAL;
|
|
7736
|
-
if (!
|
|
7837
|
+
if (!isSpace2(c) && c !== ">" && c !== "/") return INVALID(name.next);
|
|
7737
7838
|
return scanAttributes(text, p, name.next);
|
|
7738
7839
|
}
|
|
7739
7840
|
function scanEndTag(text, p) {
|
|
@@ -15116,6 +15217,7 @@ function flatEdge(g, e) {
|
|
|
15116
15217
|
if (!e.head.info.flat_in) e.head.info.flat_in = { list: [], size: 0 };
|
|
15117
15218
|
elistAppend(e.tail.info.flat_out, e);
|
|
15118
15219
|
elistAppend(e.head.info.flat_in, e);
|
|
15220
|
+
(g.info.dotroot ?? g.root).info.has_flat_edges = true;
|
|
15119
15221
|
g.info.has_flat_edges = true;
|
|
15120
15222
|
}
|
|
15121
15223
|
function findFlatEdge(u, v) {
|
|
@@ -21107,7 +21209,7 @@ function graphRanksep(g) {
|
|
|
21107
21209
|
return g.info.ranksep ?? 0;
|
|
21108
21210
|
}
|
|
21109
21211
|
function makeAuxEdge(u, v, len, wt) {
|
|
21110
|
-
const e = new Edge(u, v, "");
|
|
21212
|
+
const e = new Edge(u, v, "", true, true);
|
|
21111
21213
|
e.info.minlen = cround(Math.min(len, 2147483647));
|
|
21112
21214
|
e.info.weight = wt;
|
|
21113
21215
|
fastEdge(e);
|
|
@@ -21155,7 +21257,7 @@ function applyFlatLabel(g, e, e0raw, e1raw) {
|
|
|
21155
21257
|
const nodesep = graphNodesep(g);
|
|
21156
21258
|
const e0 = nodeOrder(e0raw.head) <= nodeOrder(e1raw.head) ? e0raw : e1raw;
|
|
21157
21259
|
const e1 = e0 === e0raw ? e1raw : e0raw;
|
|
21158
|
-
const m0 = edgeMinlen(e) * nodesep / 2;
|
|
21260
|
+
const m0 = Math.trunc(edgeMinlen(e) * nodesep / 2);
|
|
21159
21261
|
const m1a = m0 + nodeRw(e0.head) + nodeLw(e0.tail);
|
|
21160
21262
|
if (!canReach(e0.tail, e0.head)) makeAuxEdge(e0.head, e0.tail, m1a, edgeWeight(e));
|
|
21161
21263
|
const m1b = m0 + nodeRw(e1.tail) + nodeLw(e1.head);
|
|
@@ -23836,9 +23938,12 @@ function doOrderingNode(ctx, g, n, outflag) {
|
|
|
23836
23938
|
}
|
|
23837
23939
|
function doOrderingForNodes(ctx, g) {
|
|
23838
23940
|
for (const n of nodesInSeq(g)) {
|
|
23839
|
-
const ordering = n
|
|
23941
|
+
const ordering = nodeAttr(n, g, "ordering");
|
|
23840
23942
|
if (ordering === "out") doOrderingNode(ctx, g, n, true);
|
|
23841
23943
|
else if (ordering === "in") doOrderingNode(ctx, g, n, false);
|
|
23944
|
+
else if (ordering !== void 0 && ordering !== "") {
|
|
23945
|
+
agerrorf(`ordering '${ordering}' not recognized for node '${n.name}'.`);
|
|
23946
|
+
}
|
|
23842
23947
|
}
|
|
23843
23948
|
}
|
|
23844
23949
|
function doOrdering(ctx, g, outflag) {
|
|
@@ -23849,6 +23954,7 @@ function orderedEdges(ctx, g) {
|
|
|
23849
23954
|
if (ordering !== void 0) {
|
|
23850
23955
|
if (ordering === "out") doOrdering(ctx, g, true);
|
|
23851
23956
|
else if (ordering === "in") doOrdering(ctx, g, false);
|
|
23957
|
+
else if (ordering !== "") agerrorf(`ordering '${ordering}' not recognized.`);
|
|
23852
23958
|
return;
|
|
23853
23959
|
}
|
|
23854
23960
|
for (const subg of g.subgraphs.values()) {
|
|
@@ -26715,7 +26821,7 @@ function svgClusterId(sg, job) {
|
|
|
26715
26821
|
return job.objId(sg.attrs.get("id"), "clust" + sg.seq);
|
|
26716
26822
|
}
|
|
26717
26823
|
function svgGraphId(g, job) {
|
|
26718
|
-
return job.objId(g.attrs.get("id"), "
|
|
26824
|
+
return job.objId(g.attrs.get("id"), "graph" + g.seq, true);
|
|
26719
26825
|
}
|
|
26720
26826
|
function svgNodeClass(n) {
|
|
26721
26827
|
return svgClass("node", nodeAttr(n, n.root, "class"));
|
|
@@ -27189,22 +27295,24 @@ function applyTailLabel(e, g, lfi, measurer) {
|
|
|
27189
27295
|
e.info.tail_label = makeAnyLabel(content, isHtml, lfi, measurer, e);
|
|
27190
27296
|
g.root.info.has_labels = (g.root.info.has_labels ?? 0) | TAIL_LABEL;
|
|
27191
27297
|
}
|
|
27192
|
-
|
|
27298
|
+
var BOUND_EDGE_LABEL_SYMS = { headlabel: true, taillabel: true, xlabel: true };
|
|
27299
|
+
function applyMainLabels(e, g, measurer, syms) {
|
|
27193
27300
|
let fi = null;
|
|
27194
27301
|
const labelStr = e.attrs.get("label");
|
|
27195
27302
|
if (labelStr) {
|
|
27196
27303
|
fi = initFontEdgeAttr(e);
|
|
27197
27304
|
applyLabel(e, g, fi, measurer);
|
|
27198
27305
|
}
|
|
27199
|
-
const xlabelStr = e.attrs.get("xlabel");
|
|
27306
|
+
const xlabelStr = syms.xlabel ? e.attrs.get("xlabel") : void 0;
|
|
27200
27307
|
if (xlabelStr) {
|
|
27201
27308
|
applyXLabel(e, g, fi ?? initFontEdgeAttr(e), measurer);
|
|
27202
27309
|
}
|
|
27203
27310
|
}
|
|
27204
|
-
function applyEndLabels(e, g, measurer) {
|
|
27311
|
+
function applyEndLabels(e, g, measurer, syms) {
|
|
27312
|
+
if (!syms.headlabel && !syms.taillabel) return;
|
|
27205
27313
|
const lfi = getLabelFontInfo(e);
|
|
27206
|
-
applyHeadLabel(e, g, lfi, measurer);
|
|
27207
|
-
applyTailLabel(e, g, lfi, measurer);
|
|
27314
|
+
if (syms.headlabel) applyHeadLabel(e, g, lfi, measurer);
|
|
27315
|
+
if (syms.taillabel) applyTailLabel(e, g, lfi, measurer);
|
|
27208
27316
|
}
|
|
27209
27317
|
function chkPort(pf, n, s) {
|
|
27210
27318
|
const cp = s.indexOf(":");
|
|
@@ -27235,13 +27343,13 @@ function initEdgePorts(e) {
|
|
|
27235
27343
|
e.info.head_port = chkPort(portfnOf(e.head), e.head, headStr);
|
|
27236
27344
|
if (isClipDisabled(e.attrs.get("headclip"))) e.info.head_port.clip = false;
|
|
27237
27345
|
}
|
|
27238
|
-
function initEdgeLabels(e, g, measurer) {
|
|
27346
|
+
function initEdgeLabels(e, g, measurer, syms = BOUND_EDGE_LABEL_SYMS) {
|
|
27239
27347
|
initEdgePorts(e);
|
|
27240
27348
|
const hasMain = e.attrs.has("label") || e.attrs.has("xlabel");
|
|
27241
27349
|
const hasEnd = e.attrs.has("headlabel") || e.attrs.has("taillabel");
|
|
27242
27350
|
if (!hasMain && !hasEnd) return;
|
|
27243
|
-
if (hasMain) applyMainLabels(e, g, measurer);
|
|
27244
|
-
if (hasEnd) applyEndLabels(e, g, measurer);
|
|
27351
|
+
if (hasMain) applyMainLabels(e, g, measurer, syms);
|
|
27352
|
+
if (hasEnd) applyEndLabels(e, g, measurer, syms);
|
|
27245
27353
|
}
|
|
27246
27354
|
|
|
27247
27355
|
// src/common/graph-init.ts
|
|
@@ -27393,8 +27501,24 @@ function dotInitNode(n) {
|
|
|
27393
27501
|
if (n.info.ht === void 0) n.info.ht = 36;
|
|
27394
27502
|
n.info.node_type = NORMAL;
|
|
27395
27503
|
}
|
|
27396
|
-
var DOT_INIT_SYMS = {
|
|
27397
|
-
|
|
27504
|
+
var DOT_INIT_SYMS = {
|
|
27505
|
+
constr: true,
|
|
27506
|
+
minlen: true,
|
|
27507
|
+
group: true,
|
|
27508
|
+
headlabel: true,
|
|
27509
|
+
taillabel: true,
|
|
27510
|
+
xlabel: true,
|
|
27511
|
+
nodeXlabel: true
|
|
27512
|
+
};
|
|
27513
|
+
var AUX_INIT_SYMS = {
|
|
27514
|
+
constr: false,
|
|
27515
|
+
minlen: false,
|
|
27516
|
+
group: false,
|
|
27517
|
+
headlabel: false,
|
|
27518
|
+
taillabel: false,
|
|
27519
|
+
xlabel: false,
|
|
27520
|
+
nodeXlabel: false
|
|
27521
|
+
};
|
|
27398
27522
|
function sameNonemptyGroup(e, syms = DOT_INIT_SYMS) {
|
|
27399
27523
|
if (!syms.group) return false;
|
|
27400
27524
|
const tailgroup = nodeAttr(e.tail, e.tail.root, "group") ?? "";
|
|
@@ -27446,13 +27570,13 @@ function clearFastGraphLists(n) {
|
|
|
27446
27570
|
}
|
|
27447
27571
|
function dotInitNodeEdge(g, syms = DOT_INIT_SYMS) {
|
|
27448
27572
|
for (const n of nodesInSeq(g)) {
|
|
27449
|
-
commonInitNode(n, g);
|
|
27573
|
+
commonInitNode(n, g, syms);
|
|
27450
27574
|
dotInitNode(n);
|
|
27451
27575
|
}
|
|
27452
27576
|
const measurer = g.root.info.gvc?.textMeasurer;
|
|
27453
27577
|
for (const e of g.edges) {
|
|
27454
27578
|
dotInitEdge(e, syms);
|
|
27455
|
-
if (measurer) initEdgeLabels(e, g, measurer);
|
|
27579
|
+
if (measurer) initEdgeLabels(e, g, measurer, syms);
|
|
27456
27580
|
}
|
|
27457
27581
|
}
|
|
27458
27582
|
function removeFill(g) {
|
|
@@ -28027,7 +28151,9 @@ function polySizeParamsFromNode(n, g, shape, labelDimen, flip) {
|
|
|
28027
28151
|
flip
|
|
28028
28152
|
};
|
|
28029
28153
|
}
|
|
28030
|
-
|
|
28154
|
+
var BOUND_NODE_INIT_SYMS = { nodeXlabel: true };
|
|
28155
|
+
function initNodeXLabel(n, g, measurer, syms) {
|
|
28156
|
+
if (!syms.nodeXlabel) return;
|
|
28031
28157
|
const str = nodeAttr(n, g, "xlabel");
|
|
28032
28158
|
if (!str || str.length === 0) return;
|
|
28033
28159
|
const font = readFontAttrs(n, g);
|
|
@@ -28064,17 +28190,17 @@ function initPointSize(n, g, shape) {
|
|
|
28064
28190
|
storeNodeSize(n, pointSizeResult(sz0, peripheries, penwidth), flip);
|
|
28065
28191
|
assignShapeInfo(n, { ...shape.polygon, peripheries, sides: 2, penwidth, vertices: null });
|
|
28066
28192
|
}
|
|
28067
|
-
function initNodeFromLabel(n, g, measurer) {
|
|
28193
|
+
function initNodeFromLabel(n, g, measurer, syms) {
|
|
28068
28194
|
const shape = bindShape(nodeAttr(n, g, "shape") ?? "ellipse", nodeAttr(n, g, "shapefile"));
|
|
28069
28195
|
n.info.shape = shape;
|
|
28070
28196
|
if (shape.kind === 2 /* SH_RECORD */) {
|
|
28071
28197
|
recordMakeLabel(n, g, measurer);
|
|
28072
|
-
initNodeXLabel(n, g, measurer);
|
|
28198
|
+
initNodeXLabel(n, g, measurer, syms);
|
|
28073
28199
|
recordInit(n, g, measurer);
|
|
28074
28200
|
return true;
|
|
28075
28201
|
}
|
|
28076
28202
|
buildNodeLabel(n, g, measurer);
|
|
28077
|
-
initNodeXLabel(n, g, measurer);
|
|
28203
|
+
initNodeXLabel(n, g, measurer, syms);
|
|
28078
28204
|
if (shape.kind !== 3 /* SH_POINT */) warnPolyInitImages(n, g);
|
|
28079
28205
|
const poly = shape.polygon;
|
|
28080
28206
|
if (poly === null) return false;
|
|
@@ -28136,9 +28262,9 @@ function initNodeDefaults(n, g) {
|
|
|
28136
28262
|
if (!n.info.rw) n.info.rw = Math.max(w * 72 / 2, DEFAULT_NODE_LW);
|
|
28137
28263
|
if (!n.info.ht) n.info.ht = Math.max(h * 72, DEFAULT_NODE_HT);
|
|
28138
28264
|
}
|
|
28139
|
-
function commonInitNode(n, g) {
|
|
28265
|
+
function commonInitNode(n, g, syms = BOUND_NODE_INIT_SYMS) {
|
|
28140
28266
|
const measurer = layoutMeasurer(g);
|
|
28141
|
-
if (measurer !== void 0 && initNodeFromLabel(n, g, measurer)) return;
|
|
28267
|
+
if (measurer !== void 0 && initNodeFromLabel(n, g, measurer, syms)) return;
|
|
28142
28268
|
initNodeDefaults(n, g);
|
|
28143
28269
|
}
|
|
28144
28270
|
function commonInitNodeEdge(g) {
|
|
@@ -28771,9 +28897,6 @@ function bgGradientPts(clip) {
|
|
|
28771
28897
|
{ x: right2, y: bottom }
|
|
28772
28898
|
];
|
|
28773
28899
|
}
|
|
28774
|
-
function graphObjId(g, job) {
|
|
28775
|
-
return job.objId(g.attrs.get("id"), "graph" + g.seq, true);
|
|
28776
|
-
}
|
|
28777
28900
|
function writeGradientPolygon(clip, id, job) {
|
|
28778
28901
|
const left2 = clip.ll.x;
|
|
28779
28902
|
const right2 = clip.ur.x;
|
|
@@ -28797,7 +28920,7 @@ function writeGradientPolygon(clip, id, job) {
|
|
|
28797
28920
|
}
|
|
28798
28921
|
function emitGradientBackground(g, clip, spec, job) {
|
|
28799
28922
|
const obj = createObjState(0 /* RootGraph */);
|
|
28800
|
-
obj.id =
|
|
28923
|
+
obj.id = svgGraphId(g, job);
|
|
28801
28924
|
obj.fillColor = resolveRenderColor(spec.fillColor);
|
|
28802
28925
|
obj.stopColor = resolveRenderColor(spec.stopColor);
|
|
28803
28926
|
obj.gradientFrac = spec.frac;
|
|
@@ -28865,7 +28988,7 @@ function svgBeginPage(g, job) {
|
|
|
28865
28988
|
const tx = job.rotation !== 0 ? -clip.ur.x - job.margin.x / z : -clip.ll.x + job.margin.x / z;
|
|
28866
28989
|
const ty = clip.ur.y + job.margin.y / z;
|
|
28867
28990
|
emitGraphGroupOpen(
|
|
28868
|
-
job.idLayerPrefix() +
|
|
28991
|
+
job.idLayerPrefix() + svgGraphId(g, job),
|
|
28869
28992
|
svgGraphClass(g),
|
|
28870
28993
|
tx,
|
|
28871
28994
|
ty,
|
|
@@ -29322,7 +29445,8 @@ function parseDrawingSize(raw) {
|
|
|
29322
29445
|
}
|
|
29323
29446
|
return null;
|
|
29324
29447
|
}
|
|
29325
|
-
|
|
29448
|
+
var DEFAULT_GRAPH_PAD = 4;
|
|
29449
|
+
function parseGraphPad(raw, fallback) {
|
|
29326
29450
|
if (raw !== void 0) {
|
|
29327
29451
|
const xy = PAD_XY_RE.exec(raw);
|
|
29328
29452
|
if (xy) {
|
|
@@ -29334,7 +29458,7 @@ function parseGraphPad(raw) {
|
|
|
29334
29458
|
return { x: v, y: v };
|
|
29335
29459
|
}
|
|
29336
29460
|
}
|
|
29337
|
-
return { x:
|
|
29461
|
+
return { x: fallback, y: fallback };
|
|
29338
29462
|
}
|
|
29339
29463
|
function parseGraphMargin(raw) {
|
|
29340
29464
|
if (raw !== void 0) {
|
|
@@ -29949,11 +30073,9 @@ function nextLayer(job, cur) {
|
|
|
29949
30073
|
var DEFAULT_COLOR5 = "black";
|
|
29950
30074
|
var DEFAULT_FILL2 = "lightgrey";
|
|
29951
30075
|
var DEFAULT_LINE_STYLE2 = ["solid", "setlinewidth(1)"];
|
|
29952
|
-
function deviceClip(g,
|
|
29953
|
-
const attr2 = g.attrs.get("pad");
|
|
29954
|
-
const pad = renderer.type === "svg" ? job.pad : attr2 ? parseGraphPad(attr2) : { x: 0, y: 0 };
|
|
30076
|
+
function deviceClip(g, job) {
|
|
29955
30077
|
const size = parseDrawingSize(g.attrs.get("size"));
|
|
29956
|
-
return setupPageClip(job.bb, size, pad, initJobViewportZoom(job.bb, size, pad));
|
|
30078
|
+
return setupPageClip(job.bb, size, job.pad, initJobViewportZoom(job.bb, size, job.pad));
|
|
29957
30079
|
}
|
|
29958
30080
|
function zeroBoxInClip(clip) {
|
|
29959
30081
|
return clip.ll.x <= 0 && clip.ll.y <= 0 && clip.ur.x >= 0 && clip.ur.y >= 0;
|
|
@@ -30071,7 +30193,7 @@ function emitXdot(g, renderer, job) {
|
|
|
30071
30193
|
const obj = job.obj;
|
|
30072
30194
|
if (xd === void 0 || obj === null) return;
|
|
30073
30195
|
applyBackgroundState(g, renderer, obj);
|
|
30074
|
-
const inClip = zeroBoxInClip(deviceClip(g,
|
|
30196
|
+
const inClip = zeroBoxInClip(deviceClip(g, job));
|
|
30075
30197
|
const warned2 = { image: false };
|
|
30076
30198
|
let styled = false;
|
|
30077
30199
|
for (const op of xd.ops) {
|
|
@@ -30168,11 +30290,7 @@ function nodeBBox(n) {
|
|
|
30168
30290
|
};
|
|
30169
30291
|
}
|
|
30170
30292
|
function nodeInBox(n, job) {
|
|
30171
|
-
|
|
30172
|
-
ll: { x: job.bb.ll.x - job.pad.x, y: job.bb.ll.y - job.pad.y },
|
|
30173
|
-
ur: { x: job.bb.ur.x + job.pad.x, y: job.bb.ur.y + job.pad.y }
|
|
30174
|
-
};
|
|
30175
|
-
return boxOverlap(nodeBBox(n), clip);
|
|
30293
|
+
return boxOverlap(nodeBBox(n), job.clip);
|
|
30176
30294
|
}
|
|
30177
30295
|
function gvrenderComment(renderer, job, str) {
|
|
30178
30296
|
if (str === void 0 || str.length === 0) return;
|
|
@@ -30377,11 +30495,11 @@ function render(ctx, g, format, inlineImages = false) {
|
|
|
30377
30495
|
const job = newRenderJob(ctx, format, inlineImages);
|
|
30378
30496
|
initBb(g);
|
|
30379
30497
|
job.bb = g.info.bb;
|
|
30380
|
-
job.pad = parseGraphPad(g.attrs.get("pad"));
|
|
30498
|
+
job.pad = parseGraphPad(g.attrs.get("pad"), renderer.defaultPad ?? DEFAULT_GRAPH_PAD);
|
|
30381
30499
|
job.margin = parseGraphMargin(g.attrs.get("margin"));
|
|
30382
30500
|
const drawingSize = parseDrawingSize(g.attrs.get("size"));
|
|
30383
30501
|
const z = initJobViewportZoom(job.bb, drawingSize, job.pad);
|
|
30384
|
-
job.clip = deviceClip(g,
|
|
30502
|
+
job.clip = deviceClip(g, job);
|
|
30385
30503
|
const drawingDpi = lateDouble(
|
|
30386
30504
|
g.attrs.get("dpi"),
|
|
30387
30505
|
lateDouble(g.attrs.get("resolution"), 0, 0),
|
|
@@ -36025,7 +36143,7 @@ var BeginRegSide = class _BeginRegSide {
|
|
|
36025
36143
|
const b = endp.nb;
|
|
36026
36144
|
endp.boxes[0] = {
|
|
36027
36145
|
ll: { x: b.ll.x - 1, y: P.start.p.y },
|
|
36028
|
-
ur: { x: b.ur.x, y: n.info.coord.y + n.info.ht / 2 + ranksep / 2 }
|
|
36146
|
+
ur: { x: b.ur.x, y: n.info.coord.y + n.info.ht / 2 + Math.trunc(ranksep / 2) }
|
|
36029
36147
|
};
|
|
36030
36148
|
endp.boxes[1] = {
|
|
36031
36149
|
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 },
|
|
@@ -36037,7 +36155,7 @@ var BeginRegSide = class _BeginRegSide {
|
|
|
36037
36155
|
const b = endp.nb;
|
|
36038
36156
|
endp.boxes[0] = {
|
|
36039
36157
|
ll: { x: b.ll.x, y: P.start.p.y },
|
|
36040
|
-
ur: { x: b.ur.x + 1, y: n.info.coord.y + n.info.ht / 2 + ranksep / 2 }
|
|
36158
|
+
ur: { x: b.ur.x + 1, y: n.info.coord.y + n.info.ht / 2 + Math.trunc(ranksep / 2) }
|
|
36041
36159
|
};
|
|
36042
36160
|
endp.boxes[1] = {
|
|
36043
36161
|
ll: { x: n.info.coord.x + n.info.rw + (FUDGE - 2), y: n.info.coord.y - n.info.ht / 2 },
|
|
@@ -36098,7 +36216,7 @@ var BeginFlatSide = class _BeginFlatSide {
|
|
|
36098
36216
|
const { P, n, endp, ranksep } = ctx;
|
|
36099
36217
|
if (endp.sidemask === TOP) {
|
|
36100
36218
|
endp.boxes[0] = {
|
|
36101
|
-
ll: { x: P.start.p.x, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
36219
|
+
ll: { x: P.start.p.x, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
36102
36220
|
ur: { x: b.ur.x + 1, y: n.info.coord.y - n.info.ht / 2 }
|
|
36103
36221
|
};
|
|
36104
36222
|
endp.boxes[1] = {
|
|
@@ -36203,7 +36321,7 @@ var EndRegSide = class _EndRegSide {
|
|
|
36203
36321
|
const b = endp.nb;
|
|
36204
36322
|
if (P.end.p.x < n.info.coord.x) {
|
|
36205
36323
|
endp.boxes[0] = {
|
|
36206
|
-
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
36324
|
+
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
36207
36325
|
ur: { x: b.ur.x, y: P.end.p.y }
|
|
36208
36326
|
};
|
|
36209
36327
|
endp.boxes[1] = {
|
|
@@ -36212,7 +36330,7 @@ var EndRegSide = class _EndRegSide {
|
|
|
36212
36330
|
};
|
|
36213
36331
|
} else {
|
|
36214
36332
|
endp.boxes[0] = {
|
|
36215
|
-
ll: { x: b.ll.x, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
36333
|
+
ll: { x: b.ll.x, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
36216
36334
|
ur: { x: b.ur.x + 1, y: P.end.p.y }
|
|
36217
36335
|
};
|
|
36218
36336
|
endp.boxes[1] = {
|
|
@@ -36269,7 +36387,7 @@ var EndFlatSide = class _EndFlatSide {
|
|
|
36269
36387
|
const { P, n, endp, ranksep } = ctx;
|
|
36270
36388
|
if (endp.sidemask === TOP) {
|
|
36271
36389
|
endp.boxes[0] = {
|
|
36272
|
-
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
36390
|
+
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
36273
36391
|
ur: { x: P.end.p.x, y: n.info.coord.y - n.info.ht / 2 }
|
|
36274
36392
|
};
|
|
36275
36393
|
endp.boxes[1] = {
|
|
@@ -37654,6 +37772,7 @@ function transformf(p, del, flip) {
|
|
|
37654
37772
|
}
|
|
37655
37773
|
function cloneNode(g, orign) {
|
|
37656
37774
|
const n = agnode(g, orign.name, true);
|
|
37775
|
+
if (g !== g.root) agsubnode(g, n, true);
|
|
37657
37776
|
n.info.coord = { x: orign.info.coord.x, y: orign.info.coord.y };
|
|
37658
37777
|
n.info.lw = orign.info.lw;
|
|
37659
37778
|
n.info.rw = orign.info.rw;
|
|
@@ -39473,7 +39592,9 @@ function buildFlatAux(g, edges, cnt) {
|
|
|
39473
39592
|
const flip = g.info.flip ?? false;
|
|
39474
39593
|
const refTn = flip ? lhn : ltn;
|
|
39475
39594
|
const auxg = cloneGraph(g);
|
|
39476
|
-
const
|
|
39595
|
+
const subg = agsubg(auxg, "xxx", true);
|
|
39596
|
+
subg.attrs.set("rank", "source");
|
|
39597
|
+
const auxt = cloneNode(subg, refTn);
|
|
39477
39598
|
const auxh = cloneNode(auxg, flip ? ltn : lhn);
|
|
39478
39599
|
const alg = /* @__PURE__ */ new Map();
|
|
39479
39600
|
let hvye = null;
|
|
@@ -39582,7 +39703,6 @@ function makeFlatAdjEdges(g, edges, cnt, et) {
|
|
|
39582
39703
|
repositionFlatAux(g, edges, aux);
|
|
39583
39704
|
dotSameports(aux.auxg);
|
|
39584
39705
|
dotSplines_(aux.auxg, false);
|
|
39585
|
-
placeRegularEdgeLabels(aux.auxg);
|
|
39586
39706
|
gvPostprocess(aux.auxg);
|
|
39587
39707
|
copyFlatSplines(g, edges, aux);
|
|
39588
39708
|
cleanupCloneGraph(aux.auxg);
|
|
@@ -39686,6 +39806,35 @@ function assembleFlatPath(P, tend, hend, mid) {
|
|
|
39686
39806
|
for (let i = hend.boxn - 1; i >= 0; i--) addBox(P, hend.boxes[i]);
|
|
39687
39807
|
}
|
|
39688
39808
|
|
|
39809
|
+
// src/layout/dot/flat-adj-record.ts
|
|
39810
|
+
var MSG_FLAT_ADJ_RECORD = "flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels";
|
|
39811
|
+
var EDGEOP_DIRECTED = "->";
|
|
39812
|
+
var EDGEOP_UNDIRECTED = "--";
|
|
39813
|
+
var flatAdjRecord = { warned: false };
|
|
39814
|
+
registerRenderState(() => {
|
|
39815
|
+
flatAdjRecord.warned = false;
|
|
39816
|
+
});
|
|
39817
|
+
function isRecord(n) {
|
|
39818
|
+
return n.info.shape?.kind === 2 /* SH_RECORD */;
|
|
39819
|
+
}
|
|
39820
|
+
function edgeOp(g) {
|
|
39821
|
+
const kind = g.root.kind;
|
|
39822
|
+
return kind === "directed" || kind === "strict-directed" ? EDGEOP_DIRECTED : EDGEOP_UNDIRECTED;
|
|
39823
|
+
}
|
|
39824
|
+
function lostFlatAdjRecordEdge(g, e) {
|
|
39825
|
+
const tr = e.tail.info.rank;
|
|
39826
|
+
if (tr === void 0 || tr !== e.head.info.rank) return false;
|
|
39827
|
+
if (!isFlatAdjacent(g, e)) return false;
|
|
39828
|
+
const { tn, hn } = flatLeadPair([e]);
|
|
39829
|
+
if (!isRecord(tn) && !isRecord(hn)) return false;
|
|
39830
|
+
if (!flatAdjRecord.warned) {
|
|
39831
|
+
flatAdjRecord.warned = true;
|
|
39832
|
+
agwarningf(MSG_FLAT_ADJ_RECORD);
|
|
39833
|
+
agerr("prev", ` Edge ${tn.name} ${edgeOp(g)} ${hn.name}`);
|
|
39834
|
+
}
|
|
39835
|
+
return true;
|
|
39836
|
+
}
|
|
39837
|
+
|
|
39689
39838
|
// src/layout/dot/splines-flat-labeled.ts
|
|
39690
39839
|
var LBL_SPACE = 6;
|
|
39691
39840
|
function findLabelNode(e) {
|
|
@@ -40247,12 +40396,12 @@ function dispatchMultiRankNonForward(e, tailBox, headBox, g) {
|
|
|
40247
40396
|
if (isMultiRankFwdEdge(e)) return routeFaithfulMultiRank(e, g);
|
|
40248
40397
|
return false;
|
|
40249
40398
|
}
|
|
40250
|
-
function routeEdgeNonForward(e, g) {
|
|
40399
|
+
function routeEdgeNonForward(e, g, run) {
|
|
40251
40400
|
if (routeFaithfulAdjacentBack(e, g)) return;
|
|
40252
40401
|
const tailBox = nodeBoxOf(e.tail, g);
|
|
40253
40402
|
const headBox = nodeBoxOf(e.head, g);
|
|
40254
40403
|
if (dispatchMultiRankNonForward(e, tailBox, headBox, g)) return;
|
|
40255
|
-
if (e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank && routeFlatEdge(e, g)) return;
|
|
40404
|
+
if (e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank && routeFlatEdge(e, g, run)) return;
|
|
40256
40405
|
routeFaithfulRegularPlain(e, g);
|
|
40257
40406
|
}
|
|
40258
40407
|
function portRouteOf(e) {
|
|
@@ -40293,11 +40442,10 @@ function routeFaithfulAdjacentBack(e, g) {
|
|
|
40293
40442
|
if (swapEndsP(e)) swapEdgeSpline(e);
|
|
40294
40443
|
return true;
|
|
40295
40444
|
}
|
|
40296
|
-
function routeOneEdge(e, g) {
|
|
40445
|
+
function routeOneEdge(e, g, run) {
|
|
40297
40446
|
const dirAttr = e.attrs.get("dir") ?? defaultEdgeDir(g);
|
|
40298
|
-
const pw = edgeRenderPenwidth(e);
|
|
40299
40447
|
if (dirAttr !== "forward") {
|
|
40300
|
-
routeEdgeNonForward(e, g);
|
|
40448
|
+
routeEdgeNonForward(e, g, run);
|
|
40301
40449
|
return;
|
|
40302
40450
|
}
|
|
40303
40451
|
if (routeFaithfulAdjacentBack(e, g)) return;
|
|
@@ -40311,7 +40459,7 @@ function routeOneEdge(e, g) {
|
|
|
40311
40459
|
routeFaithfulMultiRank(e, g);
|
|
40312
40460
|
return;
|
|
40313
40461
|
}
|
|
40314
|
-
routeForwardEdge(e, g, tailBox, headBox,
|
|
40462
|
+
routeForwardEdge(e, g, tailBox, headBox, run);
|
|
40315
40463
|
}
|
|
40316
40464
|
function routeFaithfulMultiRank(e, g) {
|
|
40317
40465
|
const pts = routeMultiRankEdgeFaithful(g, e);
|
|
@@ -40337,22 +40485,19 @@ function isAdjacentPortFlat(e, g) {
|
|
|
40337
40485
|
function isGroupableFlat(x, g) {
|
|
40338
40486
|
return !routedThisPass(x) && x.tail.info.rank !== void 0 && x.tail.info.rank === x.head.info.rank && isFlatAdjacent(g, x);
|
|
40339
40487
|
}
|
|
40340
|
-
function joinsPortedFlatGroup(e, g) {
|
|
40341
|
-
return isAdjFlatCandidate(e) && isGroupableFlat(e, g) && collectAdjacentFlatGroup(e, g).some(hasDefinedPort);
|
|
40488
|
+
function joinsPortedFlatGroup(e, g, run) {
|
|
40489
|
+
return isAdjFlatCandidate(e) && isGroupableFlat(e, g) && collectAdjacentFlatGroup(e, g, run).some(hasDefinedPort);
|
|
40342
40490
|
}
|
|
40343
|
-
function collectAdjacentFlatGroup(e, g) {
|
|
40491
|
+
function collectAdjacentFlatGroup(e, g, run) {
|
|
40344
40492
|
const u = e.tail, v = e.head;
|
|
40345
|
-
const lo = (u.info.order ?? 0) <= (v.info.order ?? 0) ? u : v;
|
|
40346
40493
|
const me = getMainEdge(e);
|
|
40347
40494
|
const sharesPair = (x) => x.tail === u && x.head === v || x.tail === v && x.head === u;
|
|
40348
|
-
|
|
40349
|
-
group.sort((a, b) => Number(b.tail === lo) - Number(a.tail === lo) || a.seq - b.seq);
|
|
40350
|
-
return group;
|
|
40495
|
+
return run.filter((x) => sharesPair(x) && isGroupableFlat(x, g) && getMainEdge(x) === me);
|
|
40351
40496
|
}
|
|
40352
|
-
function routeFaithfulSidePort(e, g) {
|
|
40497
|
+
function routeFaithfulSidePort(e, g, run) {
|
|
40353
40498
|
const sameRank = e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank;
|
|
40354
40499
|
if (sameRank && isFlatAdjacent(g, e)) {
|
|
40355
|
-
const group = collectAdjacentFlatGroup(e, g);
|
|
40500
|
+
const group = collectAdjacentFlatGroup(e, g, run);
|
|
40356
40501
|
return makeFlatAdjEdges(g, group, group.length, edgeType(g)) === 0 && routedThisPass(e);
|
|
40357
40502
|
}
|
|
40358
40503
|
if (sameRank) {
|
|
@@ -40368,27 +40513,20 @@ function routeFaithfulSidePort(e, g) {
|
|
|
40368
40513
|
clipAndInstall(e, e.head, pts, pts.length, buildDotSinfo());
|
|
40369
40514
|
return true;
|
|
40370
40515
|
}
|
|
40371
|
-
function
|
|
40372
|
-
|
|
40373
|
-
if (tr === void 0 || tr !== e.head.info.rank) return false;
|
|
40374
|
-
if (!isFlatAdjacent(g, e)) return false;
|
|
40375
|
-
const rec = (s) => s?.kind === 2 /* SH_RECORD */;
|
|
40376
|
-
return rec(e.tail.info.shape) || rec(e.head.info.shape);
|
|
40377
|
-
}
|
|
40378
|
-
function routeFlatEdge(e, g) {
|
|
40379
|
-
if (isLostFlatAdjRecordEdge(g, e)) return true;
|
|
40516
|
+
function routeFlatEdge(e, g, run) {
|
|
40517
|
+
if (lostFlatAdjRecordEdge(g, e)) return true;
|
|
40380
40518
|
if (makeFlatLabeledEdge(g, e)) return true;
|
|
40381
|
-
if (joinsPortedFlatGroup(e, g) && routeFaithfulSidePort(e, g)) return true;
|
|
40519
|
+
if (joinsPortedFlatGroup(e, g, run) && routeFaithfulSidePort(e, g, run)) return true;
|
|
40382
40520
|
if (makeAdjFlatNoPortEdge(g, e)) return true;
|
|
40383
|
-
if ((hasSidePort(e) || isAdjacentPortFlat(e, g)) && routeFaithfulSidePort(e, g)) return true;
|
|
40521
|
+
if ((hasSidePort(e) || isAdjacentPortFlat(e, g)) && routeFaithfulSidePort(e, g, run)) return true;
|
|
40384
40522
|
if (e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank && e.info.label === void 0 && !isFlatAdjacent(g, e)) {
|
|
40385
40523
|
const group = collectNonAdjacentFlatGroup(e, g);
|
|
40386
40524
|
if (group.length > 0 && routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g)) && routedThisPass(e)) return true;
|
|
40387
40525
|
}
|
|
40388
40526
|
return false;
|
|
40389
40527
|
}
|
|
40390
|
-
function routeForwardEdge(e, g, tailBox, headBox,
|
|
40391
|
-
if (routeFlatEdge(e, g)) return;
|
|
40528
|
+
function routeForwardEdge(e, g, tailBox, headBox, run) {
|
|
40529
|
+
if (routeFlatEdge(e, g, run)) return;
|
|
40392
40530
|
if (routeFaithfulRegularPlain(e, g)) return;
|
|
40393
40531
|
const rankInfo = rankEdgeInfoOf(g, e.tail, e.head);
|
|
40394
40532
|
const result = straightEdgeSplineWithRank(
|
|
@@ -40399,15 +40537,21 @@ function routeForwardEdge(e, g, tailBox, headBox, pw) {
|
|
|
40399
40537
|
portRouteOf(e)
|
|
40400
40538
|
);
|
|
40401
40539
|
installEdgeSpline(e, result.bezierPts, result.arrowTip);
|
|
40402
|
-
e.info.headArrowOps = arrowDrawOpsForEnd(
|
|
40540
|
+
e.info.headArrowOps = arrowDrawOpsForEnd(
|
|
40541
|
+
e,
|
|
40542
|
+
"head",
|
|
40543
|
+
result.arrowTip,
|
|
40544
|
+
result.arrowDir,
|
|
40545
|
+
edgeRenderPenwidth(e)
|
|
40546
|
+
);
|
|
40403
40547
|
}
|
|
40404
|
-
function routeLoneEdge(e, g) {
|
|
40548
|
+
function routeLoneEdge(e, g, run) {
|
|
40405
40549
|
if (routedThisPass(e) || e.info.lost === true) return;
|
|
40406
40550
|
const et = e.info.edge_type ?? 0;
|
|
40407
40551
|
if (et === FLATORDER || et === IGNORED) return;
|
|
40408
40552
|
if (e.tail === e.head) return;
|
|
40409
40553
|
if (!hasValidCoords(e)) return;
|
|
40410
|
-
routeOneEdge(e, g);
|
|
40554
|
+
routeOneEdge(e, g, run);
|
|
40411
40555
|
}
|
|
40412
40556
|
|
|
40413
40557
|
// src/common/arrows-geometry.ts
|
|
@@ -40658,7 +40802,7 @@ function dispatchEdgeGroup(g, group, ctx) {
|
|
|
40658
40802
|
}
|
|
40659
40803
|
const uniq = dedupByOrig(group);
|
|
40660
40804
|
if (nodeRankOf(e0.tail) === nodeRankOf(e0.head)) {
|
|
40661
|
-
for (const e of uniq) routeLoneEdge(e, g);
|
|
40805
|
+
for (const e of uniq) routeLoneEdge(e, g, uniq);
|
|
40662
40806
|
return;
|
|
40663
40807
|
}
|
|
40664
40808
|
if (uniq.length <= 1) {
|
|
@@ -40668,7 +40812,7 @@ function dispatchEdgeGroup(g, group, ctx) {
|
|
|
40668
40812
|
return;
|
|
40669
40813
|
}
|
|
40670
40814
|
const lone = resolveOrigEdge(uniq[0]);
|
|
40671
|
-
routeLoneEdge(lone, g);
|
|
40815
|
+
routeLoneEdge(lone, g, uniq);
|
|
40672
40816
|
return;
|
|
40673
40817
|
}
|
|
40674
40818
|
routeParallelEdgeGroup(g, uniq, ctx.multisep);
|
|
@@ -43506,7 +43650,7 @@ function sgdIteration(pos, terms, unfixed, eta) {
|
|
|
43506
43650
|
const mu2 = Math.min(eta * t.w, 1);
|
|
43507
43651
|
const dx = pos[2 * t.i] - pos[2 * t.j];
|
|
43508
43652
|
const dy = pos[2 * t.i + 1] - pos[2 * t.j + 1];
|
|
43509
|
-
const mag =
|
|
43653
|
+
const mag = libmHypot(dx, dy);
|
|
43510
43654
|
if (mag === 0) continue;
|
|
43511
43655
|
const r = mu2 * (mag - t.d) / (2 * mag);
|
|
43512
43656
|
const rx = r * dx;
|
|
@@ -44645,7 +44789,7 @@ function kkNeato(g, nG, model) {
|
|
|
44645
44789
|
// src/layout/neato/conjgrad-mkernel.ts
|
|
44646
44790
|
var fr3 = Math.fround;
|
|
44647
44791
|
var RIGHT_MULT_BLOCK = 16;
|
|
44648
|
-
var ZERO_LENGTH_MESSAGE = "conjugate_gradient: unexpected length 0 vector
|
|
44792
|
+
var ZERO_LENGTH_MESSAGE = "conjugate_gradient: unexpected length 0 vector";
|
|
44649
44793
|
function rightMultWithVectorFFFused(m, n, vector, result) {
|
|
44650
44794
|
for (let i = 0; i < n; i++) result[i] = 0;
|
|
44651
44795
|
let index = 0;
|
|
@@ -56723,7 +56867,7 @@ function getEdgeList(n, g) {
|
|
|
56723
56867
|
const m = e.head === n ? e.tail : e.head;
|
|
56724
56868
|
const dx = m.info.pos[0] - n.info.pos[0];
|
|
56725
56869
|
const dy = m.info.pos[1] - n.info.pos[1];
|
|
56726
|
-
erecs.push({ e, alpha: Math.atan2(dy, dx), dist2: dx
|
|
56870
|
+
erecs.push({ e, alpha: Math.atan2(dy, dx), dist2: fma(dx, dx, dy * dy) });
|
|
56727
56871
|
}
|
|
56728
56872
|
if (erecs.length !== deg) {
|
|
56729
56873
|
throw new InternalError(`fdp getEdgeList: ${erecs.length} edges vs deg ${deg}`);
|
|
@@ -56738,7 +56882,13 @@ function genPorts(n, er, pp, idx, bnd) {
|
|
|
56738
56882
|
const other = e.head === n ? e.tail : e.head;
|
|
56739
56883
|
const delta2 = Math.min((bnd - er.alpha) / cnt, ANG);
|
|
56740
56884
|
const fwd = n.id < other.id;
|
|
56741
|
-
const fan = fwd ? { i: idx, inc: 1, angle: er.alpha, delta: delta2 } : {
|
|
56885
|
+
const fan = fwd ? { i: idx, inc: 1, angle: er.alpha, delta: delta2 } : {
|
|
56886
|
+
// contracted (-ffp-contract=on): angle += delta * (cnt - 1) is one fmadd
|
|
56887
|
+
i: idx + cnt - 1,
|
|
56888
|
+
inc: -1,
|
|
56889
|
+
angle: fma(delta2, cnt - 1, er.alpha),
|
|
56890
|
+
delta: -delta2
|
|
56891
|
+
};
|
|
56742
56892
|
fillPorts(n, e, pp, fan);
|
|
56743
56893
|
return idx + cnt;
|
|
56744
56894
|
}
|
|
@@ -59963,6 +60113,8 @@ function mapOutputImap(shape, pts, url, out) {
|
|
|
59963
60113
|
var PlainRenderer = class {
|
|
59964
60114
|
type = "plain";
|
|
59965
60115
|
quality = 0;
|
|
60116
|
+
defaultPad = 0;
|
|
60117
|
+
// @see plugin/core/gvrender_core_dot.c:734 render_features_dot
|
|
59966
60118
|
beginGraph(_g, _job) {
|
|
59967
60119
|
}
|
|
59968
60120
|
endGraph(g, job) {
|
|
@@ -59990,6 +60142,8 @@ var PlainRenderer = class {
|
|
|
59990
60142
|
var PlainExtRenderer = class {
|
|
59991
60143
|
type = "plain-ext";
|
|
59992
60144
|
quality = 0;
|
|
60145
|
+
defaultPad = 0;
|
|
60146
|
+
// @see plugin/core/gvrender_core_dot.c:734 render_features_dot
|
|
59993
60147
|
beginGraph(_g, _job) {
|
|
59994
60148
|
}
|
|
59995
60149
|
endGraph(g, job) {
|
|
@@ -60041,6 +60195,7 @@ function anchorOf(url, tooltip, target, id) {
|
|
|
60041
60195
|
}
|
|
60042
60196
|
var MapRendererBase = class {
|
|
60043
60197
|
quality = 0;
|
|
60198
|
+
defaultPad = 4;
|
|
60044
60199
|
mapCtx = null;
|
|
60045
60200
|
beginGraph(g, job) {
|
|
60046
60201
|
job.flags |= EMIT_CLUSTERS_LAST;
|
|
@@ -60195,8 +60350,6 @@ function createCmapxNpRenderer() {
|
|
|
60195
60350
|
|
|
60196
60351
|
// src/render/dot/xdot-ops.ts
|
|
60197
60352
|
var XDOT_VERSION = "1.7";
|
|
60198
|
-
var MAX_NEGNUM = 1e15;
|
|
60199
|
-
var NEAR_ZERO = 5e-3;
|
|
60200
60353
|
var NUM_XBUFS = 8;
|
|
60201
60354
|
var NON_LINE_STYLES = /* @__PURE__ */ new Set([
|
|
60202
60355
|
"filled",
|
|
@@ -60209,24 +60362,6 @@ var NON_LINE_STYLES = /* @__PURE__ */ new Set([
|
|
|
60209
60362
|
"invisible",
|
|
60210
60363
|
"radial"
|
|
60211
60364
|
]);
|
|
60212
|
-
function trimAndStrip(s) {
|
|
60213
|
-
const dot = s.indexOf(".");
|
|
60214
|
-
if (dot < 0) return s;
|
|
60215
|
-
let end = s.length;
|
|
60216
|
-
while (end > dot + 1 && s[end - 1] === "0") end--;
|
|
60217
|
-
if (s[end - 1] === ".") end--;
|
|
60218
|
-
const t = s.slice(0, end);
|
|
60219
|
-
if (t.startsWith("0.")) return t.slice(1);
|
|
60220
|
-
if (t.startsWith("-0.")) return "-" + t.slice(2);
|
|
60221
|
-
return t;
|
|
60222
|
-
}
|
|
60223
|
-
function printNum(n) {
|
|
60224
|
-
if (Math.abs(n) > MAX_NEGNUM) {
|
|
60225
|
-
return n < 0 ? String(-MAX_NEGNUM) : String(MAX_NEGNUM);
|
|
60226
|
-
}
|
|
60227
|
-
if (Math.abs(n) < NEAR_ZERO) return "0";
|
|
60228
|
-
return trimAndStrip(n.toFixed(3));
|
|
60229
|
-
}
|
|
60230
60365
|
function makeXbufs() {
|
|
60231
60366
|
const bufs = Array.from({ length: NUM_XBUFS + 4 }, () => []);
|
|
60232
60367
|
bufs[8 /* NDraw */] = bufs[1 /* CDraw */];
|
|
@@ -60320,11 +60455,9 @@ function xdotStrOp(prefix, s) {
|
|
|
60320
60455
|
return prefix + String(utf8Len(s)) + " -" + s + " ";
|
|
60321
60456
|
}
|
|
60322
60457
|
function xdotId(s) {
|
|
60323
|
-
if (
|
|
60324
|
-
|
|
60325
|
-
|
|
60326
|
-
const trailingBackslashes = /\\*$/.exec(body)[0].length;
|
|
60327
|
-
return '"' + body + (trailingBackslashes % 2 === 1 ? "\\" : "") + '"';
|
|
60458
|
+
if (isHtmlValue(s)) return agstrcanon(s);
|
|
60459
|
+
const oddTrailingRun = /\\*$/.exec(s)[0].length % 2 === 1;
|
|
60460
|
+
return agstrcanon(oddTrailingRun ? `${s}\\` : s);
|
|
60328
60461
|
}
|
|
60329
60462
|
function gfmt5(v) {
|
|
60330
60463
|
if (!Number.isFinite(v)) return printfSig(v, 5);
|
|
@@ -60349,27 +60482,6 @@ function lpStr(p) {
|
|
|
60349
60482
|
function escBackslash(s) {
|
|
60350
60483
|
return s.replace(/\\/g, "\\\\");
|
|
60351
60484
|
}
|
|
60352
|
-
function isEscapeSeq(s, i) {
|
|
60353
|
-
if (s[i] !== "\\") return false;
|
|
60354
|
-
const n = s[i + 1];
|
|
60355
|
-
return n === "E" || n === "G" || n === "H" || n === "L" || n === "N" || n === "T" || n === "l" || n === "n" || n === "r" || n === "\\" || n === '"';
|
|
60356
|
-
}
|
|
60357
|
-
function agcanonEscape(s) {
|
|
60358
|
-
let out = "";
|
|
60359
|
-
let partOfEscape = false;
|
|
60360
|
-
for (let i = 0; i < s.length; i++) {
|
|
60361
|
-
const c = s[i];
|
|
60362
|
-
if (c === '"' && !partOfEscape) {
|
|
60363
|
-
out += "\\";
|
|
60364
|
-
} else if (!partOfEscape && isEscapeSeq(s, i)) {
|
|
60365
|
-
partOfEscape = true;
|
|
60366
|
-
} else {
|
|
60367
|
-
partOfEscape = false;
|
|
60368
|
-
}
|
|
60369
|
-
out += c;
|
|
60370
|
-
}
|
|
60371
|
-
return out;
|
|
60372
|
-
}
|
|
60373
60485
|
function trimFixed3(v) {
|
|
60374
60486
|
let s = v.toFixed(3);
|
|
60375
60487
|
if (s.indexOf(".") < 0) return s;
|
|
@@ -60515,7 +60627,7 @@ function nodeDictParts(g, top) {
|
|
|
60515
60627
|
function echoAttr(attrs, key) {
|
|
60516
60628
|
const v = attrs.get(key);
|
|
60517
60629
|
if (v === void 0 || v.length === 0) return [];
|
|
60518
|
-
return [key
|
|
60630
|
+
return [`${key}=${agstrcanon(v)}`];
|
|
60519
60631
|
}
|
|
60520
60632
|
function writeDictSkips(v, inherited) {
|
|
60521
60633
|
return v.length === 0 && inherited === "";
|
|
@@ -60524,7 +60636,7 @@ function echoGraphAttr(g, key) {
|
|
|
60524
60636
|
const v = g.attrs.get(key);
|
|
60525
60637
|
if (v === void 0) return [];
|
|
60526
60638
|
if (writeDictSkips(v, g.graphDefaultsSnapshot?.get(key))) return [];
|
|
60527
|
-
return [key
|
|
60639
|
+
return [`${key}=${agstrcanon(v)}`];
|
|
60528
60640
|
}
|
|
60529
60641
|
function graphLabelAttrs(g) {
|
|
60530
60642
|
const label = g.info.label;
|
|
@@ -60618,9 +60730,13 @@ var DotWriterBase = class {
|
|
|
60618
60730
|
for (const sub of g.subgraphs.values()) ix0 = this.subgdfs(sub, ix0, preorder);
|
|
60619
60731
|
return ix0 + 1;
|
|
60620
60732
|
}
|
|
60621
|
-
/** A
|
|
60733
|
+
/** A graph is anonymous when `agnameof` gives a `%` local name: a nameless
|
|
60734
|
+
* root (`%1`), a nameless subgraph (the parser names it `%N`), or a name
|
|
60735
|
+
* that itself starts with `%`. A graph named `""` is named: cgraph maps `""`
|
|
60736
|
+
* as a name, so it keeps its header and is never inlined.
|
|
60737
|
+
* @see write.c:is_anonymous ; write.c:write_hdr ; lib/cgraph/id.c:idmap */
|
|
60622
60738
|
isAnonymous(g) {
|
|
60623
|
-
return g.
|
|
60739
|
+
return agNameOf(g).startsWith(LOCALNAMEPREFIX);
|
|
60624
60740
|
}
|
|
60625
60741
|
/** A graph carries a `bb` attribute when it is the root or has a layout bb
|
|
60626
60742
|
* (clusters, and any subgraph output.c computed a box for). Native seeds `bb`
|
|
@@ -60673,7 +60789,7 @@ var DotWriterBase = class {
|
|
|
60673
60789
|
if (top) {
|
|
60674
60790
|
const strict = g.kind === "strict-directed" || g.kind === "strict-undirected" ? "strict " : "";
|
|
60675
60791
|
const kw = isDirected(g) ? "digraph" : "graph";
|
|
60676
|
-
const nm =
|
|
60792
|
+
const nm = this.isAnonymous(g) ? "" : xdotId(g.name) + " ";
|
|
60677
60793
|
ctx.out.push(strict + kw + " " + nm + "{\n");
|
|
60678
60794
|
ctx.level++;
|
|
60679
60795
|
} else {
|
|
@@ -61126,12 +61242,21 @@ var EdgeDrawBase = class extends DotWriterBase {
|
|
|
61126
61242
|
|
|
61127
61243
|
// src/render/dot/write-back.ts
|
|
61128
61244
|
var POINTS_PER_INCH15 = 72;
|
|
61245
|
+
function nodeLayoutAttrs(n) {
|
|
61246
|
+
const info = n.info;
|
|
61247
|
+
return {
|
|
61248
|
+
pos: nodePosRaw(n),
|
|
61249
|
+
height: gfmt5(info.ht / POINTS_PER_INCH15),
|
|
61250
|
+
width: gfmt5((info.lw + info.rw) / POINTS_PER_INCH15)
|
|
61251
|
+
};
|
|
61252
|
+
}
|
|
61129
61253
|
function attachNode(n) {
|
|
61130
61254
|
const attrs = ownAttrs(n);
|
|
61131
61255
|
const info = n.info;
|
|
61132
|
-
|
|
61133
|
-
attrs.set("
|
|
61134
|
-
attrs.set("
|
|
61256
|
+
const layout2 = nodeLayoutAttrs(n);
|
|
61257
|
+
attrs.set("pos", layout2.pos);
|
|
61258
|
+
attrs.set("height", layout2.height);
|
|
61259
|
+
attrs.set("width", layout2.width);
|
|
61135
61260
|
const xlabel = info.xlabel;
|
|
61136
61261
|
if (xlabel?.set) attrs.set("xlp", lpStr(xlabel.pos));
|
|
61137
61262
|
if (info.shape?.name === "record") {
|
|
@@ -61223,6 +61348,8 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
61223
61348
|
type = "xdot";
|
|
61224
61349
|
/** @see plugin/core/gvplugin_core.c registration table */
|
|
61225
61350
|
quality = 0;
|
|
61351
|
+
/** `-Tdot` too (`:734`). @see plugin/core/gvrender_core_dot.c:745 render_features_xdot */
|
|
61352
|
+
defaultPad = 0;
|
|
61226
61353
|
/**
|
|
61227
61354
|
* Whether this format attaches the xdot draw attributes before agwrite.
|
|
61228
61355
|
* Mirrors C's `job->render.id` switch: FORMAT_DOT runs `attach_attrs(g)` then
|
|
@@ -61254,8 +61381,8 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
61254
61381
|
this.draws = /* @__PURE__ */ new Map();
|
|
61255
61382
|
this.clusters = [];
|
|
61256
61383
|
}
|
|
61257
|
-
/**
|
|
61258
|
-
*
|
|
61384
|
+
/** This render's draw strings by ORIGINAL object. `-Tjson` lays them over the re-parsed xdot text,
|
|
61385
|
+
* which cannot represent draw text containing `"` (id 2239); stored strings reach it by that text. */
|
|
61259
61386
|
drawStringsByObject() {
|
|
61260
61387
|
return this.draws;
|
|
61261
61388
|
}
|
|
@@ -61279,7 +61406,7 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
61279
61406
|
const bg = g.attrs.get("bgcolor");
|
|
61280
61407
|
let fillSpec = bg !== void 0 && bg !== "" ? bg : "white";
|
|
61281
61408
|
if (fillSpec === "transparent") fillSpec = "white";
|
|
61282
|
-
const c = deviceClip(g,
|
|
61409
|
+
const c = deviceClip(g, job);
|
|
61283
61410
|
const corners = [
|
|
61284
61411
|
{ x: c.ll.x, y: c.ll.y },
|
|
61285
61412
|
{ x: c.ll.x, y: c.ur.y },
|
|
@@ -61606,6 +61733,8 @@ var SvgRenderer = class {
|
|
|
61606
61733
|
type = "svg";
|
|
61607
61734
|
/** @see plugin/core/gvplugin_core.c registration table */
|
|
61608
61735
|
quality = 0;
|
|
61736
|
+
/** @see plugin/core/gvrender_core_svg.c:810 render_features_svg (default pad) */
|
|
61737
|
+
defaultPad = SVG_PAD;
|
|
61609
61738
|
/** Whether the current edge's <g> group was opened (deferred-emit state). */
|
|
61610
61739
|
edgeGroupOpen = false;
|
|
61611
61740
|
beginGraph(g, job) {
|
|
@@ -61642,7 +61771,7 @@ var SvgRenderer = class {
|
|
|
61642
61771
|
/**
|
|
61643
61772
|
* Close the edge group. Edge graphics (path + arrowhead) are emitted here
|
|
61644
61773
|
* because the full spline is available on e.info.spl only after layout has
|
|
61645
|
-
*
|
|
61774
|
+
* routed the edges.
|
|
61646
61775
|
*
|
|
61647
61776
|
* For multi-color edges (color="c1:c2:…"), emits parallel offset Béziers
|
|
61648
61777
|
* (one per color, SEP=2.0 apart) then arrows in headcolor/tailcolor.
|
|
@@ -61771,8 +61900,50 @@ function attachBeforeWriteWithClusterEdges(g, attach) {
|
|
|
61771
61900
|
function jsonNodes(g) {
|
|
61772
61901
|
return [...g.nodes.values()].filter((n) => !n.info.clustnode);
|
|
61773
61902
|
}
|
|
61774
|
-
function
|
|
61775
|
-
return
|
|
61903
|
+
function lookupCluster(map, name) {
|
|
61904
|
+
return map.get(name) ?? -1;
|
|
61905
|
+
}
|
|
61906
|
+
function insertCluster(map, name, v) {
|
|
61907
|
+
const ip = map.get(name);
|
|
61908
|
+
if (ip !== void 0) {
|
|
61909
|
+
if (ip !== v) agwarningf(`Duplicate cluster name "${name}"`);
|
|
61910
|
+
return;
|
|
61911
|
+
}
|
|
61912
|
+
map.set(name, v);
|
|
61913
|
+
}
|
|
61914
|
+
function labelSubgs(g, lbl, map, out) {
|
|
61915
|
+
if (g !== g.root) {
|
|
61916
|
+
const gid = lbl++;
|
|
61917
|
+
out.push(g);
|
|
61918
|
+
if (isACluster(g)) insertCluster(map, g.name, gid);
|
|
61919
|
+
}
|
|
61920
|
+
for (const [, sg] of g.subgraphs) lbl = labelSubgs(sg, lbl, map, out);
|
|
61921
|
+
return lbl;
|
|
61922
|
+
}
|
|
61923
|
+
|
|
61924
|
+
// src/render/json-nonfinite.ts
|
|
61925
|
+
var JSON_INDENT = 2;
|
|
61926
|
+
var INF_TOKEN = "inf";
|
|
61927
|
+
var NEG_INF_TOKEN = "-inf";
|
|
61928
|
+
var NAN_TOKEN = "nan";
|
|
61929
|
+
var MARK = "\0";
|
|
61930
|
+
var ESCAPED_MARK = JSON.stringify(MARK).slice(1, -1).replace(/\\/g, "\\\\");
|
|
61931
|
+
var QUOTED_TOKEN = new RegExp(
|
|
61932
|
+
`"${ESCAPED_MARK}(${INF_TOKEN}|${NEG_INF_TOKEN}|${NAN_TOKEN})${ESCAPED_MARK}"`,
|
|
61933
|
+
"g"
|
|
61934
|
+
);
|
|
61935
|
+
function nonFiniteToken(v) {
|
|
61936
|
+
if (Number.isNaN(v)) return NAN_TOKEN;
|
|
61937
|
+
return v > 0 ? INF_TOKEN : NEG_INF_TOKEN;
|
|
61938
|
+
}
|
|
61939
|
+
function stringifyJsonTree(tree) {
|
|
61940
|
+
let sawNonFinite = false;
|
|
61941
|
+
const text = JSON.stringify(tree, (_key, v) => {
|
|
61942
|
+
if (typeof v !== "number" || Number.isFinite(v)) return v;
|
|
61943
|
+
sawNonFinite = true;
|
|
61944
|
+
return `${MARK}${nonFiniteToken(v)}${MARK}`;
|
|
61945
|
+
}, JSON_INDENT);
|
|
61946
|
+
return sawNonFinite ? text.replace(QUOTED_TOKEN, "$1") : text;
|
|
61776
61947
|
}
|
|
61777
61948
|
|
|
61778
61949
|
// src/render/json.ts
|
|
@@ -61957,21 +62128,16 @@ function isEdgeLabelDeclared(g) {
|
|
|
61957
62128
|
};
|
|
61958
62129
|
return walk(g);
|
|
61959
62130
|
}
|
|
61960
|
-
function dfsSubgraphs(g, out) {
|
|
61961
|
-
for (const [, sg] of g.subgraphs) {
|
|
61962
|
-
out.push(sg);
|
|
61963
|
-
dfsSubgraphs(sg, out);
|
|
61964
|
-
}
|
|
61965
|
-
}
|
|
61966
62131
|
function assignIds(g, doXDot, draws) {
|
|
61967
62132
|
const dfsSubs = [];
|
|
61968
|
-
|
|
62133
|
+
const clusters = /* @__PURE__ */ new Map();
|
|
62134
|
+
const sgcnt = labelSubgs(g, 0, clusters, dfsSubs);
|
|
61969
62135
|
const subgGid = /* @__PURE__ */ new Map();
|
|
61970
62136
|
dfsSubs.forEach((sg, i) => subgGid.set(sg, i));
|
|
61971
|
-
|
|
62137
|
+
if (dfsSubs[0] === g) dfsSubs.shift();
|
|
61972
62138
|
const nodeGid = /* @__PURE__ */ new Map();
|
|
61973
62139
|
let ncnt = 0;
|
|
61974
|
-
for (const [, n] of g.nodes) nodeGid.set(n, n.info.clustnode ?
|
|
62140
|
+
for (const [, n] of g.nodes) nodeGid.set(n, n.info.clustnode ? lookupCluster(clusters, n.name) : sgcnt + ncnt++);
|
|
61975
62141
|
const edgeGid = /* @__PURE__ */ new Map();
|
|
61976
62142
|
let ecnt = 0;
|
|
61977
62143
|
for (const { e } of canonicalRootEdges(g)) edgeGid.set(e, ecnt++);
|
|
@@ -62060,9 +62226,8 @@ function buildNodeObject(n, ctx) {
|
|
|
62060
62226
|
const eff = nodeEffectiveAttrs(n);
|
|
62061
62227
|
const xd = ctx.draws?.node.get(n.name);
|
|
62062
62228
|
if (xd === void 0) {
|
|
62063
|
-
|
|
62064
|
-
eff.set("
|
|
62065
|
-
eff.set("height", printNum(n.info.height));
|
|
62229
|
+
const layout2 = nodeLayoutAttrs(n);
|
|
62230
|
+
eff.set("pos", layout2.pos).set("width", layout2.width).set("height", layout2.height);
|
|
62066
62231
|
}
|
|
62067
62232
|
emitAttrs(o, eff, xd, ctx);
|
|
62068
62233
|
attachNodeRects(o, n);
|
|
@@ -62145,11 +62310,13 @@ function latin1Reencode(s) {
|
|
|
62145
62310
|
function buildJson(g, doXDot, preDraws) {
|
|
62146
62311
|
const draws = doXDot ? preDraws ?? collectDrawLookup(g) : void 0;
|
|
62147
62312
|
const ctx = assignIds(g, doXDot, draws);
|
|
62148
|
-
return
|
|
62313
|
+
return stringifyJsonTree(buildGraphObject(g, true, ctx)) + "\n";
|
|
62149
62314
|
}
|
|
62150
62315
|
var JsonRendererBase = class {
|
|
62151
62316
|
/** @see plugin/core/gvplugin_core.c registration table */
|
|
62152
62317
|
quality = 0;
|
|
62318
|
+
/** @see plugin/core/gvrender_core_json.c:745 render_features_json (default pad) */
|
|
62319
|
+
defaultPad = 0;
|
|
62153
62320
|
beginNode(_n, _job) {
|
|
62154
62321
|
}
|
|
62155
62322
|
endNode(_n, _job) {
|
|
@@ -62442,7 +62609,7 @@ function resolveKind(opts) {
|
|
|
62442
62609
|
}
|
|
62443
62610
|
function createGraph(opts) {
|
|
62444
62611
|
requireGraphOptions(opts);
|
|
62445
|
-
const g = new Graph(opts?.name ?? "", resolveKind(opts));
|
|
62612
|
+
const g = new Graph(opts?.name ?? "", resolveKind(opts), opts?.name === void 0);
|
|
62446
62613
|
return new GraphBuilder(g, g);
|
|
62447
62614
|
}
|
|
62448
62615
|
|