@knowvah/dot-engine 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -17
- package/dist/api.js +24 -0
- package/dist/api.js.map +2 -2
- package/dist/common/arrows.d.ts.map +1 -1
- package/dist/common/edge-label-init.d.ts.map +1 -1
- package/dist/common/htmltable-emit.d.ts +0 -8
- package/dist/common/htmltable-emit.d.ts.map +1 -1
- package/dist/common/ps-fontalias.d.ts +22 -9
- package/dist/common/ps-fontalias.d.ts.map +1 -1
- package/dist/common/splines-clip.d.ts.map +1 -1
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/job.d.ts +4 -0
- package/dist/gvc/job.d.ts.map +1 -1
- package/dist/index.js +1981 -1533
- package/dist/index.js.map +4 -4
- package/dist/layout/dot/index.d.ts +1 -1
- package/dist/layout/dot/index.d.ts.map +1 -1
- package/dist/layout/sfdp/init.d.ts.map +1 -1
- package/dist/model/graph.d.ts +24 -0
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/parser/builder.d.ts +32 -0
- package/dist/parser/builder.d.ts.map +1 -1
- package/dist/render/dot/agwrite.d.ts +186 -0
- package/dist/render/dot/agwrite.d.ts.map +1 -0
- package/dist/render/dot/attrs.d.ts +220 -0
- package/dist/render/dot/attrs.d.ts.map +1 -0
- package/dist/render/dot/edge-draw.d.ts +60 -0
- package/dist/render/dot/edge-draw.d.ts.map +1 -0
- package/dist/render/dot/types.d.ts +28 -0
- package/dist/render/dot/types.d.ts.map +1 -0
- package/dist/render/dot/xdot-ops.d.ts +206 -0
- package/dist/render/dot/xdot-ops.d.ts.map +1 -0
- package/dist/render/dot.d.ts +58 -277
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/map.d.ts +14 -1
- package/dist/render/map.d.ts.map +1 -1
- package/dist/render/svg-graph.d.ts.map +1 -1
- package/dist/render.js +1942 -1494
- package/dist/render.js.map +4 -4
- package/package.json +3 -1
- package/src/common/arrows.ts +17 -4
- package/src/common/edge-label-init.ts +9 -2
- package/src/common/htmltable-emit.ts +36 -8
- package/src/common/poly-gencode.ts +8 -8
- package/src/common/ps-fontalias.ts +80 -49
- package/src/common/splines-clip.ts +36 -10
- package/src/gvc/device.ts +18 -6
- package/src/gvc/job.ts +4 -0
- package/src/layout/dot/index.ts +37 -5
- package/src/layout/sfdp/init.ts +11 -0
- package/src/model/graph.ts +26 -0
- package/src/parser/builder.ts +90 -5
- package/src/render/dot/agwrite.ts +506 -0
- package/src/render/dot/attrs.ts +437 -0
- package/src/render/dot/edge-draw.ts +203 -0
- package/src/render/dot/types.ts +32 -0
- package/src/render/dot/xdot-ops.ts +432 -0
- package/src/render/dot.ts +114 -1131
- package/src/render/map.ts +18 -1
- package/src/render/svg-graph.ts +4 -0
- package/src/render/svg-helpers.ts +1 -1
|
@@ -66,7 +66,7 @@ export declare function dotPhasePost(g: Graph): void;
|
|
|
66
66
|
/**
|
|
67
67
|
* Runs the full dot layout pipeline on graph g.
|
|
68
68
|
*
|
|
69
|
-
* The optional `
|
|
69
|
+
* The optional `phase` attribute (read from g.attrs) controls how many
|
|
70
70
|
* phases run (1=rank only, 2=+mincross, 3=+position, ≥4 or absent=all).
|
|
71
71
|
*
|
|
72
72
|
* C's `dotLayout` checks `dot_mincross`'s return code and returns immediately
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layout/dot/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAyBzD,OAAO,EACL,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,WAAW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version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/layout/sfdp/init.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AASlD,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,uBAAuB,EAK7B,MAAM,wBAAwB,CAAC;AAEhC,8EAA8E;AAC9E,eAAO,MAAM,cAAc,IAAI,CAAC;AAIhC;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAoB5C;AAqDD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,uBAAuB,GAAG,IAAI,CA8BzE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,GAAG,QAAQ,CAmB7C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAQ1E;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAetD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAK1C"}
|
package/dist/model/graph.d.ts
CHANGED
|
@@ -86,6 +86,30 @@ export declare class Graph {
|
|
|
86
86
|
* @see lib/cgraph/graph.c:agsubg (attr defval copy)
|
|
87
87
|
*/
|
|
88
88
|
graphDefaultsSnapshot?: Map<string, string>;
|
|
89
|
+
/**
|
|
90
|
+
* Keys in `attrs` the BUILDER seeded from `graphDefaultsSnapshot` rather than
|
|
91
|
+
* the input declaring them in this scope (see builder.ts GRAPH_LABEL_INHERIT_
|
|
92
|
+
* KEYS). cgraph distinguishes these structurally — a seeded value is inherited
|
|
93
|
+
* through the dict view and has no local symbol, while a local declaration
|
|
94
|
+
* creates one even when its value equals the inherited value — so the
|
|
95
|
+
* serializer needs the provenance to decide what write_dict would print.
|
|
96
|
+
* Undefined on the root graph and on any scope that seeded nothing.
|
|
97
|
+
* @see lib/cgraph/write.c:262 write_dict
|
|
98
|
+
*/
|
|
99
|
+
seededAttrs?: Set<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Graph-attribute keys whose declaration in THIS scope was the first anywhere
|
|
102
|
+
* in the graph. cgraph's `setattr` splits on exactly this: a key with no
|
|
103
|
+
* existing symbol takes the global-declaration branch, which ends up seeding
|
|
104
|
+
* every direct subgraph that already exists with a local empty value (see
|
|
105
|
+
* `eagerEmptyParts`); a key some earlier scope already declared takes the
|
|
106
|
+
* "new local definition" branch and touches no subgraph at all. So an
|
|
107
|
+
* identical `graph [fill=x]` statement makes a child print `fill=""` or print
|
|
108
|
+
* nothing purely according to whether a SIBLING declared `fill` first.
|
|
109
|
+
* Undefined on any scope that declared nothing new.
|
|
110
|
+
* @see lib/cgraph/attr.c:257 setattr (lsym / psym / global branches)
|
|
111
|
+
*/
|
|
112
|
+
firstGraphDecl?: Set<string>;
|
|
89
113
|
/**
|
|
90
114
|
* Layout-engine info; replaces GD_* macros via agbindrec (AD-1).
|
|
91
115
|
* @see lib/cgraph/cgraph.h:agbindrec
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/model/graph.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GACjB,UA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;IAEhB;;;OAGG;IACH,MAAM,EAAE,KAAK,GAAG,IAAI,CAAC;IAErB;;;;OAIG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;;;;;;OAOG;IACH,GAAG,SAAK;IAER;;;;;OAKG;IACH,cAAc,SAAK;IAEnB;;;;;;;;;OASG;IACH,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAa;IAE5C,qCAAqC;gBACzB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,UAAQ;CAc7D"}
|
package/dist/parser/builder.d.ts
CHANGED
|
@@ -41,7 +41,35 @@ export declare class StmtProcessor {
|
|
|
41
41
|
* @see lib/cgraph/id.c:agnameof (`'%' + id`)
|
|
42
42
|
*/
|
|
43
43
|
private anonCounter;
|
|
44
|
+
/**
|
|
45
|
+
* Strict-graph edge index: canonical endpoint-pair key → the edge already
|
|
46
|
+
* created for it. `agedge` on a strict graph probes for a pre-existing edge
|
|
47
|
+
* and returns it instead of creating a second one, so `strict digraph
|
|
48
|
+
* { a->b; a->b }` holds ONE edge. A Map (rather than scanning root.edges)
|
|
49
|
+
* keeps that probe O(1); it stays empty for non-strict graphs.
|
|
50
|
+
* @see lib/cgraph/edge.c:agedge (agfindedge_by_key probe, :262-287)
|
|
51
|
+
*/
|
|
52
|
+
private readonly strictEdges;
|
|
44
53
|
constructor(registry: NodeRegistry);
|
|
54
|
+
/**
|
|
55
|
+
* Canonical key for a strict-graph endpoint pair. C probes (t,h) and then,
|
|
56
|
+
* for an UNDIRECTED graph, (h,t) — so an undirected pair matches either way
|
|
57
|
+
* round and is canonicalized here by node id; a directed pair is not.
|
|
58
|
+
* @see lib/cgraph/edge.c:agedge:274-275 (`if (e == NULL && agisundirected(g))`)
|
|
59
|
+
*/
|
|
60
|
+
private static strictKey;
|
|
61
|
+
/**
|
|
62
|
+
* Apply the DOT-syntax `:port:compass` endpoints to an edge's attrs.
|
|
63
|
+
*
|
|
64
|
+
* C's precedence is explicit attr > `:port` syntax > edge default (verified
|
|
65
|
+
* against the oracle: with `edge [headport=n]` declared, `a:e -> b:sw` yields
|
|
66
|
+
* headport `sw`, while `c:e -> d:sw [headport=w]` yields `w`). The guard is
|
|
67
|
+
* therefore against THIS statement's own attribute list — not the edge's
|
|
68
|
+
* accumulated map, which also holds inherited defaults and, for a strict
|
|
69
|
+
* duplicate, the earlier statement's values.
|
|
70
|
+
* @see lib/cgraph/grammar.y:396 (mkport)
|
|
71
|
+
*/
|
|
72
|
+
private static applySyntaxPorts;
|
|
45
73
|
/** Consume one anonymous id, returning cgraph's `2*counter+1`. */
|
|
46
74
|
private nextAnonId;
|
|
47
75
|
/**
|
|
@@ -52,6 +80,10 @@ export declare class StmtProcessor {
|
|
|
52
80
|
*/
|
|
53
81
|
advanceAnonId(): void;
|
|
54
82
|
processAssign(stmt: AssignStmt, graph: Graph): void;
|
|
83
|
+
/** Record a graph-attribute declaration, noting whether THIS scope was the
|
|
84
|
+
* first to declare the key anywhere — the branch selector in cgraph's
|
|
85
|
+
* setattr. @see lib/cgraph/attr.c:257 · model/graph.ts firstGraphDecl */
|
|
86
|
+
private declareGraphAttr;
|
|
55
87
|
processAttr(stmt: AttrStmt, graph: Graph): void;
|
|
56
88
|
processNodeStmt(stmt: NodeStmt, graph: Graph, root: Graph): void;
|
|
57
89
|
processEdgeStmt(stmt: EdgeStmt, graph: Graph, root: Graph, directed: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/parser/builder.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAkB,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,KAAK,EACV,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACZ,MAAM,UAA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KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;IAUhE,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IAenF,eAAe,CACb,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,OAAO,GAChB,KAAK;IA+CR,QAAQ,CACN,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,OAAO,GAChB,IAAI;IAUP;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,eAAe;IAiCvB,OAAO,CAAC,gBAAgB;CAuDzB;AAID,iFAAiF;AACjF,wBAAgB,UAAU,CACxB,KAAK,EAAE,UAAU,EAAE,EACnB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,aAAa,GACvB,IAAI,CAIN;AAED,mDAAmD;AACnD,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,KAAK,CAkBpD"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agwrite serializer — write.c's graph/subgraph/node/edge emission, shared
|
|
3
|
+
* verbatim by `-Tdot` and `-Txdot`.
|
|
4
|
+
*
|
|
5
|
+
* Split out of dot.ts as an abstract base rather than a collaborator so every
|
|
6
|
+
* method body moves UNCHANGED: the serializer reads only three things from the
|
|
7
|
+
* renderer (`emitDraws`, `clusters`, `drawsOf`), which are declared abstract
|
|
8
|
+
* here and supplied by XdotRenderer. Keeping the bodies byte-identical matters
|
|
9
|
+
* more than the inheritance being fashionable — this is ported C, and a
|
|
10
|
+
* mechanical move is auditable against write.c in a way a rewrite is not.
|
|
11
|
+
*
|
|
12
|
+
* @see lib/cgraph/write.c
|
|
13
|
+
*/
|
|
14
|
+
import type { Graph } from '../../model/graph.js';
|
|
15
|
+
import type { Node } from '../../model/node.js';
|
|
16
|
+
import type { Edge } from '../../model/edge.js';
|
|
17
|
+
import type { XdotDraws } from './types.js';
|
|
18
|
+
/** write.c's serializer half of the dot/xdot renderer. @see lib/cgraph/write.c */
|
|
19
|
+
export declare abstract class DotWriterBase {
|
|
20
|
+
/** @see dot.ts XdotRenderer.emitDraws */
|
|
21
|
+
protected abstract readonly emitDraws: boolean;
|
|
22
|
+
/** Clusters in render order (GD_clust); filled by the renderer's endCluster. */
|
|
23
|
+
protected clusters: Graph[];
|
|
24
|
+
/** Draw strings for `obj`, or undefined in a format that emits none. */
|
|
25
|
+
protected abstract drawsOf(obj: Node | Edge | Graph): XdotDraws | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Emit `key="value"`, escaping the value the way agwrite's agcanonStr does: a
|
|
28
|
+
* `"` becomes `\"` unless it is already part of an escape sequence (see
|
|
29
|
+
* agcanonEscape). A draw string carries label text that may contain a bare `"`
|
|
30
|
+
* (would close the attribute early) or a source `\"`/`\\` (must not be
|
|
31
|
+
* double-escaped). The byte-length prefix stays on the UNescaped text (the
|
|
32
|
+
* parser un-escapes before parseXDot re-reads it), matching native exactly.
|
|
33
|
+
* @see lib/cgraph/write.c:_agstrcanon (135-167)
|
|
34
|
+
*/
|
|
35
|
+
private drawAttr;
|
|
36
|
+
/** `llx,lly,urx,ury` from a graph's layout bb. */
|
|
37
|
+
private bbStr;
|
|
38
|
+
/**
|
|
39
|
+
* Serialize the whole laid-out graph to xdot DOT text — a faithful port of
|
|
40
|
+
* cgraph's agwrite (lib/cgraph/write.c). Recurses the subgraph tree
|
|
41
|
+
* (write_subgs/write_body), scoping each node/edge to the subgraph(s) it
|
|
42
|
+
* belongs to via preorder numbers (write_node_test/write_edge_test), and
|
|
43
|
+
* re-emits an object bare (no attrs) on any scope after the first
|
|
44
|
+
* (attrs_written). This reproduces native's per-subgraph edge re-declarations
|
|
45
|
+
* — e.g. an edge in a rank=same subgraph is drawn once, then re-declared bare.
|
|
46
|
+
* @see lib/cgraph/write.c:agwrite
|
|
47
|
+
*/
|
|
48
|
+
protected serialize(g: Graph): string;
|
|
49
|
+
/** Preorder-number the subgraph tree. @see write.c:subgdfs */
|
|
50
|
+
private subgdfs;
|
|
51
|
+
/** A subgraph is anonymous when its name is empty or a `%N` local name. */
|
|
52
|
+
private isAnonymous;
|
|
53
|
+
/** A graph carries a `bb` attribute when it is the root or has a layout bb
|
|
54
|
+
* (clusters, and any subgraph output.c computed a box for). Native seeds `bb`
|
|
55
|
+
* on every graph via safe_dcl, so the value differs (set vs empty "") between
|
|
56
|
+
* a boxed graph and an unboxed child — the driver that makes an anon subgraph
|
|
57
|
+
* under the root or a cluster "relevant". @see lib/common/output.c:safe_dcl */
|
|
58
|
+
private hasBb;
|
|
59
|
+
/** Anonymous subgraph with no own node/edge defaults and no graph attrs
|
|
60
|
+
* differing from its parent → inlined into the parent. Native compares every
|
|
61
|
+
* graph attr over the root attr dict; the load-bearing ones are `bb` (set on
|
|
62
|
+
* the parent, empty on the child) and `rank`. @see write.c:irrelevant_subgraph */
|
|
63
|
+
private irrelevantSubgraph;
|
|
64
|
+
/** Non-draw graph attrs a subgraph emits (rank for rank=same; clusters use
|
|
65
|
+
* clusterAttrs). Only comparator-relevant fields need be exact.
|
|
66
|
+
*
|
|
67
|
+
* `rec_attach_bb` walks the ROOT and then `GD_clust` recursively, so a
|
|
68
|
+
* subgraph the layout did not box is attached NEITHER `bb` NOR the label
|
|
69
|
+
* triple — both keep the INPUT's values, which agwrite echoes. circo and
|
|
70
|
+
* twopi lay out no clusters at all (`GD_clust` empty — mirrored here by
|
|
71
|
+
* `this.clusters`, filled from endCluster), so on a re-fed dot output their
|
|
72
|
+
* `cluster0` comes back carrying the *previous* run's `bb` and `lp`.
|
|
73
|
+
* @see lib/common/output.c:249 rec_attach_bb */
|
|
74
|
+
private subgGraphAttrs;
|
|
75
|
+
private indent;
|
|
76
|
+
/** @see write.c:write_hdr */
|
|
77
|
+
private writeHdr;
|
|
78
|
+
/**
|
|
79
|
+
* Emit this scope's `graph` / `node` / `edge` default statements, in that
|
|
80
|
+
* order. @see lib/cgraph/write.c:307 write_dicts
|
|
81
|
+
*/
|
|
82
|
+
private writeDicts;
|
|
83
|
+
/**
|
|
84
|
+
* One `<name> [...]` default statement. Entries are emitted in **strcmp order
|
|
85
|
+
* of attribute name**: cgraph's attribute dicts are `Dttree`s keyed on
|
|
86
|
+
* `Agsym_t.name` with a NULL comparf (attr.c:34), so `dtfirst`/`dtnext` walk
|
|
87
|
+
* them sorted — the oracle's `graph [bb, rankdir]` and `[height, pos, width]`.
|
|
88
|
+
*
|
|
89
|
+
* Layout mirrors write_dict exactly: a single entry stays on one line, and two
|
|
90
|
+
* or more break after each `,` with the body indented one level deeper and the
|
|
91
|
+
* closing `];` back at the statement's own level.
|
|
92
|
+
*
|
|
93
|
+
* Not ported: the `EMPTY(defval) && !sym->print` skip (write.c:271-280). Every
|
|
94
|
+
* entry here was explicitly declared or computed, i.e. `print` is set, so that
|
|
95
|
+
* branch is unreachable until the eager-propagation artifact lands — an
|
|
96
|
+
* `agapply`-installed empty default is the only `print == false` producer.
|
|
97
|
+
*
|
|
98
|
+
* @see lib/cgraph/write.c:262 write_dict
|
|
99
|
+
*/
|
|
100
|
+
private writeDict;
|
|
101
|
+
/**
|
|
102
|
+
* One object's `[...]` attribute block, or '' when it has no attributes.
|
|
103
|
+
* Entries sort strcmp like every dict (attr.c:34). Layout is
|
|
104
|
+
* write_nondefault_attrs, which differs from write_dict in two ways: the block
|
|
105
|
+
* opens with a literal TAB before `[`, and the closing `]` follows the last
|
|
106
|
+
* value directly — there is no newline+indent before it.
|
|
107
|
+
* @see lib/cgraph/write.c:471 write_nondefault_attrs
|
|
108
|
+
*/
|
|
109
|
+
private objAttrBlock;
|
|
110
|
+
/** @see write.c:write_trl */
|
|
111
|
+
private writeTrl;
|
|
112
|
+
/** @see write.c:write_subgs */
|
|
113
|
+
private writeSubgs;
|
|
114
|
+
/** @see write.c:write_body — subgraphs, then this scope's nodes and edges. */
|
|
115
|
+
private writeBody;
|
|
116
|
+
/** @see write.c:write_node_test — every xdot node carries pos/size, so it is
|
|
117
|
+
* never "default"; write it in the first scope that has not yet emitted it.
|
|
118
|
+
* Cluster nodes (fdp compound proxies, ND_clustnode) are never declared —
|
|
119
|
+
* C's write_plain/writenodeandport suppress them. @see lib/common/output.c:146 */
|
|
120
|
+
private writeNodeTest;
|
|
121
|
+
/** Emitted node name: a cluster node's synthetic `__i:<cluster>` id is written
|
|
122
|
+
* as the cluster name it stands for. @see lib/common/output.c:114 */
|
|
123
|
+
private emitNodeName;
|
|
124
|
+
/** @see write.c:write_edge_test */
|
|
125
|
+
private writeEdgeTest;
|
|
126
|
+
/** @see write.c:write_node */
|
|
127
|
+
private writeNode;
|
|
128
|
+
/** @see write.c:write_edge — attrs only on first emission, bare thereafter. */
|
|
129
|
+
/**
|
|
130
|
+
* The `:port` / `:port:compass` suffix C writes after an endpoint name.
|
|
131
|
+
*
|
|
132
|
+
* These are NOT ordinary attributes on the way out: write_nondefault_attrs
|
|
133
|
+
* skips the tailport/headport symbols (write.c:487-492) precisely because
|
|
134
|
+
* this function re-emits them as endpoint syntax, so an edge parsed from
|
|
135
|
+
* `A:f0:ne -> B` round-trips through the port syntax rather than through a
|
|
136
|
+
* `tailport="f0:ne"` attribute.
|
|
137
|
+
*
|
|
138
|
+
* C reads the value with agxget, which falls back to the edge dict default,
|
|
139
|
+
* and gates on the SYMBOL existing at all — both are subsumed here by the
|
|
140
|
+
* attr-then-default lookup coming back undefined. An html-like value is
|
|
141
|
+
* canonicalized whole; a plain one splits on its FIRST `:` (strchr) so the
|
|
142
|
+
* port and the compass point are canonicalized separately.
|
|
143
|
+
* @see lib/cgraph/write.c:565 write_port
|
|
144
|
+
*/
|
|
145
|
+
private portSuffix;
|
|
146
|
+
private writeEdge;
|
|
147
|
+
/** Root-graph attribute block: `_draw_`, `_ldraw_`, `bb`, `xdotversion`. */
|
|
148
|
+
private graphAttrs;
|
|
149
|
+
/** Cluster attribute block. C's xdot_end_cluster ALWAYS agsets `_draw_` when
|
|
150
|
+
* the graph has clusters (even empty, e.g. peripheries=0), so emit it
|
|
151
|
+
* unconditionally; `_ldraw_` only when the cluster has a label.
|
|
152
|
+
* @see plugin/core/gvrender_core_dot.c:284 xdot_end_cluster */
|
|
153
|
+
private clusterAttrs;
|
|
154
|
+
/** Node attribute block: pos/width/height plus `_draw_`/`_ldraw_`. `scope` is
|
|
155
|
+
* the subgraph the node is being WRITTEN in, whose node dict every value is
|
|
156
|
+
* compared against. @see lib/cgraph/write.c:537-545 write_node */
|
|
157
|
+
private nodeAttrs;
|
|
158
|
+
/** The `[...]` attribute body for an edge (draw ops + spline `pos`), or ''. */
|
|
159
|
+
private edgeAttrStr;
|
|
160
|
+
/** `xlp` — only when the node HAS an xlabel AND the xlabel placer actually set
|
|
161
|
+
* its position (`ND_xlabel(n)->set`). An xlabel that was never placed is
|
|
162
|
+
* omitted entirely, so an input `xlp` survives and is echoed.
|
|
163
|
+
* @see lib/common/output.c:309-313 */
|
|
164
|
+
private nodeXlpPart;
|
|
165
|
+
/** `rects` — record field boxes. C gates on the SHAPE NAME being exactly
|
|
166
|
+
* "record" (`strcmp(ND_shape(n)->name, "record") == 0`), so `Mrecord` and
|
|
167
|
+
* HTML-table nodes get NO rects; confirmed against the native oracle. When
|
|
168
|
+
* the shape is not a record the input's `rects` is never overwritten and is
|
|
169
|
+
* echoed — patchwork forces every node to `box`, so a re-fed dot output
|
|
170
|
+
* returns its old record rects untouched. @see lib/common/output.c:314-317 */
|
|
171
|
+
private nodeRectsPart;
|
|
172
|
+
/** The six `_draw_`-family attributes of an edge, in C's order. */
|
|
173
|
+
private edgeDrawParts;
|
|
174
|
+
/**
|
|
175
|
+
* `lp`/`xlp`/`head_lp`/`tail_lp` for one edge, in C's order.
|
|
176
|
+
*
|
|
177
|
+
* Note the asymmetry C encodes: `lp`/`head_lp`/`tail_lp` are emitted whenever
|
|
178
|
+
* the label EXISTS, but `xlp` additionally requires `->set` — an unplaced
|
|
179
|
+
* xlabel is omitted. Each gate is independent, and each FAILED gate leaves the
|
|
180
|
+
* input's own value in the slot for write.c to echo: an unrouted edge
|
|
181
|
+
* (patchwork routes none) returns the `lp` a previous dot run wrote.
|
|
182
|
+
* @see lib/common/output.c:377-396
|
|
183
|
+
*/
|
|
184
|
+
private edgeLabelPosParts;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=agwrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agwrite.d.ts","sourceRoot":"","sources":["../../../src/render/dot/agwrite.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAYhD,OAAO,KAAK,EAAE,SAAS,EAAU,MAAM,YAAY,CAAC;AAEpD,kFAAkF;AAClF,8BAAsB,aAAa;IACjC,yCAAyC;IACzC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC/C,gFAAgF;IAChF,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAM;IACjC,wEAAwE;IACxE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS;IAE3E;;;;;;;;OAQG;IACH,OAAO,CAAC,QAAQ;IAIhB,kDAAkD;IAClD,OAAO,CAAC,KAAK;IAMb;;;;;;;;;OASG;IACH,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM;IAgBrC,8DAA8D;IAC9D,OAAO,CAAC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-record and dict-default rules
|
|
4
|
+
* write_nondefault_attrs / write_dict compare against.
|
|
5
|
+
*
|
|
6
|
+
* @see lib/common/output.c:254 attach_attrs_and_arrows
|
|
7
|
+
* @see lib/cgraph/write.c:471 write_nondefault_attrs
|
|
8
|
+
*/
|
|
9
|
+
import type { Graph } from '../../model/graph.js';
|
|
10
|
+
import type { Node } from '../../model/node.js';
|
|
11
|
+
import type { Edge } from '../../model/edge.js';
|
|
12
|
+
import type { FieldT } from '../../common/types.js';
|
|
13
|
+
/**
|
|
14
|
+
* C's `attach_attrs` edge loop skips IGNORED edges and edges with no spline
|
|
15
|
+
* (`ED_spl(e) == NULL`) via `continue`, so such an edge is attached NEITHER
|
|
16
|
+
* `pos` NOR any of `lp`/`xlp`/`head_lp`/`tail_lp` — even when it carries a
|
|
17
|
+
* label. All five attributes therefore share this one gate.
|
|
18
|
+
* @see lib/common/output.c:349-353
|
|
19
|
+
*/
|
|
20
|
+
export declare function edgeAttrsAttached(e: Edge): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Append the leaf-field rectangles of a record node, mirroring the recursion in
|
|
23
|
+
* `set_record_rects`: a field with sub-fields contributes nothing itself, while
|
|
24
|
+
* a LEAF field (`n_flds == 0`) contributes its box translated by the node centre
|
|
25
|
+
* as `llx,lly,urx,ury` at `%.5g`. C emits each field followed by a space and
|
|
26
|
+
* then pops the trailing one — joining with a single space is equivalent.
|
|
27
|
+
* @see lib/common/output.c:215 set_record_rects
|
|
28
|
+
*/
|
|
29
|
+
export declare function appendRecordRects(n: Node, f: FieldT, out: string[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* Echo an attribute that `attach_attrs_and_arrows` did NOT overwrite.
|
|
32
|
+
*
|
|
33
|
+
* Every computed attribute is `agset` behind a gate (`rects` only for a
|
|
34
|
+
* `record` shape; an edge's `lp` only for a routed edge that HAS a label;
|
|
35
|
+
* a graph's `lp` only when `GD_label(g)` exists...). When the gate FAILS, C
|
|
36
|
+
* simply does not write — so the slot keeps whatever the INPUT file parsed
|
|
37
|
+
* into it, and `agwrite` (which serializes the whole attribute table, not
|
|
38
|
+
* just the fields layout computed) prints that stale value verbatim. This is
|
|
39
|
+
* highly visible under patchwork, which forces every shape to `box` and routes
|
|
40
|
+
* no edges: on a re-fed dot output (most of the corpus) native echoes back the
|
|
41
|
+
* `rects` / `lp` a *previous* dot run wrote, in that run's coordinate space.
|
|
42
|
+
*
|
|
43
|
+
* cgraph interns attribute strings, so a value equal to the declared (empty)
|
|
44
|
+
* default is the SAME pointer as the default and write.c's
|
|
45
|
+
* `data->str[sym->id] != sym->defval` test drops it — hence an empty value is
|
|
46
|
+
* never printed.
|
|
47
|
+
* @see lib/cgraph/write.c:427 write_nondefault_attrs · lib/common/output.c:270
|
|
48
|
+
*/
|
|
49
|
+
/** Names the serializer computes for a node; never echoed from input. */
|
|
50
|
+
export declare const COMPUTED_NODE_ATTRS: Set<string>;
|
|
51
|
+
/** Names the serializer computes for an edge. `tailport`/`headport` are excluded
|
|
52
|
+
* too: write_nondefault_attrs skips those symbols because they are written as
|
|
53
|
+
* `:port` syntax on the endpoints instead. @see lib/cgraph/write.c:487-492 */
|
|
54
|
+
export declare const COMPUTED_EDGE_ATTRS: Set<string>;
|
|
55
|
+
/** dot's synthesized AGNODE `label` default. @see lib/common/const.h NODENAME_ESC */
|
|
56
|
+
export declare const NODENAME_ESC = "\\N";
|
|
57
|
+
/** Effective edge defaults at `scope`, inner overriding outer — mirrors the
|
|
58
|
+
* builder's snapshotEdgeDefaults walk (builder.ts:294). Edges have no stored
|
|
59
|
+
* snapshot: the builder copies inherited defaults straight into `edge.attrs`,
|
|
60
|
+
* so the only way to tell a defaulted value from an explicit one is to compare
|
|
61
|
+
* against this walk. That merge also means `edge.attrs` already IS the cgraph
|
|
62
|
+
* value record `objInputParts` expects — the node side has to build one
|
|
63
|
+
* (`nodeRecord`) because node defaults are kept in a separate snapshot. */
|
|
64
|
+
export declare function effectiveEdgeDefaults(scope: Graph): Map<string, string>;
|
|
65
|
+
/**
|
|
66
|
+
* Effective node defaults at `scope`, inner overriding outer — the dict
|
|
67
|
+
* write_node compares each node against (`d`, threaded from write_body,
|
|
68
|
+
* write.c:537-545). This is the scope the node is WRITTEN in, which is not
|
|
69
|
+
* necessarily where it was created.
|
|
70
|
+
*
|
|
71
|
+
* Includes dot's synthesized `label` default: `graph_init` installs
|
|
72
|
+
* NODENAME_ESC on the root when the input declares none (input.c:737-739), and
|
|
73
|
+
* it is part of the dict C compares against. `nodeRecord` seeds the same value
|
|
74
|
+
* under the same condition so the two cancel — omitting it from either side
|
|
75
|
+
* would print `label="\N"` (or `label=""`) on every node in the corpus.
|
|
76
|
+
* @see lib/cgraph/write.c:537-545 write_node · lib/common/input.c:737-739
|
|
77
|
+
*/
|
|
78
|
+
export declare function effectiveNodeDefaults(scope: Graph): Map<string, string>;
|
|
79
|
+
/**
|
|
80
|
+
* One node's cgraph value RECORD: the node-dict defaults in effect where the
|
|
81
|
+
* node was CREATED, overridden by its own explicit attributes.
|
|
82
|
+
*
|
|
83
|
+
* `addattr` seeds a node's slot from the default at declaration time and an
|
|
84
|
+
* explicit `n [k=v]` overwrites it; neither is disturbed by a LATER
|
|
85
|
+
* `node [k=…]` in the same scope, which only moves the dict symbol. That gap is
|
|
86
|
+
* the whole mechanism: `{node[shape=house]; A; node[shape=invhouse]; B}` leaves
|
|
87
|
+
* A's record at `house` against a dict default of `invhouse`, so C prints
|
|
88
|
+
* `shape=house` on A and nothing on B.
|
|
89
|
+
* @see lib/cgraph/attr.c:210 addattr · lib/cgraph/write.c:485
|
|
90
|
+
*/
|
|
91
|
+
export declare function nodeRecord(n: Node): Map<string, string>;
|
|
92
|
+
/**
|
|
93
|
+
* One object's attribute block: every name whose value RECORD differs from the
|
|
94
|
+
* writing scope's dict default. A name in the dict but not the record compares
|
|
95
|
+
* as empty and prints as `k=""` — `digraph G { a; node[color=red]; b; }` emits
|
|
96
|
+
* `a [color=""]`, which a record-only walk structurally cannot produce.
|
|
97
|
+
* @see lib/cgraph/write.c:471 write_nondefault_attrs
|
|
98
|
+
*/
|
|
99
|
+
export declare function objInputParts(record: Map<string, string>, defaults: Map<string, string>, computed: Set<string>): string[];
|
|
100
|
+
/**
|
|
101
|
+
* A COMPUTED node/edge attribute, dropped when its value equals the applicable
|
|
102
|
+
* dict default.
|
|
103
|
+
*
|
|
104
|
+
* `safe_dcl` declares each computed name with an empty default only when the
|
|
105
|
+
* symbol does not already exist — an input file that says `node [width=0.5]`
|
|
106
|
+
* leaves `sym->defval` at `0.5`. cgraph interns strings, so `agxset`ing a
|
|
107
|
+
* computed `0.5` stores the SAME refstr as the default and
|
|
108
|
+
* write_nondefault_attrs' `data->str[sym->id] != sym->defval` test drops it.
|
|
109
|
+
* tests/graphs/arrows.gv is the clean case: every node emits `height=0.5`
|
|
110
|
+
* (no declared default) but none emits `width`.
|
|
111
|
+
*
|
|
112
|
+
* `formatted` is passed in rather than derived so each call site keeps its own
|
|
113
|
+
* quoting; `raw` is the unquoted text that C would have interned.
|
|
114
|
+
* @see lib/common/utils.c:1065 safe_dcl · lib/cgraph/write.c:485
|
|
115
|
+
*/
|
|
116
|
+
export declare function computedPart(key: string, raw: string, defaults: Map<string, string> | undefined): string[];
|
|
117
|
+
/** Attribute names the serializer computes itself; input values are echoed by
|
|
118
|
+
* `graphInputParts`, so these must not be echoed twice. */
|
|
119
|
+
export declare const COMPUTED_GRAPH_ATTRS: Set<string>;
|
|
120
|
+
/** Walk to the root graph (cgraph `agroot`). */
|
|
121
|
+
export declare function rootOf(g: Graph): Graph;
|
|
122
|
+
/**
|
|
123
|
+
* A scope's own graph-attribute dict entries — the INPUT attributes, echoed by
|
|
124
|
+
* write_dict because in cgraph a graph's attributes ARE its dict defaults.
|
|
125
|
+
*
|
|
126
|
+
* For a non-root scope the test is PROVENANCE, not value. `setattr` gives a
|
|
127
|
+
* subgraph its own dict symbol for every attribute the input declares in that
|
|
128
|
+
* scope, and write_dict prints each local symbol whose value is non-empty —
|
|
129
|
+
* there is no comparison against the inherited value, so re-declaring an
|
|
130
|
+
* attribute to the value it already inherited still prints. Oracle-pinned:
|
|
131
|
+
* `digraph G { foo="x"; { foo="x"; a; b } }` emits `foo=x` on the subgraph.
|
|
132
|
+
*
|
|
133
|
+
* The only entries in `attrs` that are NOT local declarations are the ones the
|
|
134
|
+
* builder seeded from the snapshot so cluster-label inheritance survives the
|
|
135
|
+
* layout's cluster rebuilds; those carry no dict symbol in C and are recorded in
|
|
136
|
+
* `seededAttrs`. (A value-equality test stood in for this before the marker
|
|
137
|
+
* existed, and wrongly swallowed genuine re-declarations.)
|
|
138
|
+
*
|
|
139
|
+
* Also reproduces C's EAGER-propagation artifact. `agattr` creating a NEW global
|
|
140
|
+
* graph attribute runs `agapply(root, addattr, rsym, true)`, installing the
|
|
141
|
+
* symbol — with its pre-declaration (empty) default — on every subgraph that
|
|
142
|
+
* ALREADY EXISTS. So a subgraph opened before the declaration carries a local
|
|
143
|
+
* empty value and agwrite prints e.g. `rankdir=""`, while a sibling opened after
|
|
144
|
+
* it inherits and prints nothing. `graphDefaultsSnapshot` records exactly which
|
|
145
|
+
* defaults were in effect when the scope opened, so "declared at root after this
|
|
146
|
+
* scope opened" is `root.attrs.has(k) && !snapshot.has(k)`.
|
|
147
|
+
* @see lib/cgraph/attr.c:287 (agapply/addattr) · lib/cgraph/write.c:262
|
|
148
|
+
*/
|
|
149
|
+
export declare function graphInputParts(g: Graph, top: boolean, emitDraws: boolean): string[];
|
|
150
|
+
/**
|
|
151
|
+
* `name=value` parts for one attribute-default map, values canonicalized by the
|
|
152
|
+
* `_agstrcanon` port (conditional quoting — `rankdir=LR` bare, `bb="0,0,1,1"`
|
|
153
|
+
* quoted), matching write_canonstr. @see lib/cgraph/write.c:write_canonstr
|
|
154
|
+
*/
|
|
155
|
+
export declare function dictParts(defaults: Map<string, string>): string[];
|
|
156
|
+
/**
|
|
157
|
+
* Node-dict parts for a scope. At the root, dot's `graph_init` installs an
|
|
158
|
+
* AGNODE `label` default of NODENAME_ESC (`\N`) when absent — the port models
|
|
159
|
+
* attributes as per-object Maps and reproduces that default at each use-site
|
|
160
|
+
* (see the N_label note in common/graph-init.ts), and the serializer is such a
|
|
161
|
+
* use-site. An explicit root-level `node [label=...]` wins over the synthesized
|
|
162
|
+
* default. @see lib/common/input.c:737-739 (N_label)
|
|
163
|
+
*/
|
|
164
|
+
export declare function nodeDictParts(g: Graph, top: boolean): string[];
|
|
165
|
+
export declare function echoAttr(attrs: Map<string, string>, key: string): string[];
|
|
166
|
+
/**
|
|
167
|
+
* write_dict's conditional empty-value skip, as OBSERVED against the oracle.
|
|
168
|
+
*
|
|
169
|
+
* A non-empty local value always prints. An empty one is dropped only when the
|
|
170
|
+
* INHERITED value is present and empty too; an inherited value that is absent
|
|
171
|
+
* or non-empty leaves the empty local value printed, and so does the root,
|
|
172
|
+
* which inherits nothing. Pinned with `digraph G { [foo=<i>;] { foo=""; … } }`:
|
|
173
|
+
* inherited absent PRINTS, inherited `"x"` PRINTS, inherited `""` SKIPS, and
|
|
174
|
+
* the root's own `foo=""` PRINTS in every one of those.
|
|
175
|
+
*
|
|
176
|
+
* Neither half of the C's guard can be read literally. `Agsym_t.print`
|
|
177
|
+
* (cgraph.h:644) is assigned nowhere in the tree, so porting
|
|
178
|
+
* `EMPTY(psym->defval) && psym->print` verbatim makes the parent-empty skip
|
|
179
|
+
* unreachable; and the `view == NULL` skip would drop the root's `foo=""`,
|
|
180
|
+
* which native prints. The observed rule is authoritative here.
|
|
181
|
+
* @see lib/cgraph/write.c:271-278 write_dict
|
|
182
|
+
*/
|
|
183
|
+
export declare function writeDictSkips(v: string, inherited: string | undefined): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* `echoAttr` for a GRAPH attribute the layout did not overwrite — same as
|
|
186
|
+
* echoAttr except an EMPTY value can still be emitted, per `writeDictSkips`.
|
|
187
|
+
* So a re-fed dot output whose `{rank=same}` block carries `bb=""`/`lp=""`
|
|
188
|
+
* under a boxed, labelled cluster echoes both back verbatim
|
|
189
|
+
* (tests/share/KW91.gv).
|
|
190
|
+
*/
|
|
191
|
+
export declare function echoGraphAttr(g: Graph, key: string): string[];
|
|
192
|
+
/**
|
|
193
|
+
* The `lp`/`lwidth`/`lheight` triple for a graph or cluster, in C's order.
|
|
194
|
+
* `rec_attach_bb` attaches them to the root graph AND recursively to every
|
|
195
|
+
* cluster, but ONLY when the graph carries a label with non-empty text
|
|
196
|
+
* (`GD_label(g) && GD_label(g)->text[0]`) — an absent or empty-text label emits
|
|
197
|
+
* none of the three. `lp` is the label centre in points (`%.5g`); `lwidth` and
|
|
198
|
+
* `lheight` are the label's `dimen` converted to inches and written `%.2f`.
|
|
199
|
+
* When the gate fails, the input's own values survive and are echoed: patchwork
|
|
200
|
+
* and osage never build a cluster label object, so a re-fed dot file's cluster
|
|
201
|
+
* `lp` comes straight back out.
|
|
202
|
+
* @see lib/common/output.c:239-248 rec_attach_bb
|
|
203
|
+
*/
|
|
204
|
+
export declare function graphLabelAttrs(g: Graph): string[];
|
|
205
|
+
/**
|
|
206
|
+
* Format edge spline points for the DOT `pos` attribute. Per bezier: the start
|
|
207
|
+
* endpoint `s,sp` when `sflag` set, then the end endpoint `e,ep` when `eflag`
|
|
208
|
+
* set, then `bez.size` control points — all at `%.5g`, exactly as native's
|
|
209
|
+
* spline serialization. Beziers are separated by `;`, points within one by a
|
|
210
|
+
* space. @see lib/common/output.c:353-372
|
|
211
|
+
*/
|
|
212
|
+
export declare function formatEdgePos(e: Edge): string;
|
|
213
|
+
/** `formatEdgePos`'s value without the `pos="…"` wrapper — the text C interns
|
|
214
|
+
* and compares against the symbol default. `null` when no `pos` is attached. */
|
|
215
|
+
export declare function edgePosRaw(e: Edge): string | null;
|
|
216
|
+
/** Return the edge connector token. */
|
|
217
|
+
export declare function edgeConnector(directed: boolean): string;
|
|
218
|
+
/** Return true if the graph is directed or strict-directed. */
|
|
219
|
+
export declare function isDirected(g: Graph): boolean;
|
|
220
|
+
//# sourceMappingURL=attrs.d.ts.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KAAK,GAAG,MAAM,EAAE,CAclD;AAMD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAG7C;AAED;iFACiF;AACjF,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAuBjD;AAED,uCAAuC;AACvC,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAEvD;AAED,+DAA+D;AAC/D,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO,CAE5C"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edge spline + arrow draw-op emission — emit.c's multicolor / tapered / ortho
|
|
3
|
+
* branches, split out of dot.ts for file size. Same abstract-base approach as
|
|
4
|
+
* agwrite.ts: every body moves UNCHANGED and reaches the renderer's emit state
|
|
5
|
+
* (`penwidth`, `styleOp`, `penOp`) through inheritance rather than injection,
|
|
6
|
+
* so each branch stays diffable against the C.
|
|
7
|
+
*
|
|
8
|
+
* @see lib/common/emit.c:2389 multicolor · :2422 tapered · :2583 ortho
|
|
9
|
+
*/
|
|
10
|
+
import type { Edge } from '../../model/edge.js';
|
|
11
|
+
import type { Bezier } from '../../model/geom.js';
|
|
12
|
+
import type { ArrowDrawOp } from '../../common/arrows-types.js';
|
|
13
|
+
import type { RenderJob } from '../../gvc/job.js';
|
|
14
|
+
import { EmitState } from '../../gvc/job.js';
|
|
15
|
+
import { DotWriterBase } from './agwrite.js';
|
|
16
|
+
/** emit.c's edge-drawing half, between the serializer base and the renderer. */
|
|
17
|
+
export declare abstract class EdgeDrawBase extends DotWriterBase {
|
|
18
|
+
/** setlinewidth state per emit_state. @see gvrender_core_dot.c penwidth[] */
|
|
19
|
+
protected penwidth: number[];
|
|
20
|
+
protected abstract styleOp(job: RenderJob): string;
|
|
21
|
+
protected abstract penOp(job: RenderJob): string;
|
|
22
|
+
/**
|
|
23
|
+
* The plain single-colour spline branch of beginEdge — lifted verbatim so the
|
|
24
|
+
* four-way spline-kind chain above stays readable; no branch was reordered or
|
|
25
|
+
* merged. splines=ortho + radius/style=rounded emits straight segments plus
|
|
26
|
+
* corner arcs as polylines (L), else the bezier itself.
|
|
27
|
+
* @see lib/common/emit.c:2583
|
|
28
|
+
*/
|
|
29
|
+
protected emitPlainSpline(e: Edge, list: Bezier[], edraw: string[], job: RenderJob): void;
|
|
30
|
+
/** One bezier of a plain spline: rounded-ortho corner polylines when a radius
|
|
31
|
+
* applies and the segment has enough control points, else the bezier. */
|
|
32
|
+
protected emitSplineBezier(bez: Bezier, radius: number | null, edraw: string[], job: RenderJob): void;
|
|
33
|
+
protected emitTaperedSpline(e: Edge, bz: Bezier | undefined, edraw: string[], job: RenderJob): void;
|
|
34
|
+
/**
|
|
35
|
+
* Emit a split-along-length `;` multicolor edge spline: split each routed
|
|
36
|
+
* bezier along its arc length into one sub-curve per color segment, drawn
|
|
37
|
+
* under that segment's pen. Reuses the same split geometry
|
|
38
|
+
* (splitSplineByColor) as the SVG path. @see lib/common/emit.c:1975 multicolor
|
|
39
|
+
*/
|
|
40
|
+
protected emitSplitSpline(bzList: (Bezier | undefined)[], colorAttr: string, edraw: string[], job: RenderJob): {
|
|
41
|
+
firstColor: string;
|
|
42
|
+
endColor: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Emit the parallel-multicolor edge spline: one offset Bézier per color,
|
|
46
|
+
* offset SEP=2.0 perpendicular per pass — reusing the same offset geometry
|
|
47
|
+
* (buildOffsetLists/advanceTmpList) as the SVG parallel-edge path.
|
|
48
|
+
* @see lib/common/emit.c:2443 (parallel multicolor) / svg-parallel-edge.ts
|
|
49
|
+
*/
|
|
50
|
+
protected emitParallelSpline(bzList: (Bezier | undefined)[], colorAttr: string, numc: number, edraw: string[], job: RenderJob): {
|
|
51
|
+
headColor: string;
|
|
52
|
+
tailColor: string;
|
|
53
|
+
};
|
|
54
|
+
/** Emit one arrow's primitive ops into `buf` (pen/fill from the edge color).
|
|
55
|
+
* arrow_gen sets the default line style ("solid") and the edge penwidth
|
|
56
|
+
* before each primitive, so a non-default penwidth emits `S setlinewidth(N)`
|
|
57
|
+
* once (tracked per HDRAW/TDRAW state). @see arrows.c:arrow_gen */
|
|
58
|
+
protected emitArrows(buf: string[], ops: ArrowDrawOp[] | undefined, job: RenderJob, state: EmitState, penOverride?: string): void;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=edge-draw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-draw.d.ts","sourceRoot":"","sources":["../../../src/render/dot/edge-draw.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAGhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAS7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAgC7C,gFAAgF;AAChF,8BAAsB,YAAa,SAAQ,aAAa;IACtD,6EAA6E;IAC7E,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAyB;IACrD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM;IAClD,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM;IAEhD;;;;;;OAMG;IACH,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI;IAmBzF;8EAC0E;IAC1E,SAAS,CAAC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