@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/render.js
CHANGED
|
@@ -157,6 +157,7 @@ function makePort() {
|
|
|
157
157
|
name: null
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
+
var AUX_EDGE_PORT = Object.freeze({ ...makePort(), p: Object.freeze({ x: 0, y: 0 }) });
|
|
160
161
|
function makeEdgeInfo(tailPort, headPort) {
|
|
161
162
|
return {
|
|
162
163
|
tail_port: tailPort,
|
|
@@ -252,14 +253,19 @@ var Edge = class _Edge {
|
|
|
252
253
|
* @see lib/cgraph/cgraph.h:agbindrec
|
|
253
254
|
*/
|
|
254
255
|
info;
|
|
255
|
-
/**
|
|
256
|
-
|
|
256
|
+
/**
|
|
257
|
+
* `auxPorts` is for dot's auxiliary edges only: both ends take the shared
|
|
258
|
+
* {@link AUX_EDGE_PORT} in place of a private port each.
|
|
259
|
+
* @see lib/cgraph/edge.c:agedge
|
|
260
|
+
* @see lib/dotgen/position.c:make_aux_edge
|
|
261
|
+
*/
|
|
262
|
+
constructor(tail, head, name, lazyAttrs = false, auxPorts = false) {
|
|
257
263
|
this.seq = _Edge._nextSeq++;
|
|
258
264
|
this.tail = tail;
|
|
259
265
|
this.head = head;
|
|
260
266
|
this.name = name;
|
|
261
267
|
this.attrs = lazyAttrs ? EMPTY_ATTRS : /* @__PURE__ */ new Map();
|
|
262
|
-
this.info = makeEdgeInfo(makePort(), makePort());
|
|
268
|
+
this.info = auxPorts ? makeEdgeInfo(AUX_EDGE_PORT, AUX_EDGE_PORT) : makeEdgeInfo(makePort(), makePort());
|
|
263
269
|
}
|
|
264
270
|
};
|
|
265
271
|
|
|
@@ -310,9 +316,10 @@ var Graph = class {
|
|
|
310
316
|
* True when the graph was declared with NO name (`digraph {`), as opposed to
|
|
311
317
|
* an explicit empty name (`digraph "" {`). Both store `name === ''`, but
|
|
312
318
|
* cgraph gives the truly-anonymous root the internal id `%1` (agnameof) while
|
|
313
|
-
* the empty-named one keeps `""`.
|
|
314
|
-
*
|
|
315
|
-
*
|
|
319
|
+
* the empty-named one keeps `""`. Read through `agNameOf` by the imagemap
|
|
320
|
+
* `<map id/name>`, the neato messages and the dot/xdot writer's header,
|
|
321
|
+
* which prints `digraph {` for an anonymous root and `digraph "" {` for the
|
|
322
|
+
* empty-named one. `name` stays `''` for both.
|
|
316
323
|
* @see lib/cgraph/id.c:idmap (anon → `%1`) ; lib/cgraph/agraph.c:agnameof
|
|
317
324
|
*/
|
|
318
325
|
anonymous;
|
|
@@ -963,11 +970,115 @@ function agerrFinished(line, channel) {
|
|
|
963
970
|
// src/xdot/types.ts
|
|
964
971
|
var XDOT_PARSE_ERROR = 1;
|
|
965
972
|
|
|
973
|
+
// src/xdot/strtod.ts
|
|
974
|
+
var INF_WORD = "inf";
|
|
975
|
+
var INF_TAIL = "inity";
|
|
976
|
+
var NAN_WORD = "nan";
|
|
977
|
+
var SIGNIFICAND_BITS = 53;
|
|
978
|
+
var MIN_SUBNORMAL_EXP = -1074;
|
|
979
|
+
var MAX_BINARY_EXP = 1023;
|
|
980
|
+
var MIN_NORMAL_EXP = -1022;
|
|
981
|
+
var EXP_BIAS = 1023;
|
|
982
|
+
var FRACTION_SCALE = 2n ** 52n;
|
|
983
|
+
var HEX_DIGIT_BITS = 4n;
|
|
984
|
+
function isSpace(c) {
|
|
985
|
+
return c === " " || c >= " " && c <= "\r";
|
|
986
|
+
}
|
|
987
|
+
function isDecDigit(c) {
|
|
988
|
+
return c >= "0" && c <= "9";
|
|
989
|
+
}
|
|
990
|
+
function isHexDigit(c) {
|
|
991
|
+
return isDecDigit(c) || c >= "a" && c <= "f" || c >= "A" && c <= "F";
|
|
992
|
+
}
|
|
993
|
+
function skipWhile(s, i, pred) {
|
|
994
|
+
while (i < s.length && pred(s[i])) i++;
|
|
995
|
+
return i;
|
|
996
|
+
}
|
|
997
|
+
function matchesWord(s, i, word) {
|
|
998
|
+
return s.slice(i, i + word.length).toLowerCase() === word;
|
|
999
|
+
}
|
|
1000
|
+
function exponentEnd(s, i, marker) {
|
|
1001
|
+
if (i >= s.length || s[i].toLowerCase() !== marker) return i;
|
|
1002
|
+
let j = i + 1;
|
|
1003
|
+
if (s[j] === "+" || s[j] === "-") j++;
|
|
1004
|
+
const end = skipWhile(s, j, isDecDigit);
|
|
1005
|
+
return end === j ? i : end;
|
|
1006
|
+
}
|
|
1007
|
+
function pow2(q) {
|
|
1008
|
+
let bits = BigInt(q + EXP_BIAS) * FRACTION_SCALE;
|
|
1009
|
+
if (q < MIN_NORMAL_EXP) bits = 2n ** BigInt(q - MIN_SUBNORMAL_EXP);
|
|
1010
|
+
return new Float64Array(new BigUint64Array([bits]).buffer)[0];
|
|
1011
|
+
}
|
|
1012
|
+
function shiftRoundHalfEven(m, shift) {
|
|
1013
|
+
if (shift <= 0n) return m << -shift;
|
|
1014
|
+
const kept = m >> shift;
|
|
1015
|
+
const rem = m - (kept << shift);
|
|
1016
|
+
const half = 1n << shift - 1n;
|
|
1017
|
+
const roundUp = rem > half || rem === half && (kept & 1n) === 1n;
|
|
1018
|
+
return roundUp ? kept + 1n : kept;
|
|
1019
|
+
}
|
|
1020
|
+
function hexToDouble(m, e2) {
|
|
1021
|
+
if (m === 0n) return 0;
|
|
1022
|
+
const top = BigInt(m.toString(2).length - 1) + e2;
|
|
1023
|
+
if (top > BigInt(MAX_BINARY_EXP)) return Infinity;
|
|
1024
|
+
if (top < BigInt(MIN_SUBNORMAL_EXP - 1)) return 0;
|
|
1025
|
+
const q = Math.max(Number(top) - (SIGNIFICAND_BITS - 1), MIN_SUBNORMAL_EXP);
|
|
1026
|
+
return Number(shiftRoundHalfEven(m, BigInt(q) - e2)) * pow2(q);
|
|
1027
|
+
}
|
|
1028
|
+
function scanHex(s, i) {
|
|
1029
|
+
const intStart = i + 2;
|
|
1030
|
+
const intEnd = skipWhile(s, intStart, isHexDigit);
|
|
1031
|
+
const hasDot = s[intEnd] === ".";
|
|
1032
|
+
const end = hasDot ? skipWhile(s, intEnd + 1, isHexDigit) : intEnd;
|
|
1033
|
+
const digits = s.slice(intStart, intEnd) + (hasDot ? s.slice(intEnd + 1, end) : "");
|
|
1034
|
+
if (digits.length === 0) return null;
|
|
1035
|
+
const fracDigits = BigInt(hasDot ? end - intEnd - 1 : 0);
|
|
1036
|
+
const expEnd = exponentEnd(s, end, "p");
|
|
1037
|
+
const exp = expEnd > end ? BigInt(s.slice(end + 1, expEnd)) : 0n;
|
|
1038
|
+
const val2 = hexToDouble(BigInt(`0x${digits}`), exp - HEX_DIGIT_BITS * fracDigits);
|
|
1039
|
+
return { val: val2, pos: expEnd };
|
|
1040
|
+
}
|
|
1041
|
+
function scanDecimal(s, i) {
|
|
1042
|
+
const intEnd = skipWhile(s, i, isDecDigit);
|
|
1043
|
+
const hasDot = s[intEnd] === ".";
|
|
1044
|
+
const mantEnd = hasDot ? skipWhile(s, intEnd + 1, isDecDigit) : intEnd;
|
|
1045
|
+
const digitCount = mantEnd - i - (hasDot ? 1 : 0);
|
|
1046
|
+
if (digitCount === 0) return null;
|
|
1047
|
+
const end = exponentEnd(s, mantEnd, "e");
|
|
1048
|
+
return { val: parseFloat(s.slice(i, end)), pos: end };
|
|
1049
|
+
}
|
|
1050
|
+
function scanSpecial(s, i) {
|
|
1051
|
+
if (matchesWord(s, i, INF_WORD)) {
|
|
1052
|
+
const tail = i + INF_WORD.length;
|
|
1053
|
+
return { val: Infinity, pos: matchesWord(s, tail, INF_TAIL) ? tail + INF_TAIL.length : tail };
|
|
1054
|
+
}
|
|
1055
|
+
if (!matchesWord(s, i, NAN_WORD)) return null;
|
|
1056
|
+
const end = i + NAN_WORD.length;
|
|
1057
|
+
const close = s[end] === "(" ? s.indexOf(")", end) : -1;
|
|
1058
|
+
return { val: NaN, pos: close === -1 ? end : close + 1 };
|
|
1059
|
+
}
|
|
1060
|
+
function scanMagnitude(s, i) {
|
|
1061
|
+
if (s[i] === "0" && (s[i + 1] === "x" || s[i + 1] === "X")) {
|
|
1062
|
+
const hex = scanHex(s, i);
|
|
1063
|
+
if (hex !== null) return hex;
|
|
1064
|
+
}
|
|
1065
|
+
return scanDecimal(s, i) ?? scanSpecial(s, i);
|
|
1066
|
+
}
|
|
1067
|
+
function scanStrtod(s, pos) {
|
|
1068
|
+
let i = skipWhile(s, pos, isSpace);
|
|
1069
|
+
const negative = s[i] === "-";
|
|
1070
|
+
if (negative || s[i] === "+") i++;
|
|
1071
|
+
const mag = scanMagnitude(s, i);
|
|
1072
|
+
if (mag === null) return null;
|
|
1073
|
+
return { val: negative ? -mag.val : mag.val, pos: mag.pos };
|
|
1074
|
+
}
|
|
1075
|
+
|
|
966
1076
|
// src/xdot/parse.ts
|
|
967
1077
|
var ULONG_MAX = 0xffffffffffffffffn;
|
|
968
1078
|
var XdotParser = class _XdotParser {
|
|
1079
|
+
/** @see lib/util/gv_ctype.h:gv_isspace */
|
|
969
1080
|
static isWs(c) {
|
|
970
|
-
return c
|
|
1081
|
+
return isSpace(c);
|
|
971
1082
|
}
|
|
972
1083
|
static skipWs(s, pos) {
|
|
973
1084
|
while (pos < s.length && _XdotParser.isWs(s[pos])) pos++;
|
|
@@ -977,27 +1088,13 @@ var XdotParser = class _XdotParser {
|
|
|
977
1088
|
while (i < s.length && s[i] >= "0" && s[i] <= "9") i++;
|
|
978
1089
|
return i;
|
|
979
1090
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
}
|
|
986
|
-
return i;
|
|
987
|
-
}
|
|
1091
|
+
/**
|
|
1092
|
+
* C reads every xdot double with strtod, so a number may be a decimal, a
|
|
1093
|
+
* hex float, inf/infinity or nan/nan(...); null is C's `p == s`.
|
|
1094
|
+
* @see lib/xdot/xdot.c:parseReal
|
|
1095
|
+
*/
|
|
988
1096
|
static parseReal(s, pos) {
|
|
989
|
-
|
|
990
|
-
const start = i;
|
|
991
|
-
if (i < s.length && (s[i] === "-" || s[i] === "+")) i++;
|
|
992
|
-
const digStart = i;
|
|
993
|
-
i = _XdotParser.consumeDigits(s, i);
|
|
994
|
-
if (i < s.length && s[i] === ".") {
|
|
995
|
-
i++;
|
|
996
|
-
i = _XdotParser.consumeDigits(s, i);
|
|
997
|
-
}
|
|
998
|
-
i = _XdotParser.consumeExponent(s, i);
|
|
999
|
-
if (i === start || i === digStart) return null;
|
|
1000
|
-
return { val: parseFloat(s.slice(start, i)), pos: i };
|
|
1097
|
+
return scanStrtod(s, pos);
|
|
1001
1098
|
}
|
|
1002
1099
|
static parseInt_(s, pos) {
|
|
1003
1100
|
let i = _XdotParser.skipWs(s, pos);
|
|
@@ -7505,10 +7602,10 @@ var COMPLETE_END = (end, attError) => attError === void 0 ? { kind: "complete",
|
|
|
7505
7602
|
var PARTIAL = { kind: "partial" };
|
|
7506
7603
|
var INVALID = (offset) => ({ kind: "invalid", offset });
|
|
7507
7604
|
var XML_NAME = /^[A-Za-z_:\u0080-\uFFFF][\w.:\u0080-\uFFFF-]*/;
|
|
7508
|
-
var
|
|
7605
|
+
var isSpace2 = (c) => c !== void 0 && /\s/.test(c);
|
|
7509
7606
|
function skipSpace(text, i) {
|
|
7510
7607
|
let j = i;
|
|
7511
|
-
while (
|
|
7608
|
+
while (isSpace2(text[j])) j++;
|
|
7512
7609
|
return j;
|
|
7513
7610
|
}
|
|
7514
7611
|
var byteLength = (s) => new TextEncoder().encode(s).length;
|
|
@@ -7582,7 +7679,7 @@ function scanStartTag(text, p) {
|
|
|
7582
7679
|
if ("kind" in name) return name;
|
|
7583
7680
|
const c = text[name.next];
|
|
7584
7681
|
if (c === void 0) return PARTIAL;
|
|
7585
|
-
if (!
|
|
7682
|
+
if (!isSpace2(c) && c !== ">" && c !== "/") return INVALID(name.next);
|
|
7586
7683
|
return scanAttributes(text, p, name.next);
|
|
7587
7684
|
}
|
|
7588
7685
|
function scanEndTag(text, p) {
|
|
@@ -10034,6 +10131,7 @@ function flatEdge(g, e) {
|
|
|
10034
10131
|
if (!e.head.info.flat_in) e.head.info.flat_in = { list: [], size: 0 };
|
|
10035
10132
|
elistAppend(e.tail.info.flat_out, e);
|
|
10036
10133
|
elistAppend(e.head.info.flat_in, e);
|
|
10134
|
+
(g.info.dotroot ?? g.root).info.has_flat_edges = true;
|
|
10037
10135
|
g.info.has_flat_edges = true;
|
|
10038
10136
|
}
|
|
10039
10137
|
function findFlatEdge(u, v) {
|
|
@@ -11165,10 +11263,13 @@ var RenderJob = class {
|
|
|
11165
11263
|
measurer;
|
|
11166
11264
|
format;
|
|
11167
11265
|
bb = { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
11266
|
+
/** `pad=`, or else the render device's default pad (`RendererPlugin.defaultPad`).
|
|
11267
|
+
* @see lib/common/emit.c:3290-3304 init_job_pad */
|
|
11168
11268
|
pad = { x: 0, y: 0 };
|
|
11169
11269
|
/** Current page clip in graph units, as setup_page computes it from the
|
|
11170
|
-
* viewport focus/view (see setupPageClip). Read by the
|
|
11171
|
-
*
|
|
11270
|
+
* viewport focus/view (see setupPageClip). Read by the node and edge gates
|
|
11271
|
+
* and by the SVG page translate and background.
|
|
11272
|
+
* @see lib/gvc/gvcjob.h:GVJ_s.clip; lib/common/emit.c:setup_page */
|
|
11172
11273
|
clip = { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
11173
11274
|
/** Graph-level `margin=` (init_job_margin); page-pagination margin, distinct
|
|
11174
11275
|
* from node/cluster label margin. @see lib/common/emit.c:3309-3331 */
|
|
@@ -17531,7 +17632,7 @@ function svgClusterId(sg, job) {
|
|
|
17531
17632
|
return job.objId(sg.attrs.get("id"), "clust" + sg.seq);
|
|
17532
17633
|
}
|
|
17533
17634
|
function svgGraphId(g, job) {
|
|
17534
|
-
return job.objId(g.attrs.get("id"), "
|
|
17635
|
+
return job.objId(g.attrs.get("id"), "graph" + g.seq, true);
|
|
17535
17636
|
}
|
|
17536
17637
|
function svgNodeClass(n) {
|
|
17537
17638
|
return svgClass("node", nodeAttr(n, n.root, "class"));
|
|
@@ -18896,9 +18997,12 @@ function doOrderingNode(ctx, g, n, outflag) {
|
|
|
18896
18997
|
}
|
|
18897
18998
|
function doOrderingForNodes(ctx, g) {
|
|
18898
18999
|
for (const n of nodesInSeq(g)) {
|
|
18899
|
-
const ordering = n
|
|
19000
|
+
const ordering = nodeAttr(n, g, "ordering");
|
|
18900
19001
|
if (ordering === "out") doOrderingNode(ctx, g, n, true);
|
|
18901
19002
|
else if (ordering === "in") doOrderingNode(ctx, g, n, false);
|
|
19003
|
+
else if (ordering !== void 0 && ordering !== "") {
|
|
19004
|
+
agerrorf(`ordering '${ordering}' not recognized for node '${n.name}'.`);
|
|
19005
|
+
}
|
|
18902
19006
|
}
|
|
18903
19007
|
}
|
|
18904
19008
|
function doOrdering(ctx, g, outflag) {
|
|
@@ -18909,6 +19013,7 @@ function orderedEdges(ctx, g) {
|
|
|
18909
19013
|
if (ordering !== void 0) {
|
|
18910
19014
|
if (ordering === "out") doOrdering(ctx, g, true);
|
|
18911
19015
|
else if (ordering === "in") doOrdering(ctx, g, false);
|
|
19016
|
+
else if (ordering !== "") agerrorf(`ordering '${ordering}' not recognized.`);
|
|
18912
19017
|
return;
|
|
18913
19018
|
}
|
|
18914
19019
|
for (const subg of g.subgraphs.values()) {
|
|
@@ -19576,22 +19681,24 @@ function applyTailLabel(e, g, lfi, measurer) {
|
|
|
19576
19681
|
e.info.tail_label = makeAnyLabel(content, isHtml, lfi, measurer, e);
|
|
19577
19682
|
g.root.info.has_labels = (g.root.info.has_labels ?? 0) | TAIL_LABEL;
|
|
19578
19683
|
}
|
|
19579
|
-
|
|
19684
|
+
var BOUND_EDGE_LABEL_SYMS = { headlabel: true, taillabel: true, xlabel: true };
|
|
19685
|
+
function applyMainLabels(e, g, measurer, syms) {
|
|
19580
19686
|
let fi = null;
|
|
19581
19687
|
const labelStr = e.attrs.get("label");
|
|
19582
19688
|
if (labelStr) {
|
|
19583
19689
|
fi = initFontEdgeAttr(e);
|
|
19584
19690
|
applyLabel(e, g, fi, measurer);
|
|
19585
19691
|
}
|
|
19586
|
-
const xlabelStr = e.attrs.get("xlabel");
|
|
19692
|
+
const xlabelStr = syms.xlabel ? e.attrs.get("xlabel") : void 0;
|
|
19587
19693
|
if (xlabelStr) {
|
|
19588
19694
|
applyXLabel(e, g, fi ?? initFontEdgeAttr(e), measurer);
|
|
19589
19695
|
}
|
|
19590
19696
|
}
|
|
19591
|
-
function applyEndLabels(e, g, measurer) {
|
|
19697
|
+
function applyEndLabels(e, g, measurer, syms) {
|
|
19698
|
+
if (!syms.headlabel && !syms.taillabel) return;
|
|
19592
19699
|
const lfi = getLabelFontInfo(e);
|
|
19593
|
-
applyHeadLabel(e, g, lfi, measurer);
|
|
19594
|
-
applyTailLabel(e, g, lfi, measurer);
|
|
19700
|
+
if (syms.headlabel) applyHeadLabel(e, g, lfi, measurer);
|
|
19701
|
+
if (syms.taillabel) applyTailLabel(e, g, lfi, measurer);
|
|
19595
19702
|
}
|
|
19596
19703
|
function chkPort(pf, n, s) {
|
|
19597
19704
|
const cp = s.indexOf(":");
|
|
@@ -19622,13 +19729,13 @@ function initEdgePorts(e) {
|
|
|
19622
19729
|
e.info.head_port = chkPort(portfnOf(e.head), e.head, headStr);
|
|
19623
19730
|
if (isClipDisabled(e.attrs.get("headclip"))) e.info.head_port.clip = false;
|
|
19624
19731
|
}
|
|
19625
|
-
function initEdgeLabels(e, g, measurer) {
|
|
19732
|
+
function initEdgeLabels(e, g, measurer, syms = BOUND_EDGE_LABEL_SYMS) {
|
|
19626
19733
|
initEdgePorts(e);
|
|
19627
19734
|
const hasMain = e.attrs.has("label") || e.attrs.has("xlabel");
|
|
19628
19735
|
const hasEnd = e.attrs.has("headlabel") || e.attrs.has("taillabel");
|
|
19629
19736
|
if (!hasMain && !hasEnd) return;
|
|
19630
|
-
if (hasMain) applyMainLabels(e, g, measurer);
|
|
19631
|
-
if (hasEnd) applyEndLabels(e, g, measurer);
|
|
19737
|
+
if (hasMain) applyMainLabels(e, g, measurer, syms);
|
|
19738
|
+
if (hasEnd) applyEndLabels(e, g, measurer, syms);
|
|
19632
19739
|
}
|
|
19633
19740
|
|
|
19634
19741
|
// src/common/graph-init.ts
|
|
@@ -19780,8 +19887,24 @@ function dotInitNode(n) {
|
|
|
19780
19887
|
if (n.info.ht === void 0) n.info.ht = 36;
|
|
19781
19888
|
n.info.node_type = NORMAL;
|
|
19782
19889
|
}
|
|
19783
|
-
var DOT_INIT_SYMS = {
|
|
19784
|
-
|
|
19890
|
+
var DOT_INIT_SYMS = {
|
|
19891
|
+
constr: true,
|
|
19892
|
+
minlen: true,
|
|
19893
|
+
group: true,
|
|
19894
|
+
headlabel: true,
|
|
19895
|
+
taillabel: true,
|
|
19896
|
+
xlabel: true,
|
|
19897
|
+
nodeXlabel: true
|
|
19898
|
+
};
|
|
19899
|
+
var AUX_INIT_SYMS = {
|
|
19900
|
+
constr: false,
|
|
19901
|
+
minlen: false,
|
|
19902
|
+
group: false,
|
|
19903
|
+
headlabel: false,
|
|
19904
|
+
taillabel: false,
|
|
19905
|
+
xlabel: false,
|
|
19906
|
+
nodeXlabel: false
|
|
19907
|
+
};
|
|
19785
19908
|
function sameNonemptyGroup(e, syms = DOT_INIT_SYMS) {
|
|
19786
19909
|
if (!syms.group) return false;
|
|
19787
19910
|
const tailgroup = nodeAttr(e.tail, e.tail.root, "group") ?? "";
|
|
@@ -19833,13 +19956,13 @@ function clearFastGraphLists(n) {
|
|
|
19833
19956
|
}
|
|
19834
19957
|
function dotInitNodeEdge(g, syms = DOT_INIT_SYMS) {
|
|
19835
19958
|
for (const n of nodesInSeq(g)) {
|
|
19836
|
-
commonInitNode(n, g);
|
|
19959
|
+
commonInitNode(n, g, syms);
|
|
19837
19960
|
dotInitNode(n);
|
|
19838
19961
|
}
|
|
19839
19962
|
const measurer = g.root.info.gvc?.textMeasurer;
|
|
19840
19963
|
for (const e of g.edges) {
|
|
19841
19964
|
dotInitEdge(e, syms);
|
|
19842
|
-
if (measurer) initEdgeLabels(e, g, measurer);
|
|
19965
|
+
if (measurer) initEdgeLabels(e, g, measurer, syms);
|
|
19843
19966
|
}
|
|
19844
19967
|
}
|
|
19845
19968
|
function removeFill(g) {
|
|
@@ -20414,7 +20537,9 @@ function polySizeParamsFromNode(n, g, shape, labelDimen, flip) {
|
|
|
20414
20537
|
flip
|
|
20415
20538
|
};
|
|
20416
20539
|
}
|
|
20417
|
-
|
|
20540
|
+
var BOUND_NODE_INIT_SYMS = { nodeXlabel: true };
|
|
20541
|
+
function initNodeXLabel(n, g, measurer, syms) {
|
|
20542
|
+
if (!syms.nodeXlabel) return;
|
|
20418
20543
|
const str = nodeAttr(n, g, "xlabel");
|
|
20419
20544
|
if (!str || str.length === 0) return;
|
|
20420
20545
|
const font = readFontAttrs(n, g);
|
|
@@ -20451,17 +20576,17 @@ function initPointSize(n, g, shape) {
|
|
|
20451
20576
|
storeNodeSize(n, pointSizeResult(sz0, peripheries, penwidth), flip);
|
|
20452
20577
|
assignShapeInfo(n, { ...shape.polygon, peripheries, sides: 2, penwidth, vertices: null });
|
|
20453
20578
|
}
|
|
20454
|
-
function initNodeFromLabel(n, g, measurer) {
|
|
20579
|
+
function initNodeFromLabel(n, g, measurer, syms) {
|
|
20455
20580
|
const shape = bindShape(nodeAttr(n, g, "shape") ?? "ellipse", nodeAttr(n, g, "shapefile"));
|
|
20456
20581
|
n.info.shape = shape;
|
|
20457
20582
|
if (shape.kind === 2 /* SH_RECORD */) {
|
|
20458
20583
|
recordMakeLabel(n, g, measurer);
|
|
20459
|
-
initNodeXLabel(n, g, measurer);
|
|
20584
|
+
initNodeXLabel(n, g, measurer, syms);
|
|
20460
20585
|
recordInit(n, g, measurer);
|
|
20461
20586
|
return true;
|
|
20462
20587
|
}
|
|
20463
20588
|
buildNodeLabel(n, g, measurer);
|
|
20464
|
-
initNodeXLabel(n, g, measurer);
|
|
20589
|
+
initNodeXLabel(n, g, measurer, syms);
|
|
20465
20590
|
if (shape.kind !== 3 /* SH_POINT */) warnPolyInitImages(n, g);
|
|
20466
20591
|
const poly = shape.polygon;
|
|
20467
20592
|
if (poly === null) return false;
|
|
@@ -20523,9 +20648,9 @@ function initNodeDefaults(n, g) {
|
|
|
20523
20648
|
if (!n.info.rw) n.info.rw = Math.max(w * 72 / 2, DEFAULT_NODE_LW);
|
|
20524
20649
|
if (!n.info.ht) n.info.ht = Math.max(h * 72, DEFAULT_NODE_HT);
|
|
20525
20650
|
}
|
|
20526
|
-
function commonInitNode(n, g) {
|
|
20651
|
+
function commonInitNode(n, g, syms = BOUND_NODE_INIT_SYMS) {
|
|
20527
20652
|
const measurer = layoutMeasurer(g);
|
|
20528
|
-
if (measurer !== void 0 && initNodeFromLabel(n, g, measurer)) return;
|
|
20653
|
+
if (measurer !== void 0 && initNodeFromLabel(n, g, measurer, syms)) return;
|
|
20529
20654
|
initNodeDefaults(n, g);
|
|
20530
20655
|
}
|
|
20531
20656
|
function commonInitNodeEdge(g) {
|
|
@@ -21158,9 +21283,6 @@ function bgGradientPts(clip) {
|
|
|
21158
21283
|
{ x: right2, y: bottom }
|
|
21159
21284
|
];
|
|
21160
21285
|
}
|
|
21161
|
-
function graphObjId(g, job) {
|
|
21162
|
-
return job.objId(g.attrs.get("id"), "graph" + g.seq, true);
|
|
21163
|
-
}
|
|
21164
21286
|
function writeGradientPolygon(clip, id, job) {
|
|
21165
21287
|
const left2 = clip.ll.x;
|
|
21166
21288
|
const right2 = clip.ur.x;
|
|
@@ -21184,7 +21306,7 @@ function writeGradientPolygon(clip, id, job) {
|
|
|
21184
21306
|
}
|
|
21185
21307
|
function emitGradientBackground(g, clip, spec, job) {
|
|
21186
21308
|
const obj = createObjState(0 /* RootGraph */);
|
|
21187
|
-
obj.id =
|
|
21309
|
+
obj.id = svgGraphId(g, job);
|
|
21188
21310
|
obj.fillColor = resolveRenderColor(spec.fillColor);
|
|
21189
21311
|
obj.stopColor = resolveRenderColor(spec.stopColor);
|
|
21190
21312
|
obj.gradientFrac = spec.frac;
|
|
@@ -21252,7 +21374,7 @@ function svgBeginPage(g, job) {
|
|
|
21252
21374
|
const tx = job.rotation !== 0 ? -clip.ur.x - job.margin.x / z : -clip.ll.x + job.margin.x / z;
|
|
21253
21375
|
const ty = clip.ur.y + job.margin.y / z;
|
|
21254
21376
|
emitGraphGroupOpen(
|
|
21255
|
-
job.idLayerPrefix() +
|
|
21377
|
+
job.idLayerPrefix() + svgGraphId(g, job),
|
|
21256
21378
|
svgGraphClass(g),
|
|
21257
21379
|
tx,
|
|
21258
21380
|
ty,
|
|
@@ -21709,7 +21831,8 @@ function parseDrawingSize(raw) {
|
|
|
21709
21831
|
}
|
|
21710
21832
|
return null;
|
|
21711
21833
|
}
|
|
21712
|
-
|
|
21834
|
+
var DEFAULT_GRAPH_PAD = 4;
|
|
21835
|
+
function parseGraphPad(raw, fallback) {
|
|
21713
21836
|
if (raw !== void 0) {
|
|
21714
21837
|
const xy = PAD_XY_RE.exec(raw);
|
|
21715
21838
|
if (xy) {
|
|
@@ -21721,7 +21844,7 @@ function parseGraphPad(raw) {
|
|
|
21721
21844
|
return { x: v, y: v };
|
|
21722
21845
|
}
|
|
21723
21846
|
}
|
|
21724
|
-
return { x:
|
|
21847
|
+
return { x: fallback, y: fallback };
|
|
21725
21848
|
}
|
|
21726
21849
|
function parseGraphMargin(raw) {
|
|
21727
21850
|
if (raw !== void 0) {
|
|
@@ -22336,11 +22459,9 @@ function nextLayer(job, cur) {
|
|
|
22336
22459
|
var DEFAULT_COLOR4 = "black";
|
|
22337
22460
|
var DEFAULT_FILL = "lightgrey";
|
|
22338
22461
|
var DEFAULT_LINE_STYLE = ["solid", "setlinewidth(1)"];
|
|
22339
|
-
function deviceClip(g,
|
|
22340
|
-
const attr2 = g.attrs.get("pad");
|
|
22341
|
-
const pad = renderer.type === "svg" ? job.pad : attr2 ? parseGraphPad(attr2) : { x: 0, y: 0 };
|
|
22462
|
+
function deviceClip(g, job) {
|
|
22342
22463
|
const size = parseDrawingSize(g.attrs.get("size"));
|
|
22343
|
-
return setupPageClip(job.bb, size, pad, initJobViewportZoom(job.bb, size, pad));
|
|
22464
|
+
return setupPageClip(job.bb, size, job.pad, initJobViewportZoom(job.bb, size, job.pad));
|
|
22344
22465
|
}
|
|
22345
22466
|
function zeroBoxInClip(clip) {
|
|
22346
22467
|
return clip.ll.x <= 0 && clip.ll.y <= 0 && clip.ur.x >= 0 && clip.ur.y >= 0;
|
|
@@ -22458,7 +22579,7 @@ function emitXdot(g, renderer, job) {
|
|
|
22458
22579
|
const obj = job.obj;
|
|
22459
22580
|
if (xd === void 0 || obj === null) return;
|
|
22460
22581
|
applyBackgroundState(g, renderer, obj);
|
|
22461
|
-
const inClip = zeroBoxInClip(deviceClip(g,
|
|
22582
|
+
const inClip = zeroBoxInClip(deviceClip(g, job));
|
|
22462
22583
|
const warned2 = { image: false };
|
|
22463
22584
|
let styled = false;
|
|
22464
22585
|
for (const op of xd.ops) {
|
|
@@ -22555,11 +22676,7 @@ function nodeBBox(n) {
|
|
|
22555
22676
|
};
|
|
22556
22677
|
}
|
|
22557
22678
|
function nodeInBox(n, job) {
|
|
22558
|
-
|
|
22559
|
-
ll: { x: job.bb.ll.x - job.pad.x, y: job.bb.ll.y - job.pad.y },
|
|
22560
|
-
ur: { x: job.bb.ur.x + job.pad.x, y: job.bb.ur.y + job.pad.y }
|
|
22561
|
-
};
|
|
22562
|
-
return boxOverlap(nodeBBox(n), clip);
|
|
22679
|
+
return boxOverlap(nodeBBox(n), job.clip);
|
|
22563
22680
|
}
|
|
22564
22681
|
function gvrenderComment(renderer, job, str) {
|
|
22565
22682
|
if (str === void 0 || str.length === 0) return;
|
|
@@ -22764,11 +22881,11 @@ function render(ctx, g, format, inlineImages = false) {
|
|
|
22764
22881
|
const job = newRenderJob(ctx, format, inlineImages);
|
|
22765
22882
|
initBb(g);
|
|
22766
22883
|
job.bb = g.info.bb;
|
|
22767
|
-
job.pad = parseGraphPad(g.attrs.get("pad"));
|
|
22884
|
+
job.pad = parseGraphPad(g.attrs.get("pad"), renderer.defaultPad ?? DEFAULT_GRAPH_PAD);
|
|
22768
22885
|
job.margin = parseGraphMargin(g.attrs.get("margin"));
|
|
22769
22886
|
const drawingSize = parseDrawingSize(g.attrs.get("size"));
|
|
22770
22887
|
const z = initJobViewportZoom(job.bb, drawingSize, job.pad);
|
|
22771
|
-
job.clip = deviceClip(g,
|
|
22888
|
+
job.clip = deviceClip(g, job);
|
|
22772
22889
|
const drawingDpi = lateDouble(
|
|
22773
22890
|
g.attrs.get("dpi"),
|
|
22774
22891
|
lateDouble(g.attrs.get("resolution"), 0, 0),
|
|
@@ -24051,7 +24168,7 @@ function graphRanksep(g) {
|
|
|
24051
24168
|
return g.info.ranksep ?? 0;
|
|
24052
24169
|
}
|
|
24053
24170
|
function makeAuxEdge(u, v, len, wt) {
|
|
24054
|
-
const e = new Edge(u, v, "");
|
|
24171
|
+
const e = new Edge(u, v, "", true, true);
|
|
24055
24172
|
e.info.minlen = cround(Math.min(len, 2147483647));
|
|
24056
24173
|
e.info.weight = wt;
|
|
24057
24174
|
fastEdge(e);
|
|
@@ -24099,7 +24216,7 @@ function applyFlatLabel(g, e, e0raw, e1raw) {
|
|
|
24099
24216
|
const nodesep = graphNodesep(g);
|
|
24100
24217
|
const e0 = nodeOrder(e0raw.head) <= nodeOrder(e1raw.head) ? e0raw : e1raw;
|
|
24101
24218
|
const e1 = e0 === e0raw ? e1raw : e0raw;
|
|
24102
|
-
const m0 = edgeMinlen(e) * nodesep / 2;
|
|
24219
|
+
const m0 = Math.trunc(edgeMinlen(e) * nodesep / 2);
|
|
24103
24220
|
const m1a = m0 + nodeRw(e0.head) + nodeLw(e0.tail);
|
|
24104
24221
|
if (!canReach(e0.tail, e0.head)) makeAuxEdge(e0.head, e0.tail, m1a, edgeWeight2(e));
|
|
24105
24222
|
const m1b = m0 + nodeRw(e1.tail) + nodeLw(e1.head);
|
|
@@ -31800,7 +31917,7 @@ var BeginRegSide = class _BeginRegSide {
|
|
|
31800
31917
|
const b = endp.nb;
|
|
31801
31918
|
endp.boxes[0] = {
|
|
31802
31919
|
ll: { x: b.ll.x - 1, y: P.start.p.y },
|
|
31803
|
-
ur: { x: b.ur.x, y: n.info.coord.y + n.info.ht / 2 + ranksep / 2 }
|
|
31920
|
+
ur: { x: b.ur.x, y: n.info.coord.y + n.info.ht / 2 + Math.trunc(ranksep / 2) }
|
|
31804
31921
|
};
|
|
31805
31922
|
endp.boxes[1] = {
|
|
31806
31923
|
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 },
|
|
@@ -31812,7 +31929,7 @@ var BeginRegSide = class _BeginRegSide {
|
|
|
31812
31929
|
const b = endp.nb;
|
|
31813
31930
|
endp.boxes[0] = {
|
|
31814
31931
|
ll: { x: b.ll.x, y: P.start.p.y },
|
|
31815
|
-
ur: { x: b.ur.x + 1, y: n.info.coord.y + n.info.ht / 2 + ranksep / 2 }
|
|
31932
|
+
ur: { x: b.ur.x + 1, y: n.info.coord.y + n.info.ht / 2 + Math.trunc(ranksep / 2) }
|
|
31816
31933
|
};
|
|
31817
31934
|
endp.boxes[1] = {
|
|
31818
31935
|
ll: { x: n.info.coord.x + n.info.rw + (FUDGE - 2), y: n.info.coord.y - n.info.ht / 2 },
|
|
@@ -31873,7 +31990,7 @@ var BeginFlatSide = class _BeginFlatSide {
|
|
|
31873
31990
|
const { P, n, endp, ranksep } = ctx;
|
|
31874
31991
|
if (endp.sidemask === TOP) {
|
|
31875
31992
|
endp.boxes[0] = {
|
|
31876
|
-
ll: { x: P.start.p.x, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
31993
|
+
ll: { x: P.start.p.x, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
31877
31994
|
ur: { x: b.ur.x + 1, y: n.info.coord.y - n.info.ht / 2 }
|
|
31878
31995
|
};
|
|
31879
31996
|
endp.boxes[1] = {
|
|
@@ -31978,7 +32095,7 @@ var EndRegSide = class _EndRegSide {
|
|
|
31978
32095
|
const b = endp.nb;
|
|
31979
32096
|
if (P.end.p.x < n.info.coord.x) {
|
|
31980
32097
|
endp.boxes[0] = {
|
|
31981
|
-
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
32098
|
+
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
31982
32099
|
ur: { x: b.ur.x, y: P.end.p.y }
|
|
31983
32100
|
};
|
|
31984
32101
|
endp.boxes[1] = {
|
|
@@ -31987,7 +32104,7 @@ var EndRegSide = class _EndRegSide {
|
|
|
31987
32104
|
};
|
|
31988
32105
|
} else {
|
|
31989
32106
|
endp.boxes[0] = {
|
|
31990
|
-
ll: { x: b.ll.x, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
32107
|
+
ll: { x: b.ll.x, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
31991
32108
|
ur: { x: b.ur.x + 1, y: P.end.p.y }
|
|
31992
32109
|
};
|
|
31993
32110
|
endp.boxes[1] = {
|
|
@@ -32044,7 +32161,7 @@ var EndFlatSide = class _EndFlatSide {
|
|
|
32044
32161
|
const { P, n, endp, ranksep } = ctx;
|
|
32045
32162
|
if (endp.sidemask === TOP) {
|
|
32046
32163
|
endp.boxes[0] = {
|
|
32047
|
-
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
32164
|
+
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
32048
32165
|
ur: { x: P.end.p.x, y: n.info.coord.y - n.info.ht / 2 }
|
|
32049
32166
|
};
|
|
32050
32167
|
endp.boxes[1] = {
|
|
@@ -33429,6 +33546,7 @@ function transformf(p, del, flip) {
|
|
|
33429
33546
|
}
|
|
33430
33547
|
function cloneNode(g, orign) {
|
|
33431
33548
|
const n = agnode(g, orign.name, true);
|
|
33549
|
+
if (g !== g.root) agsubnode(g, n, true);
|
|
33432
33550
|
n.info.coord = { x: orign.info.coord.x, y: orign.info.coord.y };
|
|
33433
33551
|
n.info.lw = orign.info.lw;
|
|
33434
33552
|
n.info.rw = orign.info.rw;
|
|
@@ -35248,7 +35366,9 @@ function buildFlatAux(g, edges, cnt) {
|
|
|
35248
35366
|
const flip = g.info.flip ?? false;
|
|
35249
35367
|
const refTn = flip ? lhn : ltn;
|
|
35250
35368
|
const auxg = cloneGraph(g);
|
|
35251
|
-
const
|
|
35369
|
+
const subg = agsubg(auxg, "xxx", true);
|
|
35370
|
+
subg.attrs.set("rank", "source");
|
|
35371
|
+
const auxt = cloneNode(subg, refTn);
|
|
35252
35372
|
const auxh = cloneNode(auxg, flip ? ltn : lhn);
|
|
35253
35373
|
const alg = /* @__PURE__ */ new Map();
|
|
35254
35374
|
let hvye = null;
|
|
@@ -35357,7 +35477,6 @@ function makeFlatAdjEdges(g, edges, cnt, et) {
|
|
|
35357
35477
|
repositionFlatAux(g, edges, aux);
|
|
35358
35478
|
dotSameports(aux.auxg);
|
|
35359
35479
|
dotSplines_(aux.auxg, false);
|
|
35360
|
-
placeRegularEdgeLabels(aux.auxg);
|
|
35361
35480
|
gvPostprocess(aux.auxg);
|
|
35362
35481
|
copyFlatSplines(g, edges, aux);
|
|
35363
35482
|
cleanupCloneGraph(aux.auxg);
|
|
@@ -35461,6 +35580,35 @@ function assembleFlatPath(P, tend, hend, mid) {
|
|
|
35461
35580
|
for (let i = hend.boxn - 1; i >= 0; i--) addBox(P, hend.boxes[i]);
|
|
35462
35581
|
}
|
|
35463
35582
|
|
|
35583
|
+
// src/layout/dot/flat-adj-record.ts
|
|
35584
|
+
var MSG_FLAT_ADJ_RECORD = "flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels";
|
|
35585
|
+
var EDGEOP_DIRECTED = "->";
|
|
35586
|
+
var EDGEOP_UNDIRECTED = "--";
|
|
35587
|
+
var flatAdjRecord = { warned: false };
|
|
35588
|
+
registerRenderState(() => {
|
|
35589
|
+
flatAdjRecord.warned = false;
|
|
35590
|
+
});
|
|
35591
|
+
function isRecord(n) {
|
|
35592
|
+
return n.info.shape?.kind === 2 /* SH_RECORD */;
|
|
35593
|
+
}
|
|
35594
|
+
function edgeOp(g) {
|
|
35595
|
+
const kind = g.root.kind;
|
|
35596
|
+
return kind === "directed" || kind === "strict-directed" ? EDGEOP_DIRECTED : EDGEOP_UNDIRECTED;
|
|
35597
|
+
}
|
|
35598
|
+
function lostFlatAdjRecordEdge(g, e) {
|
|
35599
|
+
const tr = e.tail.info.rank;
|
|
35600
|
+
if (tr === void 0 || tr !== e.head.info.rank) return false;
|
|
35601
|
+
if (!isFlatAdjacent(g, e)) return false;
|
|
35602
|
+
const { tn, hn } = flatLeadPair([e]);
|
|
35603
|
+
if (!isRecord(tn) && !isRecord(hn)) return false;
|
|
35604
|
+
if (!flatAdjRecord.warned) {
|
|
35605
|
+
flatAdjRecord.warned = true;
|
|
35606
|
+
agwarningf(MSG_FLAT_ADJ_RECORD);
|
|
35607
|
+
agerr("prev", ` Edge ${tn.name} ${edgeOp(g)} ${hn.name}`);
|
|
35608
|
+
}
|
|
35609
|
+
return true;
|
|
35610
|
+
}
|
|
35611
|
+
|
|
35464
35612
|
// src/layout/dot/splines-flat-labeled.ts
|
|
35465
35613
|
var LBL_SPACE = 6;
|
|
35466
35614
|
function findLabelNode(e) {
|
|
@@ -36022,12 +36170,12 @@ function dispatchMultiRankNonForward(e, tailBox, headBox, g) {
|
|
|
36022
36170
|
if (isMultiRankFwdEdge(e)) return routeFaithfulMultiRank(e, g);
|
|
36023
36171
|
return false;
|
|
36024
36172
|
}
|
|
36025
|
-
function routeEdgeNonForward(e, g) {
|
|
36173
|
+
function routeEdgeNonForward(e, g, run) {
|
|
36026
36174
|
if (routeFaithfulAdjacentBack(e, g)) return;
|
|
36027
36175
|
const tailBox = nodeBoxOf(e.tail, g);
|
|
36028
36176
|
const headBox = nodeBoxOf(e.head, g);
|
|
36029
36177
|
if (dispatchMultiRankNonForward(e, tailBox, headBox, g)) return;
|
|
36030
|
-
if (e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank && routeFlatEdge(e, g)) return;
|
|
36178
|
+
if (e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank && routeFlatEdge(e, g, run)) return;
|
|
36031
36179
|
routeFaithfulRegularPlain(e, g);
|
|
36032
36180
|
}
|
|
36033
36181
|
function portRouteOf(e) {
|
|
@@ -36068,11 +36216,10 @@ function routeFaithfulAdjacentBack(e, g) {
|
|
|
36068
36216
|
if (swapEndsP(e)) swapEdgeSpline(e);
|
|
36069
36217
|
return true;
|
|
36070
36218
|
}
|
|
36071
|
-
function routeOneEdge(e, g) {
|
|
36219
|
+
function routeOneEdge(e, g, run) {
|
|
36072
36220
|
const dirAttr = e.attrs.get("dir") ?? defaultEdgeDir(g);
|
|
36073
|
-
const pw = edgeRenderPenwidth(e);
|
|
36074
36221
|
if (dirAttr !== "forward") {
|
|
36075
|
-
routeEdgeNonForward(e, g);
|
|
36222
|
+
routeEdgeNonForward(e, g, run);
|
|
36076
36223
|
return;
|
|
36077
36224
|
}
|
|
36078
36225
|
if (routeFaithfulAdjacentBack(e, g)) return;
|
|
@@ -36086,7 +36233,7 @@ function routeOneEdge(e, g) {
|
|
|
36086
36233
|
routeFaithfulMultiRank(e, g);
|
|
36087
36234
|
return;
|
|
36088
36235
|
}
|
|
36089
|
-
routeForwardEdge(e, g, tailBox, headBox,
|
|
36236
|
+
routeForwardEdge(e, g, tailBox, headBox, run);
|
|
36090
36237
|
}
|
|
36091
36238
|
function routeFaithfulMultiRank(e, g) {
|
|
36092
36239
|
const pts = routeMultiRankEdgeFaithful(g, e);
|
|
@@ -36112,22 +36259,19 @@ function isAdjacentPortFlat(e, g) {
|
|
|
36112
36259
|
function isGroupableFlat(x, g) {
|
|
36113
36260
|
return !routedThisPass(x) && x.tail.info.rank !== void 0 && x.tail.info.rank === x.head.info.rank && isFlatAdjacent(g, x);
|
|
36114
36261
|
}
|
|
36115
|
-
function joinsPortedFlatGroup(e, g) {
|
|
36116
|
-
return isAdjFlatCandidate(e) && isGroupableFlat(e, g) && collectAdjacentFlatGroup(e, g).some(hasDefinedPort);
|
|
36262
|
+
function joinsPortedFlatGroup(e, g, run) {
|
|
36263
|
+
return isAdjFlatCandidate(e) && isGroupableFlat(e, g) && collectAdjacentFlatGroup(e, g, run).some(hasDefinedPort);
|
|
36117
36264
|
}
|
|
36118
|
-
function collectAdjacentFlatGroup(e, g) {
|
|
36265
|
+
function collectAdjacentFlatGroup(e, g, run) {
|
|
36119
36266
|
const u = e.tail, v = e.head;
|
|
36120
|
-
const lo = (u.info.order ?? 0) <= (v.info.order ?? 0) ? u : v;
|
|
36121
36267
|
const me = getMainEdge(e);
|
|
36122
36268
|
const sharesPair = (x) => x.tail === u && x.head === v || x.tail === v && x.head === u;
|
|
36123
|
-
|
|
36124
|
-
group.sort((a, b) => Number(b.tail === lo) - Number(a.tail === lo) || a.seq - b.seq);
|
|
36125
|
-
return group;
|
|
36269
|
+
return run.filter((x) => sharesPair(x) && isGroupableFlat(x, g) && getMainEdge(x) === me);
|
|
36126
36270
|
}
|
|
36127
|
-
function routeFaithfulSidePort(e, g) {
|
|
36271
|
+
function routeFaithfulSidePort(e, g, run) {
|
|
36128
36272
|
const sameRank = e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank;
|
|
36129
36273
|
if (sameRank && isFlatAdjacent(g, e)) {
|
|
36130
|
-
const group = collectAdjacentFlatGroup(e, g);
|
|
36274
|
+
const group = collectAdjacentFlatGroup(e, g, run);
|
|
36131
36275
|
return makeFlatAdjEdges(g, group, group.length, edgeType(g)) === 0 && routedThisPass(e);
|
|
36132
36276
|
}
|
|
36133
36277
|
if (sameRank) {
|
|
@@ -36143,27 +36287,20 @@ function routeFaithfulSidePort(e, g) {
|
|
|
36143
36287
|
clipAndInstall(e, e.head, pts, pts.length, buildDotSinfo());
|
|
36144
36288
|
return true;
|
|
36145
36289
|
}
|
|
36146
|
-
function
|
|
36147
|
-
|
|
36148
|
-
if (tr === void 0 || tr !== e.head.info.rank) return false;
|
|
36149
|
-
if (!isFlatAdjacent(g, e)) return false;
|
|
36150
|
-
const rec = (s) => s?.kind === 2 /* SH_RECORD */;
|
|
36151
|
-
return rec(e.tail.info.shape) || rec(e.head.info.shape);
|
|
36152
|
-
}
|
|
36153
|
-
function routeFlatEdge(e, g) {
|
|
36154
|
-
if (isLostFlatAdjRecordEdge(g, e)) return true;
|
|
36290
|
+
function routeFlatEdge(e, g, run) {
|
|
36291
|
+
if (lostFlatAdjRecordEdge(g, e)) return true;
|
|
36155
36292
|
if (makeFlatLabeledEdge(g, e)) return true;
|
|
36156
|
-
if (joinsPortedFlatGroup(e, g) && routeFaithfulSidePort(e, g)) return true;
|
|
36293
|
+
if (joinsPortedFlatGroup(e, g, run) && routeFaithfulSidePort(e, g, run)) return true;
|
|
36157
36294
|
if (makeAdjFlatNoPortEdge(g, e)) return true;
|
|
36158
|
-
if ((hasSidePort(e) || isAdjacentPortFlat(e, g)) && routeFaithfulSidePort(e, g)) return true;
|
|
36295
|
+
if ((hasSidePort(e) || isAdjacentPortFlat(e, g)) && routeFaithfulSidePort(e, g, run)) return true;
|
|
36159
36296
|
if (e.tail.info.rank !== void 0 && e.tail.info.rank === e.head.info.rank && e.info.label === void 0 && !isFlatAdjacent(g, e)) {
|
|
36160
36297
|
const group = collectNonAdjacentFlatGroup(e, g);
|
|
36161
36298
|
if (group.length > 0 && routeFlatEdgeGroupFaithful(g, group, group.length, edgeType(g)) && routedThisPass(e)) return true;
|
|
36162
36299
|
}
|
|
36163
36300
|
return false;
|
|
36164
36301
|
}
|
|
36165
|
-
function routeForwardEdge(e, g, tailBox, headBox,
|
|
36166
|
-
if (routeFlatEdge(e, g)) return;
|
|
36302
|
+
function routeForwardEdge(e, g, tailBox, headBox, run) {
|
|
36303
|
+
if (routeFlatEdge(e, g, run)) return;
|
|
36167
36304
|
if (routeFaithfulRegularPlain(e, g)) return;
|
|
36168
36305
|
const rankInfo = rankEdgeInfoOf(g, e.tail, e.head);
|
|
36169
36306
|
const result = straightEdgeSplineWithRank(
|
|
@@ -36174,15 +36311,21 @@ function routeForwardEdge(e, g, tailBox, headBox, pw) {
|
|
|
36174
36311
|
portRouteOf(e)
|
|
36175
36312
|
);
|
|
36176
36313
|
installEdgeSpline(e, result.bezierPts, result.arrowTip);
|
|
36177
|
-
e.info.headArrowOps = arrowDrawOpsForEnd(
|
|
36314
|
+
e.info.headArrowOps = arrowDrawOpsForEnd(
|
|
36315
|
+
e,
|
|
36316
|
+
"head",
|
|
36317
|
+
result.arrowTip,
|
|
36318
|
+
result.arrowDir,
|
|
36319
|
+
edgeRenderPenwidth(e)
|
|
36320
|
+
);
|
|
36178
36321
|
}
|
|
36179
|
-
function routeLoneEdge(e, g) {
|
|
36322
|
+
function routeLoneEdge(e, g, run) {
|
|
36180
36323
|
if (routedThisPass(e) || e.info.lost === true) return;
|
|
36181
36324
|
const et = e.info.edge_type ?? 0;
|
|
36182
36325
|
if (et === FLATORDER || et === IGNORED) return;
|
|
36183
36326
|
if (e.tail === e.head) return;
|
|
36184
36327
|
if (!hasValidCoords(e)) return;
|
|
36185
|
-
routeOneEdge(e, g);
|
|
36328
|
+
routeOneEdge(e, g, run);
|
|
36186
36329
|
}
|
|
36187
36330
|
|
|
36188
36331
|
// src/common/arrows-geometry.ts
|
|
@@ -36433,7 +36576,7 @@ function dispatchEdgeGroup(g, group, ctx) {
|
|
|
36433
36576
|
}
|
|
36434
36577
|
const uniq = dedupByOrig(group);
|
|
36435
36578
|
if (nodeRankOf(e0.tail) === nodeRankOf(e0.head)) {
|
|
36436
|
-
for (const e of uniq) routeLoneEdge(e, g);
|
|
36579
|
+
for (const e of uniq) routeLoneEdge(e, g, uniq);
|
|
36437
36580
|
return;
|
|
36438
36581
|
}
|
|
36439
36582
|
if (uniq.length <= 1) {
|
|
@@ -36443,7 +36586,7 @@ function dispatchEdgeGroup(g, group, ctx) {
|
|
|
36443
36586
|
return;
|
|
36444
36587
|
}
|
|
36445
36588
|
const lone = resolveOrigEdge(uniq[0]);
|
|
36446
|
-
routeLoneEdge(lone, g);
|
|
36589
|
+
routeLoneEdge(lone, g, uniq);
|
|
36447
36590
|
return;
|
|
36448
36591
|
}
|
|
36449
36592
|
routeParallelEdgeGroup(g, uniq, ctx.multisep);
|
|
@@ -39281,7 +39424,7 @@ function sgdIteration(pos, terms, unfixed, eta) {
|
|
|
39281
39424
|
const mu2 = Math.min(eta * t.w, 1);
|
|
39282
39425
|
const dx = pos[2 * t.i] - pos[2 * t.j];
|
|
39283
39426
|
const dy = pos[2 * t.i + 1] - pos[2 * t.j + 1];
|
|
39284
|
-
const mag =
|
|
39427
|
+
const mag = libmHypot(dx, dy);
|
|
39285
39428
|
if (mag === 0) continue;
|
|
39286
39429
|
const r = mu2 * (mag - t.d) / (2 * mag);
|
|
39287
39430
|
const rx = r * dx;
|
|
@@ -40420,7 +40563,7 @@ function kkNeato(g, nG, model) {
|
|
|
40420
40563
|
// src/layout/neato/conjgrad-mkernel.ts
|
|
40421
40564
|
var fr3 = Math.fround;
|
|
40422
40565
|
var RIGHT_MULT_BLOCK = 16;
|
|
40423
|
-
var ZERO_LENGTH_MESSAGE = "conjugate_gradient: unexpected length 0 vector
|
|
40566
|
+
var ZERO_LENGTH_MESSAGE = "conjugate_gradient: unexpected length 0 vector";
|
|
40424
40567
|
function rightMultWithVectorFFFused(m, n, vector, result) {
|
|
40425
40568
|
for (let i = 0; i < n; i++) result[i] = 0;
|
|
40426
40569
|
let index = 0;
|
|
@@ -52498,7 +52641,7 @@ function getEdgeList(n, g) {
|
|
|
52498
52641
|
const m = e.head === n ? e.tail : e.head;
|
|
52499
52642
|
const dx = m.info.pos[0] - n.info.pos[0];
|
|
52500
52643
|
const dy = m.info.pos[1] - n.info.pos[1];
|
|
52501
|
-
erecs.push({ e, alpha: Math.atan2(dy, dx), dist2: dx
|
|
52644
|
+
erecs.push({ e, alpha: Math.atan2(dy, dx), dist2: fma(dx, dx, dy * dy) });
|
|
52502
52645
|
}
|
|
52503
52646
|
if (erecs.length !== deg) {
|
|
52504
52647
|
throw new InternalError(`fdp getEdgeList: ${erecs.length} edges vs deg ${deg}`);
|
|
@@ -52513,7 +52656,13 @@ function genPorts(n, er, pp, idx, bnd) {
|
|
|
52513
52656
|
const other = e.head === n ? e.tail : e.head;
|
|
52514
52657
|
const delta2 = Math.min((bnd - er.alpha) / cnt, ANG);
|
|
52515
52658
|
const fwd = n.id < other.id;
|
|
52516
|
-
const fan = fwd ? { i: idx, inc: 1, angle: er.alpha, delta: delta2 } : {
|
|
52659
|
+
const fan = fwd ? { i: idx, inc: 1, angle: er.alpha, delta: delta2 } : {
|
|
52660
|
+
// contracted (-ffp-contract=on): angle += delta * (cnt - 1) is one fmadd
|
|
52661
|
+
i: idx + cnt - 1,
|
|
52662
|
+
inc: -1,
|
|
52663
|
+
angle: fma(delta2, cnt - 1, er.alpha),
|
|
52664
|
+
delta: -delta2
|
|
52665
|
+
};
|
|
52517
52666
|
fillPorts(n, e, pp, fan);
|
|
52518
52667
|
return idx + cnt;
|
|
52519
52668
|
}
|
|
@@ -55738,6 +55887,8 @@ function mapOutputImap(shape, pts, url, out) {
|
|
|
55738
55887
|
var PlainRenderer = class {
|
|
55739
55888
|
type = "plain";
|
|
55740
55889
|
quality = 0;
|
|
55890
|
+
defaultPad = 0;
|
|
55891
|
+
// @see plugin/core/gvrender_core_dot.c:734 render_features_dot
|
|
55741
55892
|
beginGraph(_g, _job) {
|
|
55742
55893
|
}
|
|
55743
55894
|
endGraph(g, job) {
|
|
@@ -55765,6 +55916,8 @@ var PlainRenderer = class {
|
|
|
55765
55916
|
var PlainExtRenderer = class {
|
|
55766
55917
|
type = "plain-ext";
|
|
55767
55918
|
quality = 0;
|
|
55919
|
+
defaultPad = 0;
|
|
55920
|
+
// @see plugin/core/gvrender_core_dot.c:734 render_features_dot
|
|
55768
55921
|
beginGraph(_g, _job) {
|
|
55769
55922
|
}
|
|
55770
55923
|
endGraph(g, job) {
|
|
@@ -55816,6 +55969,7 @@ function anchorOf(url, tooltip, target, id) {
|
|
|
55816
55969
|
}
|
|
55817
55970
|
var MapRendererBase = class {
|
|
55818
55971
|
quality = 0;
|
|
55972
|
+
defaultPad = 4;
|
|
55819
55973
|
mapCtx = null;
|
|
55820
55974
|
beginGraph(g, job) {
|
|
55821
55975
|
job.flags |= EMIT_CLUSTERS_LAST;
|
|
@@ -55970,8 +56124,6 @@ function createCmapxNpRenderer() {
|
|
|
55970
56124
|
|
|
55971
56125
|
// src/render/dot/xdot-ops.ts
|
|
55972
56126
|
var XDOT_VERSION = "1.7";
|
|
55973
|
-
var MAX_NEGNUM = 1e15;
|
|
55974
|
-
var NEAR_ZERO = 5e-3;
|
|
55975
56127
|
var NUM_XBUFS = 8;
|
|
55976
56128
|
var NON_LINE_STYLES = /* @__PURE__ */ new Set([
|
|
55977
56129
|
"filled",
|
|
@@ -55984,24 +56136,6 @@ var NON_LINE_STYLES = /* @__PURE__ */ new Set([
|
|
|
55984
56136
|
"invisible",
|
|
55985
56137
|
"radial"
|
|
55986
56138
|
]);
|
|
55987
|
-
function trimAndStrip(s) {
|
|
55988
|
-
const dot = s.indexOf(".");
|
|
55989
|
-
if (dot < 0) return s;
|
|
55990
|
-
let end = s.length;
|
|
55991
|
-
while (end > dot + 1 && s[end - 1] === "0") end--;
|
|
55992
|
-
if (s[end - 1] === ".") end--;
|
|
55993
|
-
const t = s.slice(0, end);
|
|
55994
|
-
if (t.startsWith("0.")) return t.slice(1);
|
|
55995
|
-
if (t.startsWith("-0.")) return "-" + t.slice(2);
|
|
55996
|
-
return t;
|
|
55997
|
-
}
|
|
55998
|
-
function printNum(n) {
|
|
55999
|
-
if (Math.abs(n) > MAX_NEGNUM) {
|
|
56000
|
-
return n < 0 ? String(-MAX_NEGNUM) : String(MAX_NEGNUM);
|
|
56001
|
-
}
|
|
56002
|
-
if (Math.abs(n) < NEAR_ZERO) return "0";
|
|
56003
|
-
return trimAndStrip(n.toFixed(3));
|
|
56004
|
-
}
|
|
56005
56139
|
function makeXbufs() {
|
|
56006
56140
|
const bufs = Array.from({ length: NUM_XBUFS + 4 }, () => []);
|
|
56007
56141
|
bufs[8 /* NDraw */] = bufs[1 /* CDraw */];
|
|
@@ -56095,11 +56229,9 @@ function xdotStrOp(prefix, s) {
|
|
|
56095
56229
|
return prefix + String(utf8Len(s)) + " -" + s + " ";
|
|
56096
56230
|
}
|
|
56097
56231
|
function xdotId(s) {
|
|
56098
|
-
if (
|
|
56099
|
-
|
|
56100
|
-
|
|
56101
|
-
const trailingBackslashes = /\\*$/.exec(body)[0].length;
|
|
56102
|
-
return '"' + body + (trailingBackslashes % 2 === 1 ? "\\" : "") + '"';
|
|
56232
|
+
if (isHtmlValue(s)) return agstrcanon(s);
|
|
56233
|
+
const oddTrailingRun = /\\*$/.exec(s)[0].length % 2 === 1;
|
|
56234
|
+
return agstrcanon(oddTrailingRun ? `${s}\\` : s);
|
|
56103
56235
|
}
|
|
56104
56236
|
function gfmt5(v) {
|
|
56105
56237
|
if (!Number.isFinite(v)) return printfSig(v, 5);
|
|
@@ -56124,27 +56256,6 @@ function lpStr(p) {
|
|
|
56124
56256
|
function escBackslash(s) {
|
|
56125
56257
|
return s.replace(/\\/g, "\\\\");
|
|
56126
56258
|
}
|
|
56127
|
-
function isEscapeSeq(s, i) {
|
|
56128
|
-
if (s[i] !== "\\") return false;
|
|
56129
|
-
const n = s[i + 1];
|
|
56130
|
-
return n === "E" || n === "G" || n === "H" || n === "L" || n === "N" || n === "T" || n === "l" || n === "n" || n === "r" || n === "\\" || n === '"';
|
|
56131
|
-
}
|
|
56132
|
-
function agcanonEscape(s) {
|
|
56133
|
-
let out = "";
|
|
56134
|
-
let partOfEscape = false;
|
|
56135
|
-
for (let i = 0; i < s.length; i++) {
|
|
56136
|
-
const c = s[i];
|
|
56137
|
-
if (c === '"' && !partOfEscape) {
|
|
56138
|
-
out += "\\";
|
|
56139
|
-
} else if (!partOfEscape && isEscapeSeq(s, i)) {
|
|
56140
|
-
partOfEscape = true;
|
|
56141
|
-
} else {
|
|
56142
|
-
partOfEscape = false;
|
|
56143
|
-
}
|
|
56144
|
-
out += c;
|
|
56145
|
-
}
|
|
56146
|
-
return out;
|
|
56147
|
-
}
|
|
56148
56259
|
function trimFixed3(v) {
|
|
56149
56260
|
let s = v.toFixed(3);
|
|
56150
56261
|
if (s.indexOf(".") < 0) return s;
|
|
@@ -56290,7 +56401,7 @@ function nodeDictParts(g, top) {
|
|
|
56290
56401
|
function echoAttr(attrs, key) {
|
|
56291
56402
|
const v = attrs.get(key);
|
|
56292
56403
|
if (v === void 0 || v.length === 0) return [];
|
|
56293
|
-
return [key
|
|
56404
|
+
return [`${key}=${agstrcanon(v)}`];
|
|
56294
56405
|
}
|
|
56295
56406
|
function writeDictSkips(v, inherited) {
|
|
56296
56407
|
return v.length === 0 && inherited === "";
|
|
@@ -56299,7 +56410,7 @@ function echoGraphAttr(g, key) {
|
|
|
56299
56410
|
const v = g.attrs.get(key);
|
|
56300
56411
|
if (v === void 0) return [];
|
|
56301
56412
|
if (writeDictSkips(v, g.graphDefaultsSnapshot?.get(key))) return [];
|
|
56302
|
-
return [key
|
|
56413
|
+
return [`${key}=${agstrcanon(v)}`];
|
|
56303
56414
|
}
|
|
56304
56415
|
function graphLabelAttrs(g) {
|
|
56305
56416
|
const label = g.info.label;
|
|
@@ -56393,9 +56504,13 @@ var DotWriterBase = class {
|
|
|
56393
56504
|
for (const sub of g.subgraphs.values()) ix0 = this.subgdfs(sub, ix0, preorder);
|
|
56394
56505
|
return ix0 + 1;
|
|
56395
56506
|
}
|
|
56396
|
-
/** A
|
|
56507
|
+
/** A graph is anonymous when `agnameof` gives a `%` local name: a nameless
|
|
56508
|
+
* root (`%1`), a nameless subgraph (the parser names it `%N`), or a name
|
|
56509
|
+
* that itself starts with `%`. A graph named `""` is named: cgraph maps `""`
|
|
56510
|
+
* as a name, so it keeps its header and is never inlined.
|
|
56511
|
+
* @see write.c:is_anonymous ; write.c:write_hdr ; lib/cgraph/id.c:idmap */
|
|
56397
56512
|
isAnonymous(g) {
|
|
56398
|
-
return g.
|
|
56513
|
+
return agNameOf(g).startsWith(LOCALNAMEPREFIX);
|
|
56399
56514
|
}
|
|
56400
56515
|
/** A graph carries a `bb` attribute when it is the root or has a layout bb
|
|
56401
56516
|
* (clusters, and any subgraph output.c computed a box for). Native seeds `bb`
|
|
@@ -56448,7 +56563,7 @@ var DotWriterBase = class {
|
|
|
56448
56563
|
if (top) {
|
|
56449
56564
|
const strict = g.kind === "strict-directed" || g.kind === "strict-undirected" ? "strict " : "";
|
|
56450
56565
|
const kw = isDirected(g) ? "digraph" : "graph";
|
|
56451
|
-
const nm =
|
|
56566
|
+
const nm = this.isAnonymous(g) ? "" : xdotId(g.name) + " ";
|
|
56452
56567
|
ctx.out.push(strict + kw + " " + nm + "{\n");
|
|
56453
56568
|
ctx.level++;
|
|
56454
56569
|
} else {
|
|
@@ -56901,12 +57016,21 @@ var EdgeDrawBase = class extends DotWriterBase {
|
|
|
56901
57016
|
|
|
56902
57017
|
// src/render/dot/write-back.ts
|
|
56903
57018
|
var POINTS_PER_INCH15 = 72;
|
|
57019
|
+
function nodeLayoutAttrs(n) {
|
|
57020
|
+
const info = n.info;
|
|
57021
|
+
return {
|
|
57022
|
+
pos: nodePosRaw(n),
|
|
57023
|
+
height: gfmt5(info.ht / POINTS_PER_INCH15),
|
|
57024
|
+
width: gfmt5((info.lw + info.rw) / POINTS_PER_INCH15)
|
|
57025
|
+
};
|
|
57026
|
+
}
|
|
56904
57027
|
function attachNode(n) {
|
|
56905
57028
|
const attrs = ownAttrs(n);
|
|
56906
57029
|
const info = n.info;
|
|
56907
|
-
|
|
56908
|
-
attrs.set("
|
|
56909
|
-
attrs.set("
|
|
57030
|
+
const layout2 = nodeLayoutAttrs(n);
|
|
57031
|
+
attrs.set("pos", layout2.pos);
|
|
57032
|
+
attrs.set("height", layout2.height);
|
|
57033
|
+
attrs.set("width", layout2.width);
|
|
56910
57034
|
const xlabel = info.xlabel;
|
|
56911
57035
|
if (xlabel?.set) attrs.set("xlp", lpStr(xlabel.pos));
|
|
56912
57036
|
if (info.shape?.name === "record") {
|
|
@@ -56998,6 +57122,8 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
56998
57122
|
type = "xdot";
|
|
56999
57123
|
/** @see plugin/core/gvplugin_core.c registration table */
|
|
57000
57124
|
quality = 0;
|
|
57125
|
+
/** `-Tdot` too (`:734`). @see plugin/core/gvrender_core_dot.c:745 render_features_xdot */
|
|
57126
|
+
defaultPad = 0;
|
|
57001
57127
|
/**
|
|
57002
57128
|
* Whether this format attaches the xdot draw attributes before agwrite.
|
|
57003
57129
|
* Mirrors C's `job->render.id` switch: FORMAT_DOT runs `attach_attrs(g)` then
|
|
@@ -57029,8 +57155,8 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
57029
57155
|
this.draws = /* @__PURE__ */ new Map();
|
|
57030
57156
|
this.clusters = [];
|
|
57031
57157
|
}
|
|
57032
|
-
/**
|
|
57033
|
-
*
|
|
57158
|
+
/** This render's draw strings by ORIGINAL object. `-Tjson` lays them over the re-parsed xdot text,
|
|
57159
|
+
* which cannot represent draw text containing `"` (id 2239); stored strings reach it by that text. */
|
|
57034
57160
|
drawStringsByObject() {
|
|
57035
57161
|
return this.draws;
|
|
57036
57162
|
}
|
|
@@ -57054,7 +57180,7 @@ var XdotRenderer = class extends EdgeDrawBase {
|
|
|
57054
57180
|
const bg = g.attrs.get("bgcolor");
|
|
57055
57181
|
let fillSpec = bg !== void 0 && bg !== "" ? bg : "white";
|
|
57056
57182
|
if (fillSpec === "transparent") fillSpec = "white";
|
|
57057
|
-
const c = deviceClip(g,
|
|
57183
|
+
const c = deviceClip(g, job);
|
|
57058
57184
|
const corners = [
|
|
57059
57185
|
{ x: c.ll.x, y: c.ll.y },
|
|
57060
57186
|
{ x: c.ll.x, y: c.ur.y },
|
|
@@ -57381,6 +57507,8 @@ var SvgRenderer = class {
|
|
|
57381
57507
|
type = "svg";
|
|
57382
57508
|
/** @see plugin/core/gvplugin_core.c registration table */
|
|
57383
57509
|
quality = 0;
|
|
57510
|
+
/** @see plugin/core/gvrender_core_svg.c:810 render_features_svg (default pad) */
|
|
57511
|
+
defaultPad = SVG_PAD;
|
|
57384
57512
|
/** Whether the current edge's <g> group was opened (deferred-emit state). */
|
|
57385
57513
|
edgeGroupOpen = false;
|
|
57386
57514
|
beginGraph(g, job) {
|
|
@@ -57417,7 +57545,7 @@ var SvgRenderer = class {
|
|
|
57417
57545
|
/**
|
|
57418
57546
|
* Close the edge group. Edge graphics (path + arrowhead) are emitted here
|
|
57419
57547
|
* because the full spline is available on e.info.spl only after layout has
|
|
57420
|
-
*
|
|
57548
|
+
* routed the edges.
|
|
57421
57549
|
*
|
|
57422
57550
|
* For multi-color edges (color="c1:c2:…"), emits parallel offset Béziers
|
|
57423
57551
|
* (one per color, SEP=2.0 apart) then arrows in headcolor/tailcolor.
|
|
@@ -57546,8 +57674,25 @@ function attachBeforeWriteWithClusterEdges(g, attach) {
|
|
|
57546
57674
|
function jsonNodes(g) {
|
|
57547
57675
|
return [...g.nodes.values()].filter((n) => !n.info.clustnode);
|
|
57548
57676
|
}
|
|
57549
|
-
function
|
|
57550
|
-
return
|
|
57677
|
+
function lookupCluster(map, name) {
|
|
57678
|
+
return map.get(name) ?? -1;
|
|
57679
|
+
}
|
|
57680
|
+
function insertCluster(map, name, v) {
|
|
57681
|
+
const ip = map.get(name);
|
|
57682
|
+
if (ip !== void 0) {
|
|
57683
|
+
if (ip !== v) agwarningf(`Duplicate cluster name "${name}"`);
|
|
57684
|
+
return;
|
|
57685
|
+
}
|
|
57686
|
+
map.set(name, v);
|
|
57687
|
+
}
|
|
57688
|
+
function labelSubgs(g, lbl, map, out) {
|
|
57689
|
+
if (g !== g.root) {
|
|
57690
|
+
const gid = lbl++;
|
|
57691
|
+
out.push(g);
|
|
57692
|
+
if (isACluster(g)) insertCluster(map, g.name, gid);
|
|
57693
|
+
}
|
|
57694
|
+
for (const [, sg] of g.subgraphs) lbl = labelSubgs(sg, lbl, map, out);
|
|
57695
|
+
return lbl;
|
|
57551
57696
|
}
|
|
57552
57697
|
|
|
57553
57698
|
// src/parser/dot.js
|
|
@@ -61289,8 +61434,9 @@ function buildFromAst(ast) {
|
|
|
61289
61434
|
else if (ast.directed) kind = "directed";
|
|
61290
61435
|
else if (ast.strict) kind = "strict-undirected";
|
|
61291
61436
|
else kind = "undirected";
|
|
61292
|
-
const
|
|
61293
|
-
|
|
61437
|
+
const id = ast.id ?? "";
|
|
61438
|
+
const graph = new Graph(isHtmlValue(id) ? htmlValueContent(id) : id, kind, ast.id == null);
|
|
61439
|
+
if (ast.id == null) processor.advanceAnonId();
|
|
61294
61440
|
buildGraph(ast.stmts, graph, graph, ast.directed, processor);
|
|
61295
61441
|
return graph;
|
|
61296
61442
|
}
|
|
@@ -61746,6 +61892,31 @@ function parse(src) {
|
|
|
61746
61892
|
return buildFromAst(ast);
|
|
61747
61893
|
}
|
|
61748
61894
|
|
|
61895
|
+
// src/render/json-nonfinite.ts
|
|
61896
|
+
var JSON_INDENT = 2;
|
|
61897
|
+
var INF_TOKEN = "inf";
|
|
61898
|
+
var NEG_INF_TOKEN = "-inf";
|
|
61899
|
+
var NAN_TOKEN = "nan";
|
|
61900
|
+
var MARK = "\0";
|
|
61901
|
+
var ESCAPED_MARK = JSON.stringify(MARK).slice(1, -1).replace(/\\/g, "\\\\");
|
|
61902
|
+
var QUOTED_TOKEN = new RegExp(
|
|
61903
|
+
`"${ESCAPED_MARK}(${INF_TOKEN}|${NEG_INF_TOKEN}|${NAN_TOKEN})${ESCAPED_MARK}"`,
|
|
61904
|
+
"g"
|
|
61905
|
+
);
|
|
61906
|
+
function nonFiniteToken(v) {
|
|
61907
|
+
if (Number.isNaN(v)) return NAN_TOKEN;
|
|
61908
|
+
return v > 0 ? INF_TOKEN : NEG_INF_TOKEN;
|
|
61909
|
+
}
|
|
61910
|
+
function stringifyJsonTree(tree) {
|
|
61911
|
+
let sawNonFinite = false;
|
|
61912
|
+
const text = JSON.stringify(tree, (_key, v) => {
|
|
61913
|
+
if (typeof v !== "number" || Number.isFinite(v)) return v;
|
|
61914
|
+
sawNonFinite = true;
|
|
61915
|
+
return `${MARK}${nonFiniteToken(v)}${MARK}`;
|
|
61916
|
+
}, JSON_INDENT);
|
|
61917
|
+
return sawNonFinite ? text.replace(QUOTED_TOKEN, "$1") : text;
|
|
61918
|
+
}
|
|
61919
|
+
|
|
61749
61920
|
// src/render/json.ts
|
|
61750
61921
|
var XDOT_ATTR_NAMES = /* @__PURE__ */ new Set([
|
|
61751
61922
|
"_draw_",
|
|
@@ -61928,21 +62099,16 @@ function isEdgeLabelDeclared(g) {
|
|
|
61928
62099
|
};
|
|
61929
62100
|
return walk(g);
|
|
61930
62101
|
}
|
|
61931
|
-
function dfsSubgraphs(g, out) {
|
|
61932
|
-
for (const [, sg] of g.subgraphs) {
|
|
61933
|
-
out.push(sg);
|
|
61934
|
-
dfsSubgraphs(sg, out);
|
|
61935
|
-
}
|
|
61936
|
-
}
|
|
61937
62102
|
function assignIds(g, doXDot, draws) {
|
|
61938
62103
|
const dfsSubs = [];
|
|
61939
|
-
|
|
62104
|
+
const clusters = /* @__PURE__ */ new Map();
|
|
62105
|
+
const sgcnt = labelSubgs(g, 0, clusters, dfsSubs);
|
|
61940
62106
|
const subgGid = /* @__PURE__ */ new Map();
|
|
61941
62107
|
dfsSubs.forEach((sg, i) => subgGid.set(sg, i));
|
|
61942
|
-
|
|
62108
|
+
if (dfsSubs[0] === g) dfsSubs.shift();
|
|
61943
62109
|
const nodeGid = /* @__PURE__ */ new Map();
|
|
61944
62110
|
let ncnt = 0;
|
|
61945
|
-
for (const [, n] of g.nodes) nodeGid.set(n, n.info.clustnode ?
|
|
62111
|
+
for (const [, n] of g.nodes) nodeGid.set(n, n.info.clustnode ? lookupCluster(clusters, n.name) : sgcnt + ncnt++);
|
|
61946
62112
|
const edgeGid = /* @__PURE__ */ new Map();
|
|
61947
62113
|
let ecnt = 0;
|
|
61948
62114
|
for (const { e } of canonicalRootEdges(g)) edgeGid.set(e, ecnt++);
|
|
@@ -62031,9 +62197,8 @@ function buildNodeObject(n, ctx) {
|
|
|
62031
62197
|
const eff = nodeEffectiveAttrs(n);
|
|
62032
62198
|
const xd = ctx.draws?.node.get(n.name);
|
|
62033
62199
|
if (xd === void 0) {
|
|
62034
|
-
|
|
62035
|
-
eff.set("
|
|
62036
|
-
eff.set("height", printNum(n.info.height));
|
|
62200
|
+
const layout2 = nodeLayoutAttrs(n);
|
|
62201
|
+
eff.set("pos", layout2.pos).set("width", layout2.width).set("height", layout2.height);
|
|
62037
62202
|
}
|
|
62038
62203
|
emitAttrs(o, eff, xd, ctx);
|
|
62039
62204
|
attachNodeRects(o, n);
|
|
@@ -62116,11 +62281,13 @@ function latin1Reencode(s) {
|
|
|
62116
62281
|
function buildJson(g, doXDot, preDraws) {
|
|
62117
62282
|
const draws = doXDot ? preDraws ?? collectDrawLookup(g) : void 0;
|
|
62118
62283
|
const ctx = assignIds(g, doXDot, draws);
|
|
62119
|
-
return
|
|
62284
|
+
return stringifyJsonTree(buildGraphObject(g, true, ctx)) + "\n";
|
|
62120
62285
|
}
|
|
62121
62286
|
var JsonRendererBase = class {
|
|
62122
62287
|
/** @see plugin/core/gvplugin_core.c registration table */
|
|
62123
62288
|
quality = 0;
|
|
62289
|
+
/** @see plugin/core/gvrender_core_json.c:745 render_features_json (default pad) */
|
|
62290
|
+
defaultPad = 0;
|
|
62124
62291
|
beginNode(_n, _job) {
|
|
62125
62292
|
}
|
|
62126
62293
|
endNode(_n, _job) {
|