@knowvah/dot-engine 1.2.3 → 1.2.4
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/cdt/bag.d.ts +6 -4
- package/dist/cdt/bag.d.ts.map +1 -1
- package/dist/common/htmltable-lex.d.ts.map +1 -1
- package/dist/common/record.d.ts.map +1 -1
- package/dist/index.js +1986 -2006
- package/dist/index.js.map +4 -4
- package/dist/render.js +41 -61
- package/dist/render.js.map +3 -3
- package/dist/xdot/parse.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/cdt/bag.ts +30 -52
- package/src/common/htmltable-lex.ts +17 -4
- package/src/common/htmltable-parse.ts +1 -1
- package/src/common/record.ts +3 -5
- package/src/xdot/parse.ts +3 -1
- package/dist/gvc/textlayout.d.ts +0 -33
- package/dist/gvc/textlayout.d.ts.map +0 -1
- package/dist/layout/osage/layout.d.ts +0 -49
- package/dist/layout/osage/layout.d.ts.map +0 -1
- package/dist/layout/pack/test-helpers.d.ts +0 -7
- package/dist/layout/pack/test-helpers.d.ts.map +0 -1
- package/dist/layout/patchwork/tree-node.d.ts +0 -46
- package/dist/layout/patchwork/tree-node.d.ts.map +0 -1
- package/dist/xdot/lex.d.ts +0 -22
- package/dist/xdot/lex.d.ts.map +0 -1
- package/src/gvc/textlayout.ts +0 -44
- package/src/layout/osage/layout.ts +0 -254
- package/src/layout/pack/test-helpers.ts +0 -46
- package/src/layout/patchwork/tree-node.ts +0 -120
- package/src/xdot/lex.ts +0 -151
package/dist/render.js
CHANGED
|
@@ -5450,12 +5450,15 @@ function parseAttrs(raw) {
|
|
|
5450
5450
|
}
|
|
5451
5451
|
return out;
|
|
5452
5452
|
}
|
|
5453
|
+
function normalizeTag(tag) {
|
|
5454
|
+
return tag === "TH" ? "TR" : tag;
|
|
5455
|
+
}
|
|
5453
5456
|
function parseCloseToken(inner) {
|
|
5454
5457
|
const body = inner.slice(1).trim();
|
|
5455
5458
|
const sp = body.search(/\s/);
|
|
5456
5459
|
const tag = (sp === -1 ? body : body.slice(0, sp)).toUpperCase();
|
|
5457
5460
|
checkTag(tag);
|
|
5458
|
-
return { type: "close", tag };
|
|
5461
|
+
return { type: "close", tag: normalizeTag(tag) };
|
|
5459
5462
|
}
|
|
5460
5463
|
function cleanText(raw) {
|
|
5461
5464
|
const isKeep = (c) => c === " " || c === " " || c === "\n" || c === "\r";
|
|
@@ -5489,12 +5492,13 @@ function scanTag(src, start, tokens) {
|
|
|
5489
5492
|
function parseOpenToken(inner) {
|
|
5490
5493
|
const sp = inner.search(/\s/);
|
|
5491
5494
|
if (sp === -1) {
|
|
5492
|
-
|
|
5493
|
-
|
|
5495
|
+
const tag2 = inner.toUpperCase();
|
|
5496
|
+
checkTag(tag2);
|
|
5497
|
+
return { type: "open", tag: normalizeTag(tag2), attrs: parseAttrs("") };
|
|
5494
5498
|
}
|
|
5495
5499
|
const tag = inner.slice(0, sp).toUpperCase();
|
|
5496
5500
|
checkTag(tag);
|
|
5497
|
-
return { type: "open", tag, attrs: parseAttrs(inner.slice(sp + 1)) };
|
|
5501
|
+
return { type: "open", tag: normalizeTag(tag), attrs: parseAttrs(inner.slice(sp + 1)) };
|
|
5498
5502
|
}
|
|
5499
5503
|
function tokenize(src) {
|
|
5500
5504
|
const tokens = [];
|
|
@@ -5719,7 +5723,7 @@ var buildCell = (content, a) => ({
|
|
|
5719
5723
|
});
|
|
5720
5724
|
var parseCell = (s, attrs, fontStack) => buildCell(parseCellContent(s, attrs, fontStack), attrs);
|
|
5721
5725
|
var processRowToken = (s, t, cells, fontStack) => {
|
|
5722
|
-
if (t.type === "open" &&
|
|
5726
|
+
if (t.type === "open" && t.tag === "TD") {
|
|
5723
5727
|
consume(s);
|
|
5724
5728
|
cells.push(parseCell(s, t.attrs, fontStack));
|
|
5725
5729
|
return;
|
|
@@ -10749,10 +10753,7 @@ function posReclbl(f, ul, sides) {
|
|
|
10749
10753
|
}
|
|
10750
10754
|
}
|
|
10751
10755
|
function attrBool(n, g, key) {
|
|
10752
|
-
|
|
10753
|
-
if (!s || s.toLowerCase() === "false" || s.toLowerCase() === "no") return false;
|
|
10754
|
-
if (s.toLowerCase() === "true" || s.toLowerCase() === "yes") return true;
|
|
10755
|
-
return parseInt(s, 10) !== 0;
|
|
10756
|
+
return mapbool2(nodeAttr(n, g, key));
|
|
10756
10757
|
}
|
|
10757
10758
|
function recAttrSize(n, g) {
|
|
10758
10759
|
const w = nodeAttr(n, g, "width");
|
|
@@ -16321,7 +16322,7 @@ function class2(g) {
|
|
|
16321
16322
|
|
|
16322
16323
|
// src/common/edge-label-init.ts
|
|
16323
16324
|
var MIN_FONTSIZE = 1;
|
|
16324
|
-
function
|
|
16325
|
+
function mapbool3(s) {
|
|
16325
16326
|
if (!s || s.toLowerCase() === "false" || s.toLowerCase() === "no") return false;
|
|
16326
16327
|
if (s.toLowerCase() === "true" || s.toLowerCase() === "yes") return true;
|
|
16327
16328
|
const n = parseInt(s, 10);
|
|
@@ -16352,7 +16353,7 @@ function applyLabel(e, g, fi, measurer) {
|
|
|
16352
16353
|
const content = isHtml ? htmlValueContent(str) : str;
|
|
16353
16354
|
e.info.label = makeAnyLabel(content, isHtml, fi, measurer, e);
|
|
16354
16355
|
g.root.info.has_labels |= EDGE_LABEL;
|
|
16355
|
-
e.info.label_ontop =
|
|
16356
|
+
e.info.label_ontop = mapbool3(e.attrs.get("labelfloat")) ? 1 : 0;
|
|
16356
16357
|
}
|
|
16357
16358
|
function applyXLabel(e, g, fi, measurer) {
|
|
16358
16359
|
const str = e.attrs.get("xlabel");
|
|
@@ -16548,7 +16549,7 @@ function graphInit(g, useRankdir) {
|
|
|
16548
16549
|
if (fn !== -1) g.info.fontnames = fn;
|
|
16549
16550
|
parseRatioDrawing(g);
|
|
16550
16551
|
setClType(maptoken(g.attrs.get("clusterrank"), RANK_NAMES, rankCodes()));
|
|
16551
|
-
g.info.concentrate =
|
|
16552
|
+
g.info.concentrate = mapbool2(g.attrs.get("concentrate"));
|
|
16552
16553
|
g.info.edgeLabelsDone = false;
|
|
16553
16554
|
doGraphLabel(g, layoutMeasurer(g));
|
|
16554
16555
|
}
|
|
@@ -16590,7 +16591,7 @@ function sameNonemptyGroup(e) {
|
|
|
16590
16591
|
}
|
|
16591
16592
|
function initEdgeConstraint(e) {
|
|
16592
16593
|
const s = e.attrs.get("constraint");
|
|
16593
|
-
if (s !== void 0 && s !== "") e.info.constraint =
|
|
16594
|
+
if (s !== void 0 && s !== "") e.info.constraint = mapbool2(s);
|
|
16594
16595
|
}
|
|
16595
16596
|
function applyGroupPenalty(e) {
|
|
16596
16597
|
if (!sameNonemptyGroup(e)) return;
|
|
@@ -21981,10 +21982,10 @@ function xgWeak(Xg, t, h, orig, st) {
|
|
|
21981
21982
|
function isNonConstraint(e) {
|
|
21982
21983
|
const v = e.attrs.get("constraint");
|
|
21983
21984
|
if (!v) return false;
|
|
21984
|
-
return !
|
|
21985
|
+
return !mapbool2(v);
|
|
21985
21986
|
}
|
|
21986
21987
|
function isAStrongCluster(g) {
|
|
21987
|
-
return
|
|
21988
|
+
return mapbool2(g.attrs.get("compact") ?? "");
|
|
21988
21989
|
}
|
|
21989
21990
|
function dotLca(c0, c1) {
|
|
21990
21991
|
let a = c0;
|
|
@@ -22259,7 +22260,7 @@ var clType = LOCAL;
|
|
|
22259
22260
|
function setClType(t) {
|
|
22260
22261
|
clType = t;
|
|
22261
22262
|
}
|
|
22262
|
-
function
|
|
22263
|
+
function mapbool2(s) {
|
|
22263
22264
|
if (!s || s === "") return false;
|
|
22264
22265
|
const l = s.toLowerCase();
|
|
22265
22266
|
if (l === "false" || l === "no") return false;
|
|
@@ -22275,7 +22276,7 @@ function scaleClamp(nnodes, scale) {
|
|
|
22275
22276
|
function isACluster(g) {
|
|
22276
22277
|
if (g === g.root) return true;
|
|
22277
22278
|
if (g.name.toLowerCase().startsWith("cluster")) return true;
|
|
22278
|
-
return
|
|
22279
|
+
return mapbool2(g.attrs.get("cluster"));
|
|
22279
22280
|
}
|
|
22280
22281
|
function cleanup1ClearNode(n) {
|
|
22281
22282
|
if (n.info.in) n.info.in.size = 0;
|
|
@@ -22623,7 +22624,7 @@ function dot1Rank(g) {
|
|
|
22623
22624
|
cleanup1(g);
|
|
22624
22625
|
}
|
|
22625
22626
|
function dotRank(g) {
|
|
22626
|
-
if (
|
|
22627
|
+
if (mapbool2(g.attrs.get("newrank"))) {
|
|
22627
22628
|
g.info.flags = (g.info.flags ?? 0) | NEW_RANK;
|
|
22628
22629
|
dot2Rank(g);
|
|
22629
22630
|
} else {
|
|
@@ -28167,31 +28168,13 @@ function splay(root, key, keyOf, compare) {
|
|
|
28167
28168
|
}
|
|
28168
28169
|
|
|
28169
28170
|
// src/cdt/bag.ts
|
|
28170
|
-
function
|
|
28171
|
-
|
|
28172
|
-
|
|
28173
|
-
|
|
28174
|
-
|
|
28175
|
-
|
|
28176
|
-
|
|
28177
|
-
cur = cur.left;
|
|
28178
|
-
}
|
|
28179
|
-
return [null, null];
|
|
28180
|
-
}
|
|
28181
|
-
function unlinkNode(root, cur, parent) {
|
|
28182
|
-
const left = cur.left;
|
|
28183
|
-
const right = cur.right;
|
|
28184
|
-
let replacement;
|
|
28185
|
-
if (left === null) {
|
|
28186
|
-
replacement = right;
|
|
28187
|
-
} else {
|
|
28188
|
-
const maxLeft = splayMax(left);
|
|
28189
|
-
maxLeft.right = right;
|
|
28190
|
-
replacement = maxLeft;
|
|
28191
|
-
}
|
|
28192
|
-
if (parent === null) return replacement;
|
|
28193
|
-
parent.left = replacement;
|
|
28194
|
-
return root;
|
|
28171
|
+
function removeRoot(root) {
|
|
28172
|
+
const left = root.left;
|
|
28173
|
+
const right = root.right;
|
|
28174
|
+
if (left === null) return right;
|
|
28175
|
+
const maxLeft = splayMax(left);
|
|
28176
|
+
maxLeft.right = right;
|
|
28177
|
+
return maxLeft;
|
|
28195
28178
|
}
|
|
28196
28179
|
var DtBag = class {
|
|
28197
28180
|
_root = null;
|
|
@@ -28230,16 +28213,13 @@ var DtBag = class {
|
|
|
28230
28213
|
const key = this._keyOf(obj);
|
|
28231
28214
|
this._root = splay(this._root, key, this._keyOf, this._compare);
|
|
28232
28215
|
if (this._compare(key, this._keyOf(this._root.obj)) !== 0) return false;
|
|
28233
|
-
|
|
28234
|
-
this._root
|
|
28235
|
-
|
|
28236
|
-
|
|
28237
|
-
|
|
28238
|
-
|
|
28239
|
-
);
|
|
28240
|
-
if (cur === null) return false;
|
|
28241
|
-
const newRoot = unlinkNode(this._root, cur, parent);
|
|
28242
|
-
this._root = newRoot;
|
|
28216
|
+
while (this._root.obj !== obj) {
|
|
28217
|
+
const nxt = this.next(this._root.obj);
|
|
28218
|
+
if (nxt === void 0 || this._compare(key, this._keyOf(nxt)) !== 0) {
|
|
28219
|
+
return false;
|
|
28220
|
+
}
|
|
28221
|
+
}
|
|
28222
|
+
this._root = removeRoot(this._root);
|
|
28243
28223
|
this._size--;
|
|
28244
28224
|
return true;
|
|
28245
28225
|
}
|
|
@@ -29090,7 +29070,7 @@ function runPlacement(gp) {
|
|
|
29090
29070
|
const nObjs = gp.nodes.size + nSetLbls + nClbls + nElbls;
|
|
29091
29071
|
const { ctx } = buildArrays(gp, nObjs, nLbls, nClbls, et);
|
|
29092
29072
|
const forceStr = gp.attrs.get("forcelabels");
|
|
29093
|
-
const force = forceStr === void 0 ? true :
|
|
29073
|
+
const force = forceStr === void 0 ? true : mapbool2(forceStr);
|
|
29094
29074
|
const params = { bb: { ll: ctx.bb.ll, ur: ctx.bb.ur }, force };
|
|
29095
29075
|
placeLabels(ctx.objs, ctx.lbls, params);
|
|
29096
29076
|
writeBackLabels(gp, ctx.lbls, nLbls);
|
|
@@ -34320,7 +34300,7 @@ function dotPhasePostNoFinish(g) {
|
|
|
34320
34300
|
removeFill(g);
|
|
34321
34301
|
dotSameports(g);
|
|
34322
34302
|
dotSplines(g);
|
|
34323
|
-
if (
|
|
34303
|
+
if (mapbool2(g.attrs.get("compound") ?? g.root.attrs.get("compound"))) dotCompoundEdges(g);
|
|
34324
34304
|
}
|
|
34325
34305
|
function dotPhasePost(g) {
|
|
34326
34306
|
dotPhasePostNoFinish(g);
|
|
@@ -35311,7 +35291,7 @@ function userPos(n) {
|
|
|
35311
35291
|
n.info.pos = [Number(m[1]), Number(m[2])];
|
|
35312
35292
|
n.info.posSet = true;
|
|
35313
35293
|
const pin = n.attrs.get("pin");
|
|
35314
|
-
if (m[3] === "!" || pin !== void 0 &&
|
|
35294
|
+
if (m[3] === "!" || pin !== void 0 && mapbool2(pin)) n.info.pinned = true;
|
|
35315
35295
|
return true;
|
|
35316
35296
|
}
|
|
35317
35297
|
function assignNodeIds2(g) {
|
|
@@ -38562,7 +38542,7 @@ function splineEdgesImpl(g, sep, edgetype) {
|
|
|
38562
38542
|
function splineEdges(g) {
|
|
38563
38543
|
const edgetype = g.info.flags & 15;
|
|
38564
38544
|
if (edgetype === EDGETYPE_NONE) return;
|
|
38565
|
-
g.root.info.concentrate =
|
|
38545
|
+
g.root.info.concentrate = mapbool2(g.root.attrs.get("concentrate"));
|
|
38566
38546
|
for (const n of nodesInSeq(g)) {
|
|
38567
38547
|
for (const e of n.outEdges(g)) {
|
|
38568
38548
|
if (e.info.tail_port.dyna) e.info.tail_port = resolvePort(e.tail, e.head, e.info.tail_port);
|
|
@@ -45458,7 +45438,7 @@ function PARENT(n) {
|
|
|
45458
45438
|
function isCluster(g) {
|
|
45459
45439
|
if (g === g.root) return true;
|
|
45460
45440
|
if (g.name.toLowerCase().startsWith("cluster")) return true;
|
|
45461
|
-
return
|
|
45441
|
+
return mapbool2(g.attrs.get("cluster"));
|
|
45462
45442
|
}
|
|
45463
45443
|
function clusterInitGraph(g) {
|
|
45464
45444
|
graphInit(g, false);
|
|
@@ -45985,7 +45965,7 @@ function walkTree(tree) {
|
|
|
45985
45965
|
function isCluster2(g) {
|
|
45986
45966
|
if (g === g.root) return true;
|
|
45987
45967
|
if (g.name.toLowerCase().startsWith("cluster")) return true;
|
|
45988
|
-
return
|
|
45968
|
+
return mapbool2(g.attrs.get("cluster"));
|
|
45989
45969
|
}
|
|
45990
45970
|
function collectClusters2(g, clusters) {
|
|
45991
45971
|
for (const subg of g.subgraphs.values()) {
|
|
@@ -46065,7 +46045,7 @@ var PATCHWORK_LAYOUT_ENGINE = {
|
|
|
46065
46045
|
// src/gvc/edge-labels.ts
|
|
46066
46046
|
function renderEdgeLabels(e, renderer, job) {
|
|
46067
46047
|
const obj = job.obj;
|
|
46068
|
-
const spl =
|
|
46048
|
+
const spl = mapbool2(e.attrs.get("decorate") ?? "false") ? e.info.spl : void 0;
|
|
46069
46049
|
if (obj === null) {
|
|
46070
46050
|
renderOneLabel(e.info.label, renderer, job);
|
|
46071
46051
|
if (spl) emitAttachment(e.info.label, spl, renderer, job);
|
|
@@ -52477,7 +52457,7 @@ var XdotParser = class _XdotParser {
|
|
|
52477
52457
|
let accounted = 0;
|
|
52478
52458
|
let j = 0;
|
|
52479
52459
|
while (accounted < len) {
|
|
52480
|
-
if (cur + j >= s.length)
|
|
52460
|
+
if (cur + j >= s.length) return null;
|
|
52481
52461
|
const ch = s[cur + j];
|
|
52482
52462
|
const prev = j > 0 ? s[cur + j - 1] : "";
|
|
52483
52463
|
out += ch;
|