ts-graphviz 1.4.0 → 1.4.1-dev.1f5b79680
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/lib/adapter/browser/index.d.ts +1 -1
- package/lib/adapter/node/index.d.ts +1 -1
- package/lib/ast/index.cjs +1 -1
- package/lib/ast/index.d.ts +17 -30
- package/lib/ast/index.js +1 -1
- package/lib/common/index.d.ts +57 -61
- package/lib/utils/index.d.ts +2 -2
- package/package.json +119 -119
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
2
|
+
type Format = 'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'plain' | 'dot_json';
|
|
3
3
|
interface Options {
|
|
4
4
|
format?: Format;
|
|
5
5
|
suppressWarnings?: boolean;
|
package/lib/ast/index.cjs
CHANGED
|
@@ -424,7 +424,7 @@ class SyntaxError$1 extends Error {
|
|
|
424
424
|
let src = null;
|
|
425
425
|
let k;
|
|
426
426
|
for (k = 0; k < sources.length; k++) {
|
|
427
|
-
if (sources[k].
|
|
427
|
+
if (sources[k].grammarSource === this.location.source) {
|
|
428
428
|
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
429
429
|
break;
|
|
430
430
|
}
|
package/lib/ast/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ interface ASTCommonPropaties {
|
|
|
35
35
|
/**
|
|
36
36
|
* @group AST
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
type DotASTPropaties = ASTCommonPropaties;
|
|
39
39
|
/**
|
|
40
40
|
* @group AST
|
|
41
41
|
*/
|
|
@@ -80,7 +80,7 @@ interface NodeRefASTPropaties extends ASTCommonPropaties {
|
|
|
80
80
|
/**
|
|
81
81
|
* @group AST
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
type NodeRefGroupASTPropaties = ASTCommonPropaties;
|
|
84
84
|
/**
|
|
85
85
|
* @group AST
|
|
86
86
|
*/
|
|
@@ -97,7 +97,7 @@ interface AttributeListASTPropaties extends ASTCommonPropaties {
|
|
|
97
97
|
/**
|
|
98
98
|
* @group AST
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
type CommentKind = 'Block' | 'Slash' | 'Macro';
|
|
101
101
|
/**
|
|
102
102
|
* @group AST
|
|
103
103
|
*/
|
|
@@ -181,7 +181,7 @@ interface NodeRefGroupASTNode extends ASTBaseParentNode<NodeRefASTNode>, NodeRef
|
|
|
181
181
|
/**
|
|
182
182
|
* @group AST
|
|
183
183
|
*/
|
|
184
|
-
|
|
184
|
+
type EdgeTargetASTNode = NodeRefASTNode | NodeRefGroupASTNode;
|
|
185
185
|
/**
|
|
186
186
|
* Edge AST object.
|
|
187
187
|
* @group AST
|
|
@@ -206,11 +206,11 @@ interface SubgraphASTNode extends ASTBaseParentNode<ClusterStatementASTNode>, Su
|
|
|
206
206
|
/**
|
|
207
207
|
* @group AST
|
|
208
208
|
*/
|
|
209
|
-
|
|
209
|
+
type StatementASTNode = GraphASTNode | CommentASTNode;
|
|
210
210
|
/**
|
|
211
211
|
* @group AST
|
|
212
212
|
*/
|
|
213
|
-
|
|
213
|
+
type ClusterStatementASTNode =
|
|
214
214
|
| AttributeASTNode
|
|
215
215
|
| AttributeListASTNode
|
|
216
216
|
| EdgeASTNode
|
|
@@ -220,7 +220,7 @@ declare type ClusterStatementASTNode =
|
|
|
220
220
|
/**
|
|
221
221
|
* @group AST
|
|
222
222
|
*/
|
|
223
|
-
|
|
223
|
+
type ASTNode =
|
|
224
224
|
| LiteralASTNode
|
|
225
225
|
| DotASTNode
|
|
226
226
|
| GraphASTNode
|
|
@@ -235,7 +235,7 @@ declare type ASTNode =
|
|
|
235
235
|
/**
|
|
236
236
|
* @group AST
|
|
237
237
|
*/
|
|
238
|
-
|
|
238
|
+
type ASTChildNode<T> = T extends ASTBaseParentNode<infer C> ? C : never;
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
241
|
* @group Create AST
|
|
@@ -301,11 +301,11 @@ declare const createElement: CreateElement;
|
|
|
301
301
|
/**
|
|
302
302
|
* @group Convert AST to DOT
|
|
303
303
|
*/
|
|
304
|
-
|
|
304
|
+
type IndentStyle = 'space' | 'tab';
|
|
305
305
|
/**
|
|
306
306
|
* @group Convert AST to DOT
|
|
307
307
|
*/
|
|
308
|
-
|
|
308
|
+
type EndOfLine = 'lf' | 'crlf';
|
|
309
309
|
/**
|
|
310
310
|
* @group Convert AST to DOT
|
|
311
311
|
* @alpha
|
|
@@ -383,12 +383,7 @@ interface IOtherExpectation {
|
|
|
383
383
|
type: 'other';
|
|
384
384
|
description: string;
|
|
385
385
|
}
|
|
386
|
-
|
|
387
|
-
| ILiteralExpectation
|
|
388
|
-
| IClassExpectation
|
|
389
|
-
| IAnyExpectation
|
|
390
|
-
| IEndExpectation
|
|
391
|
-
| IOtherExpectation;
|
|
386
|
+
type Expectation = ILiteralExpectation | IClassExpectation | IAnyExpectation | IEndExpectation | IOtherExpectation;
|
|
392
387
|
declare class SyntaxError$1 extends Error {
|
|
393
388
|
static buildMessage(expected: Expectation[], found: string | null): string;
|
|
394
389
|
message: string;
|
|
@@ -399,7 +394,7 @@ declare class SyntaxError$1 extends Error {
|
|
|
399
394
|
constructor(message: string, expected: Expectation[], found: string | null, location: IFileRange);
|
|
400
395
|
format(
|
|
401
396
|
sources: {
|
|
402
|
-
|
|
397
|
+
grammarSource?: string;
|
|
403
398
|
text: string;
|
|
404
399
|
}[],
|
|
405
400
|
): string;
|
|
@@ -408,15 +403,7 @@ declare class SyntaxError$1 extends Error {
|
|
|
408
403
|
/**
|
|
409
404
|
* @group Convert DOT to AST
|
|
410
405
|
*/
|
|
411
|
-
|
|
412
|
-
| 'Dot'
|
|
413
|
-
| 'Graph'
|
|
414
|
-
| 'Node'
|
|
415
|
-
| 'Edge'
|
|
416
|
-
| 'AttributeList'
|
|
417
|
-
| 'Attribute'
|
|
418
|
-
| 'Subgraph'
|
|
419
|
-
| 'ClusterStatements';
|
|
406
|
+
type Rule = 'Dot' | 'Graph' | 'Node' | 'Edge' | 'AttributeList' | 'Attribute' | 'Subgraph' | 'ClusterStatements';
|
|
420
407
|
/**
|
|
421
408
|
* @group Convert DOT to AST
|
|
422
409
|
*/
|
|
@@ -451,7 +438,7 @@ declare const SyntaxError: typeof SyntaxError$1;
|
|
|
451
438
|
/**
|
|
452
439
|
* @group AST
|
|
453
440
|
*/
|
|
454
|
-
|
|
441
|
+
type ModelToAST<T> = T extends DotObjectModel<infer U>
|
|
455
442
|
? U extends 'Graph'
|
|
456
443
|
? GraphASTNode | DotASTNode
|
|
457
444
|
: U extends 'AttributeList'
|
|
@@ -505,7 +492,7 @@ declare function fromModel<T extends DotObjectModel>(model: T, options?: Convert
|
|
|
505
492
|
/**
|
|
506
493
|
* @group AST
|
|
507
494
|
*/
|
|
508
|
-
|
|
495
|
+
type ModelOf<T> = T extends 'Dot' | 'Graph'
|
|
509
496
|
? RootGraphModel
|
|
510
497
|
: T extends 'Edge'
|
|
511
498
|
? EdgeModel
|
|
@@ -517,7 +504,7 @@ declare type ModelOf<T> = T extends 'Dot' | 'Graph'
|
|
|
517
504
|
/**
|
|
518
505
|
* @group AST
|
|
519
506
|
*/
|
|
520
|
-
|
|
507
|
+
type ASTToModel<T> = T extends {
|
|
521
508
|
type: infer U;
|
|
522
509
|
}
|
|
523
510
|
? ModelOf<U>
|
|
@@ -526,7 +513,7 @@ declare type ASTToModel<T> = T extends {
|
|
|
526
513
|
* @group Convert AST to Model
|
|
527
514
|
* @beta
|
|
528
515
|
*/
|
|
529
|
-
|
|
516
|
+
type ToModelConvertableASTNode = DotASTNode | GraphASTNode | SubgraphASTNode | NodeASTNode | EdgeASTNode;
|
|
530
517
|
/**
|
|
531
518
|
* @group Convert AST to Model
|
|
532
519
|
* @alpha
|
package/lib/ast/index.js
CHANGED
|
@@ -415,7 +415,7 @@ class SyntaxError$1 extends Error {
|
|
|
415
415
|
let src = null;
|
|
416
416
|
let k;
|
|
417
417
|
for (k = 0; k < sources.length; k++) {
|
|
418
|
-
if (sources[k].
|
|
418
|
+
if (sources[k].grammarSource === this.location.source) {
|
|
419
419
|
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
420
420
|
break;
|
|
421
421
|
}
|
package/lib/common/index.d.ts
CHANGED
|
@@ -2,35 +2,35 @@
|
|
|
2
2
|
* Directive indicating which direction the Edge should point.
|
|
3
3
|
* @group Attribute Types
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
type Compass = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw' | 'c' | '_';
|
|
6
6
|
/**
|
|
7
7
|
* A double with an optional prefix `'+'`.
|
|
8
8
|
*
|
|
9
9
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/addDouble/ addDouble}
|
|
10
10
|
* @group Attribute Types
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
type AddDouble = `+${Double}`;
|
|
13
13
|
/**
|
|
14
14
|
* Double-precision floating point number.
|
|
15
15
|
*
|
|
16
16
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/double/ double}
|
|
17
17
|
* @group Attribute Types
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
type Double = number;
|
|
20
20
|
/**
|
|
21
21
|
* Port Position
|
|
22
22
|
*
|
|
23
23
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/portPos/ portPos}
|
|
24
24
|
* @group Attribute Types
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
type PortPos = `${string}:${Compass}` | Compass;
|
|
27
27
|
/**
|
|
28
28
|
* A colon-separated list of doubles: `"%f(:%f)*"` where each %f is a double.
|
|
29
29
|
*
|
|
30
30
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/doubleList/ doubleList}
|
|
31
31
|
* @group Attribute Types
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
type DoubleList =
|
|
34
34
|
| Double
|
|
35
35
|
| `${Double}:${Double}`
|
|
36
36
|
| `${Double}:${Double}:${Double}`
|
|
@@ -46,22 +46,22 @@ declare type DoubleList =
|
|
|
46
46
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/int/ int}
|
|
47
47
|
* @group Attribute Types
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
type Int = number;
|
|
50
50
|
/**
|
|
51
51
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/shape/ shape}
|
|
52
52
|
* @group Attribute Types
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
type Shape = string;
|
|
55
55
|
/**
|
|
56
56
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/smoothType/ smoothType}
|
|
57
57
|
* @group Attribute Types
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
type SmoothType = 'none' | 'avg_dist' | 'graph_dist' | 'power_dist' | 'rng' | 'spring' | 'triangle';
|
|
60
60
|
/**
|
|
61
61
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/splineType/ splineType}
|
|
62
62
|
* @group Attribute Types
|
|
63
63
|
*/
|
|
64
|
-
|
|
64
|
+
type SplineType = SplineType.spline | string;
|
|
65
65
|
/** @hidden */
|
|
66
66
|
declare namespace SplineType {
|
|
67
67
|
type prefix = endp | startp | `${endp}${startp}` | '';
|
|
@@ -74,7 +74,7 @@ declare namespace SplineType {
|
|
|
74
74
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/startType/ startType}
|
|
75
75
|
* @group Attribute Types
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
type StartType = `${StartType.style}${StartType.seed}`;
|
|
78
78
|
/** @hidden */
|
|
79
79
|
declare namespace StartType {
|
|
80
80
|
type style = 'regular' | 'self' | 'random';
|
|
@@ -84,7 +84,7 @@ declare namespace StartType {
|
|
|
84
84
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/style/ style}
|
|
85
85
|
* @group Attribute Types
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
type Style =
|
|
88
88
|
| Style.styleItem
|
|
89
89
|
| `${Style.styleItem},${Style.styleItem}`
|
|
90
90
|
| `${Style.styleItem},${Style.styleItem},${Style.styleItem}`
|
|
@@ -112,7 +112,7 @@ declare namespace Style {
|
|
|
112
112
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/viewPort/ viewPort}
|
|
113
113
|
* @group Attribute Types
|
|
114
114
|
*/
|
|
115
|
-
|
|
115
|
+
type ViewPort = `${Double},${Double},${Double},${Double},${Double}` | `${Double},${Double},${Double},${string}`;
|
|
116
116
|
/**
|
|
117
117
|
* list of strings separated by characters from the layersep attribute (by default, colons, tabs or spaces),
|
|
118
118
|
* defining layer names and implicitly numbered 1,2,…
|
|
@@ -120,14 +120,14 @@ declare type ViewPort = `${Double},${Double},${Double},${Double},${Double}` | `$
|
|
|
120
120
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/layerList/ layerList}
|
|
121
121
|
* @group Attribute Types
|
|
122
122
|
*/
|
|
123
|
-
|
|
123
|
+
type LayerList = string;
|
|
124
124
|
/**
|
|
125
125
|
* specifies a list of layers defined by the layers attribute.
|
|
126
126
|
*
|
|
127
127
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/layerRange/ layerRange}
|
|
128
128
|
* @group Attribute Types
|
|
129
129
|
*/
|
|
130
|
-
|
|
130
|
+
type LayerRange = string;
|
|
131
131
|
/**
|
|
132
132
|
* String with Escape Sequences
|
|
133
133
|
*
|
|
@@ -149,19 +149,19 @@ declare type LayerRange = string;
|
|
|
149
149
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/escString/ escString}
|
|
150
150
|
* @group Attribute Types
|
|
151
151
|
*/
|
|
152
|
-
|
|
152
|
+
type EscString = string;
|
|
153
153
|
/**
|
|
154
154
|
* @see {@link https://graphviz.org/doc/info/shapes.html#html HTML-Like Labels}
|
|
155
155
|
* @group Attribute Types
|
|
156
156
|
*/
|
|
157
|
-
|
|
157
|
+
type HTMLLikeLabel = `<${string}>`;
|
|
158
158
|
/**
|
|
159
159
|
* An escString or an HTML label.
|
|
160
160
|
*
|
|
161
161
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/lblString/ lblString}
|
|
162
162
|
* @group Attribute Types
|
|
163
163
|
*/
|
|
164
|
-
|
|
164
|
+
type LblString = HTMLLikeLabel | EscString;
|
|
165
165
|
/**
|
|
166
166
|
* `"%f,%f('!')?"` representing the point (x,y).
|
|
167
167
|
*
|
|
@@ -170,7 +170,7 @@ declare type LblString = HTMLLikeLabel | EscString;
|
|
|
170
170
|
* If dim=3, point may also have the format `"%f,%f,%f('!')?"` to represent the point (x,y,z).
|
|
171
171
|
* @group Attribute Types
|
|
172
172
|
*/
|
|
173
|
-
|
|
173
|
+
type Point = Point.position | `${Point.position}!`;
|
|
174
174
|
/** @hidden */
|
|
175
175
|
declare namespace Point {
|
|
176
176
|
type position =
|
|
@@ -189,16 +189,12 @@ declare namespace Point {
|
|
|
189
189
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/addPoint/ addPoint}
|
|
190
190
|
* @group Attribute Types
|
|
191
191
|
*/
|
|
192
|
-
|
|
192
|
+
type AddPoint = `+${Point}`;
|
|
193
193
|
/**
|
|
194
194
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/pointList/ pointList}
|
|
195
195
|
* @group Attribute Types
|
|
196
196
|
*/
|
|
197
|
-
|
|
198
|
-
| Point
|
|
199
|
-
| `${Point} ${Point}`
|
|
200
|
-
| `${Point} ${Point} ${Point}`
|
|
201
|
-
| `${Point} ${Point} ${Point} ${Point}`;
|
|
197
|
+
type PointList = Point | `${Point} ${Point}` | `${Point} ${Point} ${Point}` | `${Point} ${Point} ${Point} ${Point}`;
|
|
202
198
|
/**
|
|
203
199
|
* These specify the order in which nodes and edges are drawn in concrete output.
|
|
204
200
|
*
|
|
@@ -209,12 +205,12 @@ declare type PointList =
|
|
|
209
205
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/outputMode/ outputMode}
|
|
210
206
|
* @group Attribute Types
|
|
211
207
|
*/
|
|
212
|
-
|
|
208
|
+
type OutputMode = 'breadthfirst' | 'nodesfirst' | 'edgesfirst';
|
|
213
209
|
/**
|
|
214
210
|
* @see {@link https://graphviz.org/docs/attr-types/packMode/ packMode}
|
|
215
211
|
* @group Attribute Types
|
|
216
212
|
*/
|
|
217
|
-
|
|
213
|
+
type PackMode = 'node' | 'clust' | 'graph' | `array${string}`;
|
|
218
214
|
/**
|
|
219
215
|
* Using `"fast"` gives about a 2-4 times overall speedup compared with `"normal"`,
|
|
220
216
|
* though layout quality can suffer a little.
|
|
@@ -222,7 +218,7 @@ declare type PackMode = 'node' | 'clust' | 'graph' | `array${string}`;
|
|
|
222
218
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/quadType/ quadType}
|
|
223
219
|
* @group Attribute Types
|
|
224
220
|
*/
|
|
225
|
-
|
|
221
|
+
type QuadType = 'normal' | 'fast' | 'none';
|
|
226
222
|
/**
|
|
227
223
|
* Rank Direction
|
|
228
224
|
*
|
|
@@ -232,12 +228,12 @@ declare type QuadType = 'normal' | 'fast' | 'none';
|
|
|
232
228
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/rankdir/ rankdir}
|
|
233
229
|
* @group Attribute Types
|
|
234
230
|
*/
|
|
235
|
-
|
|
231
|
+
type Rankdir = 'TB' | 'LR' | 'BT' | 'RL';
|
|
236
232
|
/**
|
|
237
233
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/rankType/ rankType}
|
|
238
234
|
* @group Attribute Types
|
|
239
235
|
*/
|
|
240
|
-
|
|
236
|
+
type RankType = 'same' | 'min' | 'source' | 'max' | 'sink';
|
|
241
237
|
/**
|
|
242
238
|
* `"%f,%f,%f,%f"`
|
|
243
239
|
*
|
|
@@ -247,7 +243,7 @@ declare type RankType = 'same' | 'min' | 'source' | 'max' | 'sink';
|
|
|
247
243
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/rect/ rect}
|
|
248
244
|
* @group Attribute Types
|
|
249
245
|
*/
|
|
250
|
-
|
|
246
|
+
type Rect = `${Double},${Double},${Double},${Double}`;
|
|
251
247
|
/**
|
|
252
248
|
* The examples above show a set of commonly used arrow shapes.
|
|
253
249
|
*
|
|
@@ -257,7 +253,7 @@ declare type Rect = `${Double},${Double},${Double},${Double}`;
|
|
|
257
253
|
* @see {@link https://graphviz.org/docs/attr-types/arrowType/ arrowType}
|
|
258
254
|
* @group Attribute Types
|
|
259
255
|
*/
|
|
260
|
-
|
|
256
|
+
type ArrowType = ArrowType.aname | `${ArrowType.aname}${ArrowType.aname}`;
|
|
261
257
|
/** @hidden */
|
|
262
258
|
declare namespace ArrowType {
|
|
263
259
|
type shape = 'box' | 'crow' | 'curve' | 'icurve' | 'diamond' | 'dot' | 'inv' | 'none' | 'normal' | 'tee' | 'vee';
|
|
@@ -269,12 +265,12 @@ declare namespace ArrowType {
|
|
|
269
265
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/clusterMode/ clusterMode}
|
|
270
266
|
* @group Attribute Types
|
|
271
267
|
*/
|
|
272
|
-
|
|
268
|
+
type ClusterMode = 'local' | 'global' | 'none';
|
|
273
269
|
/**
|
|
274
270
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/color/ color}
|
|
275
271
|
* @group Attribute Types
|
|
276
272
|
*/
|
|
277
|
-
|
|
273
|
+
type Color = Color.RGB_RGBA | Color.HSV | Color.ColorName | number;
|
|
278
274
|
/** @hidden */
|
|
279
275
|
declare namespace Color {
|
|
280
276
|
/**
|
|
@@ -1132,21 +1128,21 @@ declare namespace Color {
|
|
|
1132
1128
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/colorList/}
|
|
1133
1129
|
* @group Attribute Types
|
|
1134
1130
|
*/
|
|
1135
|
-
|
|
1131
|
+
type ColorList = string;
|
|
1136
1132
|
/**
|
|
1137
1133
|
* Direction Type
|
|
1138
1134
|
*
|
|
1139
1135
|
* @see {@link https://graphviz.gitlab.io/docs/attr-types/dirType/ dirType}
|
|
1140
1136
|
* @group Attribute Types
|
|
1141
1137
|
*/
|
|
1142
|
-
|
|
1138
|
+
type DirType = 'forward' | 'back' | 'both' | 'none';
|
|
1143
1139
|
/**
|
|
1144
1140
|
* Page Direction
|
|
1145
1141
|
*
|
|
1146
1142
|
* @see {@link https://graphviz.org/docs/attr-types/pagedir/ pagedir}
|
|
1147
1143
|
* @group Attribute Types
|
|
1148
1144
|
*/
|
|
1149
|
-
|
|
1145
|
+
type Pagedir = `${Pagedir.TB}${Pagedir.RL}`;
|
|
1150
1146
|
/** @hidden */
|
|
1151
1147
|
declare namespace Pagedir {
|
|
1152
1148
|
type TB = 'T' | 'B';
|
|
@@ -1157,7 +1153,7 @@ declare namespace Pagedir {
|
|
|
1157
1153
|
* Attribute types available for edges.
|
|
1158
1154
|
* @group Attribute
|
|
1159
1155
|
*/
|
|
1160
|
-
|
|
1156
|
+
type EdgeAttributeKey =
|
|
1161
1157
|
| 'URL'
|
|
1162
1158
|
| 'arrowhead'
|
|
1163
1159
|
| 'arrowsize'
|
|
@@ -1228,7 +1224,7 @@ declare type EdgeAttributeKey =
|
|
|
1228
1224
|
* Attribute types available for nodes.
|
|
1229
1225
|
* @group Attribute
|
|
1230
1226
|
*/
|
|
1231
|
-
|
|
1227
|
+
type NodeAttributeKey =
|
|
1232
1228
|
| 'URL'
|
|
1233
1229
|
| 'area'
|
|
1234
1230
|
| 'color'
|
|
@@ -1282,7 +1278,7 @@ declare type NodeAttributeKey =
|
|
|
1282
1278
|
* Attribute types available for graph.
|
|
1283
1279
|
* @group Attribute
|
|
1284
1280
|
*/
|
|
1285
|
-
|
|
1281
|
+
type GraphAttributeKey =
|
|
1286
1282
|
| 'Damping'
|
|
1287
1283
|
| 'K'
|
|
1288
1284
|
| 'URL'
|
|
@@ -1386,12 +1382,12 @@ declare type GraphAttributeKey =
|
|
|
1386
1382
|
* Attribute types available for subgraph.
|
|
1387
1383
|
* @group Attribute
|
|
1388
1384
|
*/
|
|
1389
|
-
|
|
1385
|
+
type SubgraphAttributeKey = 'rank';
|
|
1390
1386
|
/**
|
|
1391
1387
|
* Attribute types available for cluster subgraph.
|
|
1392
1388
|
* @group Attribute
|
|
1393
1389
|
*/
|
|
1394
|
-
|
|
1390
|
+
type ClusterSubgraphAttributeKey =
|
|
1395
1391
|
| 'K'
|
|
1396
1392
|
| 'URL'
|
|
1397
1393
|
| 'area'
|
|
@@ -1426,7 +1422,7 @@ declare type ClusterSubgraphAttributeKey =
|
|
|
1426
1422
|
* Attribute types.
|
|
1427
1423
|
* @group Attribute
|
|
1428
1424
|
*/
|
|
1429
|
-
|
|
1425
|
+
type AttributeKey =
|
|
1430
1426
|
| NodeAttributeKey
|
|
1431
1427
|
| EdgeAttributeKey
|
|
1432
1428
|
| GraphAttributeKey
|
|
@@ -1610,7 +1606,7 @@ interface KeyValueMapping {
|
|
|
1610
1606
|
/**
|
|
1611
1607
|
* @group Attribute
|
|
1612
1608
|
*/
|
|
1613
|
-
|
|
1609
|
+
type Attribute<T extends AttributeKey> = KeyValueMapping[T];
|
|
1614
1610
|
|
|
1615
1611
|
/**
|
|
1616
1612
|
* @group Models Context
|
|
@@ -1637,7 +1633,7 @@ declare function createModelsContext(models: Partial<ModelsContext>): ModelsCont
|
|
|
1637
1633
|
/**
|
|
1638
1634
|
* @group Models
|
|
1639
1635
|
*/
|
|
1640
|
-
|
|
1636
|
+
type ASTType =
|
|
1641
1637
|
| 'Literal'
|
|
1642
1638
|
| 'Dot'
|
|
1643
1639
|
| 'Graph'
|
|
@@ -1653,76 +1649,76 @@ declare type ASTType =
|
|
|
1653
1649
|
* Objects that can be Edge destinations satisfy this interface.
|
|
1654
1650
|
* @group Models
|
|
1655
1651
|
*/
|
|
1656
|
-
|
|
1652
|
+
type NodeRef = NodeModel | ForwardRefNode;
|
|
1657
1653
|
/**
|
|
1658
1654
|
* @group Models
|
|
1659
1655
|
*/
|
|
1660
|
-
|
|
1656
|
+
type NodeRefGroup = NodeRef[];
|
|
1661
1657
|
/**
|
|
1662
1658
|
* string or an object implementing EdgeTarget.
|
|
1663
1659
|
* @group Models
|
|
1664
1660
|
*/
|
|
1665
|
-
|
|
1661
|
+
type NodeRefLike = NodeRef | string;
|
|
1666
1662
|
/**
|
|
1667
1663
|
* @group Models
|
|
1668
1664
|
*/
|
|
1669
|
-
|
|
1665
|
+
type NodeRefGroupLike = NodeRefLike[];
|
|
1670
1666
|
/**
|
|
1671
1667
|
* @group Models
|
|
1672
1668
|
*/
|
|
1673
|
-
|
|
1669
|
+
type EdgeTarget = NodeRef | NodeRefGroup;
|
|
1674
1670
|
/**
|
|
1675
1671
|
* @group Models
|
|
1676
1672
|
*/
|
|
1677
|
-
|
|
1673
|
+
type EdgeTargetLike = NodeRefLike | NodeRefGroupLike;
|
|
1678
1674
|
/**
|
|
1679
1675
|
* @group Models
|
|
1680
1676
|
*/
|
|
1681
|
-
|
|
1677
|
+
type EdgeTargetTuple = [from: EdgeTarget, to: EdgeTarget, ...rest: EdgeTarget[]];
|
|
1682
1678
|
/**
|
|
1683
1679
|
* @group Models
|
|
1684
1680
|
*/
|
|
1685
|
-
|
|
1681
|
+
type EdgeTargetLikeTuple = [from: EdgeTargetLike, to: EdgeTargetLike, ...rest: EdgeTargetLike[]];
|
|
1686
1682
|
/**
|
|
1687
1683
|
* An objects of attribute key/value pairs.
|
|
1688
1684
|
* @group Models
|
|
1689
1685
|
*/
|
|
1690
|
-
|
|
1686
|
+
type AttributesObject<T extends AttributeKey> = {
|
|
1691
1687
|
[K in T]?: Attribute<K>;
|
|
1692
1688
|
};
|
|
1693
1689
|
/**
|
|
1694
1690
|
* @group Models
|
|
1695
1691
|
*/
|
|
1696
|
-
|
|
1692
|
+
type AttributeValue = Attribute<AttributeKey>;
|
|
1697
1693
|
/**
|
|
1698
1694
|
* An array of attribute key/value tuple.
|
|
1699
1695
|
* @group Models
|
|
1700
1696
|
*/
|
|
1701
|
-
|
|
1697
|
+
type AttributesEntities<T extends AttributeKey> = readonly [T, Attribute<T>][];
|
|
1702
1698
|
/**
|
|
1703
1699
|
* Attribute object that can be set to Edge.
|
|
1704
1700
|
* @group Models
|
|
1705
1701
|
*/
|
|
1706
|
-
|
|
1702
|
+
type EdgeAttributesObject = AttributesObject<EdgeAttributeKey>;
|
|
1707
1703
|
/**
|
|
1708
1704
|
* Attribute object that can be set to Node.
|
|
1709
1705
|
* @group Models
|
|
1710
1706
|
*/
|
|
1711
|
-
|
|
1707
|
+
type NodeAttributesObject = AttributesObject<NodeAttributeKey>;
|
|
1712
1708
|
/**
|
|
1713
1709
|
* Attribute object that can be set to Graph.
|
|
1714
1710
|
* @group Models
|
|
1715
1711
|
*/
|
|
1716
|
-
|
|
1712
|
+
type GraphAttributesObject = AttributesObject<GraphAttributeKey>;
|
|
1717
1713
|
/**
|
|
1718
1714
|
* Attribute object that can be set to Subgraph.
|
|
1719
1715
|
* @group Models
|
|
1720
1716
|
*/
|
|
1721
|
-
|
|
1717
|
+
type SubgraphAttributesObject = AttributesObject<ClusterSubgraphAttributeKey | SubgraphAttributeKey>;
|
|
1722
1718
|
/**
|
|
1723
1719
|
* @group Models
|
|
1724
1720
|
*/
|
|
1725
|
-
|
|
1721
|
+
type DotObjectType = 'AttributeList' | 'Node' | 'Edge' | 'Subgraph' | 'Graph';
|
|
1726
1722
|
/**
|
|
1727
1723
|
* @group Models
|
|
1728
1724
|
*/
|
|
@@ -1786,7 +1782,7 @@ interface AttributesGroupModel<T extends AttributeKey> extends Attributes<T>, Ha
|
|
|
1786
1782
|
/**
|
|
1787
1783
|
* @group Models
|
|
1788
1784
|
*/
|
|
1789
|
-
|
|
1785
|
+
type AttributeListKind = 'Graph' | 'Edge' | 'Node';
|
|
1790
1786
|
/**
|
|
1791
1787
|
* A list object of attributes commonly specified for nodes, subgraphs, and edges
|
|
1792
1788
|
* under graph and subgraph.
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type F<A extends any[], O> = (...args: A) => O;
|
|
2
|
+
type IO<I, O> = F<[I], O>;
|
|
3
3
|
declare function pipe<I extends any[], O>(f0: F<I, O>): F<I, O>;
|
|
4
4
|
declare function pipe<I extends any[], T1, O>(f0: F<I, T1>, f1: IO<T1, O>): F<I, O>;
|
|
5
5
|
declare function pipe<I extends any[], T1, T2, O>(f0: F<I, T1>, f1: IO<T1, T2>, f2: IO<T2, O>): F<I, O>;
|
package/package.json
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"graphviz",
|
|
14
|
-
"dot"
|
|
15
|
-
],
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/ts-graphviz/ts-graphviz/issues"
|
|
18
|
-
},
|
|
19
|
-
"funding": {
|
|
20
|
-
"type": "github",
|
|
21
|
-
"url": "https://github.com/sponsors/kamiazya"
|
|
22
|
-
},
|
|
23
|
-
"main": "./lib/index.cjs",
|
|
24
|
-
"module": "./lib/index.js",
|
|
25
|
-
"types": "lib/index.d.ts",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"require": {
|
|
29
|
-
"types": "./lib/index.d.ts",
|
|
30
|
-
"default": "./lib/index.cjs"
|
|
31
|
-
},
|
|
32
|
-
"import": {
|
|
33
|
-
"types": "./lib/index.d.ts",
|
|
34
|
-
"default": "./lib/index.js"
|
|
35
|
-
}
|
|
2
|
+
"name": "ts-graphviz",
|
|
3
|
+
"version": "1.4.1-dev.1f5b79680",
|
|
4
|
+
"author": "kamiazya <yuki@kamiazya.tech>",
|
|
5
|
+
"description": "Graphviz library for TypeScript.",
|
|
6
|
+
"homepage": "https://ts-graphviz.github.io/ts-graphviz/",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/ts-graphviz/ts-graphviz.git"
|
|
36
11
|
},
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"types": "./lib/ast/index.d.ts",
|
|
44
|
-
"default": "./lib/ast/index.js"
|
|
45
|
-
}
|
|
12
|
+
"keywords": [
|
|
13
|
+
"graphviz",
|
|
14
|
+
"dot"
|
|
15
|
+
],
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/ts-graphviz/ts-graphviz/issues"
|
|
46
18
|
},
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"import": "./lib/adapter/browser/index.js",
|
|
51
|
-
"types": "./lib/adapter/browser/index.d.ts"
|
|
52
|
-
},
|
|
53
|
-
"deno": {
|
|
54
|
-
"types": "./lib/adapter/deno/mod.d.ts",
|
|
55
|
-
"default": "./lib/adapter/deno/mod.js"
|
|
56
|
-
},
|
|
57
|
-
"node": {
|
|
58
|
-
"require": "./lib/adapter/node/index.cjs",
|
|
59
|
-
"import": "./lib/adapter/node/index.js",
|
|
60
|
-
"types": "./lib/adapter/node/index.d.ts"
|
|
61
|
-
},
|
|
62
|
-
"default": {
|
|
63
|
-
"types": "./lib/adapter/node/index.d.ts",
|
|
64
|
-
"require": "./lib/adapter/node/index.cjs",
|
|
65
|
-
"import": "./lib/adapter/node/index.js"
|
|
66
|
-
}
|
|
19
|
+
"funding": {
|
|
20
|
+
"type": "github",
|
|
21
|
+
"url": "https://github.com/sponsors/kamiazya"
|
|
67
22
|
},
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
23
|
+
"main": "./lib/index.cjs",
|
|
24
|
+
"module": "./lib/index.js",
|
|
25
|
+
"types": "lib/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./lib/index.d.ts",
|
|
30
|
+
"default": "./lib/index.cjs"
|
|
31
|
+
},
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./lib/index.d.ts",
|
|
34
|
+
"default": "./lib/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"./ast": {
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./lib/ast/index.d.ts",
|
|
40
|
+
"default": "./lib/ast/index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./lib/ast/index.d.ts",
|
|
44
|
+
"default": "./lib/ast/index.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"./adapter": {
|
|
48
|
+
"browser": {
|
|
49
|
+
"require": "./lib/adapter/browser/index.cjs",
|
|
50
|
+
"import": "./lib/adapter/browser/index.js",
|
|
51
|
+
"types": "./lib/adapter/browser/index.d.ts"
|
|
52
|
+
},
|
|
53
|
+
"deno": {
|
|
54
|
+
"types": "./lib/adapter/deno/mod.d.ts",
|
|
55
|
+
"default": "./lib/adapter/deno/mod.js"
|
|
56
|
+
},
|
|
57
|
+
"node": {
|
|
58
|
+
"require": "./lib/adapter/node/index.cjs",
|
|
59
|
+
"import": "./lib/adapter/node/index.js",
|
|
60
|
+
"types": "./lib/adapter/node/index.d.ts"
|
|
61
|
+
},
|
|
62
|
+
"default": {
|
|
63
|
+
"types": "./lib/adapter/node/index.d.ts",
|
|
64
|
+
"require": "./lib/adapter/node/index.cjs",
|
|
65
|
+
"import": "./lib/adapter/node/index.js"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"./package.json": "./package.json"
|
|
69
|
+
},
|
|
70
|
+
"typesVersions": {
|
|
71
|
+
"*": {
|
|
72
|
+
"ast": [
|
|
73
|
+
"lib/ast"
|
|
74
|
+
],
|
|
75
|
+
"adapter": [
|
|
76
|
+
"lib/adapter/node"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"license": "MIT",
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": ">=14.16"
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"build:peggy": "peggy --plugin ts-pegjs --extra-options-file src/ast/dot-shim/parser/peggy.options.json -o src/ast/dot-shim/parser/_parse.ts src/ast/dot-shim/parser/dot.peggy",
|
|
86
|
+
"prebuild": "yarn build:peggy",
|
|
87
|
+
"build:deno": "cp -r src/adapter/deno lib/adapter/deno",
|
|
88
|
+
"build:node": "tsc -p tsconfig.build.json && rollup -c",
|
|
89
|
+
"build": "yarn build:node && yarn build:deno",
|
|
90
|
+
"postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
|
|
91
|
+
"pretest": "yarn build:peggy",
|
|
92
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
|
|
93
|
+
"format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",
|
|
94
|
+
"lint": "eslint --ext ts src",
|
|
95
|
+
"predoc": "yarn build:peggy",
|
|
96
|
+
"doc": "typedoc"
|
|
97
|
+
},
|
|
98
|
+
"devDependencies": {
|
|
99
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
100
|
+
"@types/jest": "^28.1.6",
|
|
101
|
+
"@types/jest-specific-snapshot": "^0.5.6",
|
|
102
|
+
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
|
103
|
+
"@typescript-eslint/parser": "^5.33.0",
|
|
104
|
+
"eslint": "^8.22.0",
|
|
105
|
+
"eslint-config-prettier": "^8.5.0",
|
|
106
|
+
"eslint-plugin-import": "^2.26.0",
|
|
107
|
+
"eslint-plugin-jest": "^26.8.2",
|
|
108
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
109
|
+
"jest": "^28.1.3",
|
|
110
|
+
"jest-snapshot-serializer-raw": "^1.2.0",
|
|
111
|
+
"jest-specific-snapshot": "^5.0.0",
|
|
112
|
+
"peggy": "^2.0.1",
|
|
113
|
+
"prettier": "^2.7.1",
|
|
114
|
+
"prettier-plugin-pegjs": "^0.5.0",
|
|
115
|
+
"rollup": "^2.77.3",
|
|
116
|
+
"rollup-plugin-delete": "^2.0.0",
|
|
117
|
+
"rollup-plugin-dts": "^4.2.2",
|
|
118
|
+
"svgo": "^2.8.0",
|
|
119
|
+
"ts-jest": "^28.0.7",
|
|
120
|
+
"ts-pegjs": "^2.1.0",
|
|
121
|
+
"typedoc": "^0.23.15",
|
|
122
|
+
"typescript": "^4.7.4"
|
|
78
123
|
}
|
|
79
|
-
|
|
80
|
-
"license": "MIT",
|
|
81
|
-
"engines": {
|
|
82
|
-
"node": ">=14.16"
|
|
83
|
-
},
|
|
84
|
-
"scripts": {
|
|
85
|
-
"build:peggy": "peggy --plugin ts-pegjs --extra-options-file src/ast/dot-shim/parser/peggy.options.json -o src/ast/dot-shim/parser/_parse.ts src/ast/dot-shim/parser/dot.peggy",
|
|
86
|
-
"prebuild": "yarn build:peggy",
|
|
87
|
-
"build:deno": "cp -r src/adapter/deno lib/adapter/deno",
|
|
88
|
-
"build:node": "tsc -p tsconfig.build.json && rollup -c",
|
|
89
|
-
"build": "yarn build:node && yarn build:deno",
|
|
90
|
-
"postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}",
|
|
91
|
-
"pretest": "yarn build:peggy",
|
|
92
|
-
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
|
|
93
|
-
"format": "eslint --ext ts src --fix && prettier --write './**/*.{ts,js,json,yaml}' '!lib'",
|
|
94
|
-
"lint": "eslint --ext ts src",
|
|
95
|
-
"predoc": "yarn build:peggy",
|
|
96
|
-
"doc": "typedoc"
|
|
97
|
-
},
|
|
98
|
-
"devDependencies": {
|
|
99
|
-
"@rollup/plugin-replace": "^4.0.0",
|
|
100
|
-
"@types/jest": "^28.1.6",
|
|
101
|
-
"@types/jest-specific-snapshot": "^0.5.6",
|
|
102
|
-
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
|
103
|
-
"@typescript-eslint/parser": "^5.33.0",
|
|
104
|
-
"eslint": "^8.22.0",
|
|
105
|
-
"eslint-config-prettier": "^8.5.0",
|
|
106
|
-
"eslint-plugin-import": "^2.26.0",
|
|
107
|
-
"eslint-plugin-jest": "^26.8.2",
|
|
108
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
109
|
-
"jest": "^28.1.3",
|
|
110
|
-
"jest-snapshot-serializer-raw": "^1.2.0",
|
|
111
|
-
"jest-specific-snapshot": "^5.0.0",
|
|
112
|
-
"peggy": "^2.0.1",
|
|
113
|
-
"prettier": "^2.7.1",
|
|
114
|
-
"prettier-plugin-pegjs": "^0.5.0",
|
|
115
|
-
"rollup": "^2.77.3",
|
|
116
|
-
"rollup-plugin-delete": "^2.0.0",
|
|
117
|
-
"rollup-plugin-dts": "^4.2.2",
|
|
118
|
-
"svgo": "^2.8.0",
|
|
119
|
-
"ts-jest": "^28.0.7",
|
|
120
|
-
"ts-pegjs": "^2.1.0",
|
|
121
|
-
"typedoc": "^0.23.15",
|
|
122
|
-
"typescript": "^4.7.4"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
124
|
+
}
|