@knowvah/dot-engine 2.7.0 → 2.7.1
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/common/attr-get.d.ts +30 -0
- package/dist/common/attr-get.d.ts.map +1 -0
- package/dist/common/make-label.d.ts.map +1 -1
- package/dist/common/poly-init.d.ts +2 -12
- package/dist/common/poly-init.d.ts.map +1 -1
- package/dist/index.js +18 -11
- package/dist/index.js.map +3 -3
- package/dist/layout/dot/graph-label.d.ts.map +1 -1
- package/dist/render.js +18 -11
- package/dist/render.js.map +3 -3
- package/package.json +1 -1
- package/src/common/attr-get.ts +46 -0
- package/src/common/make-label.ts +14 -2
- package/src/common/poly-init.ts +4 -18
- package/src/layout/dot/graph-label.ts +1 -15
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute reads with cgraph's `agxget` semantics: an object's own value,
|
|
3
|
+
* else the declared default it was created under. A leaf module (model types
|
|
4
|
+
* only) so label and shape code can share it without an import cycle.
|
|
5
|
+
*
|
|
6
|
+
* @see lib/cgraph/attr.c:agxget
|
|
7
|
+
*/
|
|
8
|
+
import type { Node } from '../model/node.js';
|
|
9
|
+
import type { Graph } from '../model/graph.js';
|
|
10
|
+
/**
|
|
11
|
+
* Read a node attribute: the node's own value, else the node-attribute defaults
|
|
12
|
+
* (`node [...]`) captured from the node's declaring scope up to root *at the
|
|
13
|
+
* time the node was created*. The snapshot makes a `node [...]` declared after
|
|
14
|
+
* the node — at any scope — correctly not apply, and lets a cluster-scoped
|
|
15
|
+
* default reach nodes declared in that cluster, as the oracle does.
|
|
16
|
+
*
|
|
17
|
+
* Programmatically created nodes have no snapshot; they fall back to the live
|
|
18
|
+
* defaults of the passed graph `g` and root.
|
|
19
|
+
* @see lib/cgraph/attr.c:agxget; src/parser/builder.ts:effectiveNodeDefaults
|
|
20
|
+
*/
|
|
21
|
+
export declare function nodeAttr(n: Node, g: Graph, key: string): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Read a graph attribute with subgraph→root inheritance, mirroring C's
|
|
24
|
+
* agxget (late_nnstring(sg, agfindgraphattr(sg, key), ...) in do_graph_label):
|
|
25
|
+
* a cluster inherits `fontname`/`fontsize`/`fontcolor` set on an ancestor
|
|
26
|
+
* (e.g. root `graph[fontname=Arial]`) when it sets none of its own.
|
|
27
|
+
* @see lib/common/input.c:do_graph_label
|
|
28
|
+
*/
|
|
29
|
+
export declare function graphAttrInherited(sg: Graph, key: string): string | undefined;
|
|
30
|
+
//# sourceMappingURL=attr-get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attr-get.d.ts","sourceRoot":"","sources":["../../src/common/attr-get.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM3E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-label.d.ts","sourceRoot":"","sources":["../../src/common/make-label.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,kBAAkB,CAAC;AAI/D,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"make-label.d.ts","sourceRoot":"","sources":["../../src/common/make-label.ts"],"names":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'../model/graph.js';
|
|
9
9
|
import type { TextMeasurer } from './textmeasure.js';
|
|
10
|
+
import { nodeAttr } from './attr-get.js';
|
|
10
11
|
import type { PolygonT } from './types.js';
|
|
11
|
-
|
|
12
|
-
* Read a node attribute: the node's own value, else the node-attribute defaults
|
|
13
|
-
* (`node [...]`) captured from the node's declaring scope up to root *at the
|
|
14
|
-
* time the node was created*. The snapshot makes a `node [...]` declared after
|
|
15
|
-
* the node — at any scope — correctly not apply, and lets a cluster-scoped
|
|
16
|
-
* default reach nodes declared in that cluster, as the oracle does.
|
|
17
|
-
*
|
|
18
|
-
* Programmatically created nodes have no snapshot; they fall back to the live
|
|
19
|
-
* defaults of the passed graph `g` and root.
|
|
20
|
-
* @see lib/cgraph/attr.c:agxget; src/parser/builder.ts:effectiveNodeDefaults
|
|
21
|
-
*/
|
|
22
|
-
export declare function nodeAttr(n: Node, g: Graph, key: string): string | undefined;
|
|
12
|
+
export { nodeAttr };
|
|
23
13
|
/** Read label-font attributes from node, falling back to defaults. */
|
|
24
14
|
export declare function readFontAttrs(n: Node, g: Graph): {
|
|
25
15
|
fontname: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poly-init.d.ts","sourceRoot":"","sources":["../../src/common/poly-init.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"poly-init.d.ts","sourceRoot":"","sources":["../../src/common/poly-init.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAa,MAAM,YAAY,CAAC;AAwBtD,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,GAAG;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAMA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAgBjE;AAED;;;;;GAKG;AACH,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAS9E;AAkBD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAqBxE"}
|
package/dist/index.js
CHANGED
|
@@ -10518,6 +10518,17 @@ function emitHtmlLabel(placed, pos, renderer, job) {
|
|
|
10518
10518
|
}
|
|
10519
10519
|
}
|
|
10520
10520
|
|
|
10521
|
+
// src/common/attr-get.ts
|
|
10522
|
+
function nodeAttr(n, g, key) {
|
|
10523
|
+
const own = n.attrs.get(key);
|
|
10524
|
+
if (own !== void 0) return own;
|
|
10525
|
+
if (n.nodeDefaultsSnapshot !== void 0) return n.nodeDefaultsSnapshot.get(key);
|
|
10526
|
+
return g.nodeDefaults.get(key) ?? (g !== g.root ? g.root.nodeDefaults.get(key) : void 0);
|
|
10527
|
+
}
|
|
10528
|
+
function graphAttrInherited(sg, key) {
|
|
10529
|
+
return sg.attrs.get(key) ?? sg.graphDefaultsSnapshot?.get(key);
|
|
10530
|
+
}
|
|
10531
|
+
|
|
10521
10532
|
// src/common/htmltable-attr-warn.ts
|
|
10522
10533
|
var accepted = (v) => ({ keep: v, text: [], warn: false });
|
|
10523
10534
|
var ignored = (text) => ({ keep: void 0, text: [text], warn: true });
|
|
@@ -18445,12 +18456,17 @@ var DEFAULT_FONTNAME = "Times-Roman";
|
|
|
18445
18456
|
var DEFAULT_COLOR3 = "black";
|
|
18446
18457
|
function getPenColor(obj) {
|
|
18447
18458
|
if (obj === void 0) return void 0;
|
|
18448
|
-
const pc = obj
|
|
18459
|
+
const pc = aggetObj(obj, "pencolor");
|
|
18449
18460
|
if (pc !== void 0 && pc !== "") return pc;
|
|
18450
|
-
const c = obj
|
|
18461
|
+
const c = aggetObj(obj, "color");
|
|
18451
18462
|
if (c !== void 0 && c !== "") return c;
|
|
18452
18463
|
return void 0;
|
|
18453
18464
|
}
|
|
18465
|
+
function aggetObj(obj, key) {
|
|
18466
|
+
if (obj instanceof Node) return nodeAttr(obj, obj.root, key);
|
|
18467
|
+
if (obj instanceof Graph) return graphAttrInherited(obj, key);
|
|
18468
|
+
return obj.attrs.get(key);
|
|
18469
|
+
}
|
|
18454
18470
|
function rootOf(obj) {
|
|
18455
18471
|
return obj instanceof Edge ? obj.tail.root : obj.root;
|
|
18456
18472
|
}
|
|
@@ -21168,9 +21184,6 @@ function readLabelPos(sg) {
|
|
|
21168
21184
|
}
|
|
21169
21185
|
return pos;
|
|
21170
21186
|
}
|
|
21171
|
-
function graphAttrInherited(sg, key) {
|
|
21172
|
-
return sg.attrs.get(key) ?? sg.graphDefaultsSnapshot?.get(key);
|
|
21173
|
-
}
|
|
21174
21187
|
function readFontParams(sg) {
|
|
21175
21188
|
return {
|
|
21176
21189
|
fontsize: parseFloat(graphAttrInherited(sg, "fontsize") ?? "") || DEFAULT_FONTSIZE2,
|
|
@@ -25094,12 +25107,6 @@ function drawRecordBox(job, n, ll, ur, filled) {
|
|
|
25094
25107
|
var DEFAULT_LW = 27;
|
|
25095
25108
|
var DEFAULT_RW = 27;
|
|
25096
25109
|
var DEFAULT_HT = 36;
|
|
25097
|
-
function nodeAttr(n, g, key) {
|
|
25098
|
-
const own = n.attrs.get(key);
|
|
25099
|
-
if (own !== void 0) return own;
|
|
25100
|
-
if (n.nodeDefaultsSnapshot !== void 0) return n.nodeDefaultsSnapshot.get(key);
|
|
25101
|
-
return g.nodeDefaults.get(key) ?? (g !== g.root ? g.root.nodeDefaults.get(key) : void 0);
|
|
25102
|
-
}
|
|
25103
25110
|
function readFontAttrs(n, g) {
|
|
25104
25111
|
return {
|
|
25105
25112
|
fontname: nodeAttr(n, g, "fontname") ?? DEFAULT_FONTNAME,
|