@ts-graphviz/core 0.0.0-pr956-20240225073457 → 0.0.0-pr956-20240225160253

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +292 -4
  2. package/lib/AttributeList.cjs +14 -0
  3. package/lib/AttributeList.d.ts +43 -0
  4. package/lib/AttributeList.js +14 -0
  5. package/lib/AttributesBase.cjs +40 -0
  6. package/lib/AttributesBase.d.ts +30 -0
  7. package/lib/AttributesBase.js +40 -0
  8. package/lib/AttributesGroup.cjs +7 -0
  9. package/lib/AttributesGroup.d.ts +39 -0
  10. package/lib/AttributesGroup.js +7 -0
  11. package/lib/Digraph.cjs +9 -0
  12. package/lib/Digraph.d.ts +107 -0
  13. package/lib/Digraph.js +9 -0
  14. package/lib/DotObject.cjs +5 -0
  15. package/lib/DotObject.d.ts +8 -0
  16. package/lib/DotObject.js +5 -0
  17. package/lib/Edge.cjs +23 -0
  18. package/lib/Edge.d.ts +26 -0
  19. package/lib/Edge.js +23 -0
  20. package/lib/Graph.cjs +9 -0
  21. package/lib/Graph.d.ts +107 -0
  22. package/lib/Graph.js +9 -0
  23. package/lib/GraphBase.cjs +152 -0
  24. package/lib/GraphBase.d.ts +81 -0
  25. package/lib/GraphBase.js +152 -0
  26. package/lib/Node.cjs +23 -0
  27. package/lib/Node.d.ts +64 -0
  28. package/lib/Node.js +23 -0
  29. package/lib/RootGraph.cjs +22 -0
  30. package/lib/RootGraph.d.ts +99 -0
  31. package/lib/RootGraph.js +22 -0
  32. package/lib/Subgraph.cjs +26 -0
  33. package/lib/Subgraph.d.ts +95 -0
  34. package/lib/Subgraph.js +26 -0
  35. package/lib/core.cjs +22 -395
  36. package/lib/core.d.ts +442 -177
  37. package/lib/core.js +12 -385
  38. package/lib/register-default.cjs +14 -0
  39. package/lib/register-default.d.ts +1 -0
  40. package/lib/register-default.js +13 -0
  41. package/package.json +59 -17
  42. package/src/attribute.ts +0 -18
  43. package/src/core.ts +0 -5
  44. package/src/from-dot.ts +0 -73
  45. package/src/model-factory/index.ts +0 -2
  46. package/src/model-factory/model-factory-builder.test.ts +0 -79
  47. package/src/model-factory/model-factory-builder.ts +0 -55
  48. package/src/model-factory/model-factory.test.ts +0 -61
  49. package/src/model-factory/model-factory.ts +0 -40
  50. package/src/model-factory/types.ts +0 -46
  51. package/src/models/AttributeList.spec.ts +0 -58
  52. package/src/models/AttributeList.ts +0 -32
  53. package/src/models/AttributesBase.spec.ts +0 -79
  54. package/src/models/AttributesBase.ts +0 -62
  55. package/src/models/AttributesGroup.spec.ts +0 -18
  56. package/src/models/AttributesGroup.ts +0 -13
  57. package/src/models/Digraph.spec.ts +0 -17
  58. package/src/models/Digraph.ts +0 -11
  59. package/src/models/DotObject.ts +0 -5
  60. package/src/models/Edge.spec.ts +0 -48
  61. package/src/models/Edge.ts +0 -40
  62. package/src/models/Graph.spec.ts +0 -18
  63. package/src/models/Graph.ts +0 -11
  64. package/src/models/GraphBase.spec.ts +0 -364
  65. package/src/models/GraphBase.ts +0 -263
  66. package/src/models/Node.spec.ts +0 -25
  67. package/src/models/Node.ts +0 -37
  68. package/src/models/RootGraph.spec.ts +0 -69
  69. package/src/models/RootGraph.ts +0 -48
  70. package/src/models/Subgraph.spec.ts +0 -196
  71. package/src/models/Subgraph.ts +0 -44
  72. package/src/models/index.ts +0 -15
  73. package/src/models/registerModelContext.ts +0 -14
  74. package/src/to-dot.ts +0 -36
  75. package/tsconfig.json +0 -8
  76. package/typedoc.json +0 -4
  77. package/vite.config.ts +0 -22
package/lib/core.d.ts CHANGED
@@ -7,9 +7,6 @@ import { AttributesEntities } from '@ts-graphviz/common';
7
7
  import { AttributesGroupModel } from '@ts-graphviz/common';
8
8
  import { AttributesObject } from '@ts-graphviz/common';
9
9
  import { ClusterSubgraphAttributeKey } from '@ts-graphviz/common';
10
- import { ConvertFromModelOptions } from '@ts-graphviz/ast';
11
- import { ConvertToModelOptions } from '@ts-graphviz/ast';
12
- import { DotObjectModel } from '@ts-graphviz/common';
13
10
  import { EdgeAttributeKey } from '@ts-graphviz/common';
14
11
  import { EdgeAttributesObject } from '@ts-graphviz/common';
15
12
  import { EdgeModel } from '@ts-graphviz/common';
@@ -24,42 +21,156 @@ import { ModelsContext } from '@ts-graphviz/common';
24
21
  import { NodeAttributeKey } from '@ts-graphviz/common';
25
22
  import { NodeAttributesObject } from '@ts-graphviz/common';
26
23
  import { NodeModel } from '@ts-graphviz/common';
27
- import { ParseOptions } from '@ts-graphviz/ast';
28
24
  import { Port } from '@ts-graphviz/common';
29
- import { PrintOptions } from '@ts-graphviz/ast';
30
25
  import { RootGraphModel } from '@ts-graphviz/common';
31
26
  import { SubgraphAttributeKey } from '@ts-graphviz/common';
32
27
  import { SubgraphAttributesObject } from '@ts-graphviz/common';
33
28
  import { SubgraphModel } from '@ts-graphviz/common';
34
29
 
35
30
  /**
36
- * @group Attribute
31
+ * A set of attribute values for any object.
32
+ * @group Models
37
33
  */
38
- export declare const attribute: Attribute.keys;
34
+ export declare class AttributeList<K extends AttributeListKind, T extends AttributeKey = AttributeKey> extends AttributesBase_2<T> implements AttributeListModel<K, T> {
35
+ readonly $$kind: K;
36
+ get $$type(): 'AttributeList';
37
+ comment?: string;
38
+ constructor($$kind: K, attributes?: AttributesObject<T>);
39
+ }
39
40
 
40
41
  /**
41
- * @group Attribute
42
- *
43
- * @deprecated Use {@link Attribute.keys} instead.
42
+ * Base class for DOT objects with attributes.
43
+ * @group Models
44
44
  */
45
- export declare type AttributeKeyDict = Attribute.keys;
45
+ export declare abstract class AttributesBase<T extends AttributeKey> extends DotObject_3 implements Attributes<T> {
46
+ #private;
47
+ constructor(attributes?: AttributesObject<T>);
48
+ get values(): ReadonlyArray<[T, Attribute<T>]>;
49
+ get size(): number;
50
+ get<K extends T>(key: K): Attribute<K> | undefined;
51
+ set<K extends T>(key: K, value: Attribute<K>): void;
52
+ delete(key: T): void;
53
+ apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
54
+ clear(): void;
55
+ }
46
56
 
47
57
  /**
48
- * A set of attribute values for any object.
58
+ * Base class for DOT objects with attributes.
49
59
  * @group Models
50
60
  */
51
- export declare class AttributeList<K extends AttributeListKind, T extends AttributeKey = AttributeKey> extends AttributesBase<T> implements AttributeListModel<K, T> {
52
- readonly $$kind: K;
53
- get $$type(): 'AttributeList';
54
- comment?: string;
55
- constructor($$kind: K, attributes?: AttributesObject<T>);
61
+ declare abstract class AttributesBase_2<T extends AttributeKey> extends DotObject_2 implements Attributes<T> {
62
+ #private;
63
+ constructor(attributes?: AttributesObject<T>);
64
+ get values(): ReadonlyArray<[T, Attribute<T>]>;
65
+ get size(): number;
66
+ get<K extends T>(key: K): Attribute<K> | undefined;
67
+ set<K extends T>(key: K, value: Attribute<K>): void;
68
+ delete(key: T): void;
69
+ apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
70
+ clear(): void;
71
+ }
72
+
73
+ /**
74
+ * Base class for DOT objects with attributes.
75
+ * @group Models
76
+ */
77
+ declare abstract class AttributesBase_3<T extends AttributeKey> extends DotObject_4 implements Attributes<T> {
78
+ #private;
79
+ constructor(attributes?: AttributesObject<T>);
80
+ get values(): ReadonlyArray<[T, Attribute<T>]>;
81
+ get size(): number;
82
+ get<K extends T>(key: K): Attribute<K> | undefined;
83
+ set<K extends T>(key: K, value: Attribute<K>): void;
84
+ delete(key: T): void;
85
+ apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
86
+ clear(): void;
87
+ }
88
+
89
+ /**
90
+ * Base class for DOT objects with attributes.
91
+ * @group Models
92
+ */
93
+ declare abstract class AttributesBase_4<T extends AttributeKey> extends DotObject_5 implements Attributes<T> {
94
+ #private;
95
+ constructor(attributes?: AttributesObject<T>);
96
+ get values(): ReadonlyArray<[T, Attribute<T>]>;
97
+ get size(): number;
98
+ get<K extends T>(key: K): Attribute<K> | undefined;
99
+ set<K extends T>(key: K, value: Attribute<K>): void;
100
+ delete(key: T): void;
101
+ apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
102
+ clear(): void;
103
+ }
104
+
105
+ /**
106
+ * Base class for DOT objects with attributes.
107
+ * @group Models
108
+ */
109
+ declare abstract class AttributesBase_5<T extends AttributeKey> extends DotObject_7 implements Attributes<T> {
110
+ #private;
111
+ constructor(attributes?: AttributesObject<T>);
112
+ get values(): ReadonlyArray<[T, Attribute<T>]>;
113
+ get size(): number;
114
+ get<K extends T>(key: K): Attribute<K> | undefined;
115
+ set<K extends T>(key: K, value: Attribute<K>): void;
116
+ delete(key: T): void;
117
+ apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
118
+ clear(): void;
119
+ }
120
+
121
+ /**
122
+ * Base class for DOT objects with attributes.
123
+ * @group Models
124
+ */
125
+ declare abstract class AttributesBase_6<T extends AttributeKey> extends DotObject_8 implements Attributes<T> {
126
+ #private;
127
+ constructor(attributes?: AttributesObject<T>);
128
+ get values(): ReadonlyArray<[T, Attribute<T>]>;
129
+ get size(): number;
130
+ get<K extends T>(key: K): Attribute<K> | undefined;
131
+ set<K extends T>(key: K, value: Attribute<K>): void;
132
+ delete(key: T): void;
133
+ apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
134
+ clear(): void;
135
+ }
136
+
137
+ /**
138
+ * Base class for DOT objects with attributes.
139
+ * @group Models
140
+ */
141
+ declare abstract class AttributesBase_7<T extends AttributeKey> extends DotObject_2_2 implements Attributes<T> {
142
+ #private;
143
+ constructor(attributes?: AttributesObject<T>);
144
+ get values(): ReadonlyArray<[T, Attribute<T>]>;
145
+ get size(): number;
146
+ get<K extends T>(key: K): Attribute<K> | undefined;
147
+ set<K extends T>(key: K, value: Attribute<K>): void;
148
+ delete(key: T): void;
149
+ apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
150
+ clear(): void;
151
+ }
152
+
153
+ /**
154
+ * Base class for DOT objects with attributes.
155
+ * @group Models
156
+ */
157
+ declare abstract class AttributesBase_8<T extends AttributeKey> extends DotObject_10 implements Attributes<T> {
158
+ #private;
159
+ constructor(attributes?: AttributesObject<T>);
160
+ get values(): ReadonlyArray<[T, Attribute<T>]>;
161
+ get size(): number;
162
+ get<K extends T>(key: K): Attribute<K> | undefined;
163
+ set<K extends T>(key: K, value: Attribute<K>): void;
164
+ delete(key: T): void;
165
+ apply(attributes: AttributesObject<T> | AttributesEntities<T>): void;
166
+ clear(): void;
56
167
  }
57
168
 
58
169
  /**
59
170
  * Base class for DOT objects with attributes.
60
171
  * @group Models
61
172
  */
62
- export declare abstract class AttributesBase<T extends AttributeKey> extends DotObject implements Attributes<T> {
173
+ declare abstract class AttributesBase_9<T extends AttributeKey> extends DotObject_11 implements Attributes<T> {
63
174
  #private;
64
175
  constructor(attributes?: AttributesObject<T>);
65
176
  get values(): ReadonlyArray<[T, Attribute<T>]>;
@@ -75,7 +186,15 @@ export declare abstract class AttributesBase<T extends AttributeKey> extends Dot
75
186
  * A set of attribute values for any object.
76
187
  * @group Models
77
188
  */
78
- export declare class AttributesGroup<T extends AttributeKey = AttributeKey> extends AttributesBase<T> implements AttributesGroupModel<T> {
189
+ export declare class AttributesGroup<T extends AttributeKey = AttributeKey> extends AttributesBase_3<T> implements AttributesGroupModel<T> {
190
+ comment?: string;
191
+ }
192
+
193
+ /**
194
+ * A set of attribute values for any object.
195
+ * @group Models
196
+ */
197
+ declare class AttributesGroup_2<T extends AttributeKey = AttributeKey> extends AttributesBase_7<T> implements AttributesGroupModel<T> {
79
198
  comment?: string;
80
199
  }
81
200
 
@@ -83,28 +202,99 @@ export declare class AttributesGroup<T extends AttributeKey = AttributeKey> exte
83
202
  * DOT object class representing a digraph.
84
203
  * @group Models
85
204
  */
86
- export declare class Digraph extends RootGraph {
205
+ export declare class Digraph extends RootGraph_2 {
87
206
  get directed(): boolean;
88
207
  }
89
208
 
90
209
  /**
91
- * digraph is a factory for creating Digraph objects.
92
- * @group Model Factory
210
+ * Base class for DOT objects.
211
+ * @group Models
93
212
  */
94
- export declare const digraph: ModelFactory;
213
+ export declare abstract class DotObject {
214
+ }
95
215
 
96
216
  /**
97
217
  * Base class for DOT objects.
98
218
  * @group Models
99
219
  */
100
- export declare abstract class DotObject {
220
+ declare abstract class DotObject_10 {
221
+ }
222
+
223
+ /**
224
+ * Base class for DOT objects.
225
+ * @group Models
226
+ */
227
+ declare abstract class DotObject_11 {
228
+ }
229
+
230
+ /**
231
+ * Base class for DOT objects.
232
+ * @group Models
233
+ */
234
+ declare abstract class DotObject_2 {
235
+ }
236
+
237
+ /**
238
+ * Base class for DOT objects.
239
+ * @group Models
240
+ */
241
+ declare abstract class DotObject_2_2 {
242
+ }
243
+
244
+ /**
245
+ * Base class for DOT objects.
246
+ * @group Models
247
+ */
248
+ declare abstract class DotObject_3 {
249
+ }
250
+
251
+ /**
252
+ * Base class for DOT objects.
253
+ * @group Models
254
+ */
255
+ declare abstract class DotObject_4 {
256
+ }
257
+
258
+ /**
259
+ * Base class for DOT objects.
260
+ * @group Models
261
+ */
262
+ declare abstract class DotObject_5 {
263
+ }
264
+
265
+ /**
266
+ * Base class for DOT objects.
267
+ * @group Models
268
+ */
269
+ declare abstract class DotObject_6 {
270
+ }
271
+
272
+ /**
273
+ * Base class for DOT objects.
274
+ * @group Models
275
+ */
276
+ declare abstract class DotObject_7 {
277
+ }
278
+
279
+ /**
280
+ * Base class for DOT objects.
281
+ * @group Models
282
+ */
283
+ declare abstract class DotObject_8 {
284
+ }
285
+
286
+ /**
287
+ * Base class for DOT objects.
288
+ * @group Models
289
+ */
290
+ declare abstract class DotObject_9 {
101
291
  }
102
292
 
103
293
  /**
104
294
  * DOT object class representing a edge.
105
295
  * @group Models
106
296
  */
107
- export declare class Edge extends DotObject implements EdgeModel {
297
+ export declare class Edge extends DotObject_6 implements EdgeModel {
108
298
  readonly targets: EdgeTargetTuple;
109
299
  get $$type(): 'Edge';
110
300
  comment?: string;
@@ -113,57 +303,182 @@ export declare class Edge extends DotObject implements EdgeModel {
113
303
  }
114
304
 
115
305
  /**
116
- * fromDot is a function that converts a DOT string to a model.
117
- *
118
- * @group Convert DOT to Model
119
- *
120
- * @param dot The DOT string to convert.
121
- * @param options Options for converting the DOT string to a model.
122
- * @returns A model of type {@link RootGraphModel}, {@link NodeModel}, {@link EdgeModel}, or {@link SubgraphModel},
123
- * depending on the type specified in the options.
306
+ * DOT object class representing a graph.
307
+ * @group Models
124
308
  */
125
- export declare function fromDot(dot: string, options?: FromDotOptions<'Dot' | 'Graph'>): RootGraphModel;
126
-
127
- export declare function fromDot(dot: string, options?: FromDotOptions<'Node'>): NodeModel;
128
-
129
- export declare function fromDot(dot: string, options?: FromDotOptions<'Edge'>): EdgeModel;
309
+ export declare class Graph extends RootGraph_3 {
310
+ get directed(): boolean;
311
+ }
130
312
 
131
- export declare function fromDot(dot: string, options?: FromDotOptions<'Subgraph'>): SubgraphModel;
313
+ /**
314
+ * Base class for Graph objects.
315
+ * @group Models
316
+ */
317
+ export declare abstract class GraphBase<T extends AttributeKey> extends AttributesBase_6<T> implements GraphBaseModel<T> {
318
+ #private;
319
+ readonly id?: string;
320
+ comment?: string;
321
+ readonly attributes: Readonly<GraphCommonAttributes>;
322
+ get nodes(): ReadonlyArray<NodeModel>;
323
+ get edges(): ReadonlyArray<EdgeModel>;
324
+ get subgraphs(): ReadonlyArray<SubgraphModel>;
325
+ with(models: Partial<ModelsContext>): void;
326
+ addNode(node: NodeModel): void;
327
+ addEdge(edge: EdgeModel): void;
328
+ addSubgraph(subgraph: SubgraphModel): void;
329
+ existNode(nodeId: string): boolean;
330
+ existEdge(edge: EdgeModel): boolean;
331
+ existSubgraph(subgraph: SubgraphModel): boolean;
332
+ createSubgraph(id?: string, attributes?: SubgraphAttributesObject): SubgraphModel;
333
+ createSubgraph(attributes?: SubgraphAttributesObject): SubgraphModel;
334
+ removeNode(node: NodeModel | string): void;
335
+ removeEdge(edge: EdgeModel): void;
336
+ removeSubgraph(subgraph: SubgraphModel): void;
337
+ createNode(id: string, attributes?: NodeAttributesObject): NodeModel;
338
+ getSubgraph(id: string): SubgraphModel | undefined;
339
+ getNode(id: string): NodeModel | undefined;
340
+ createEdge(targets: EdgeTargetLikeTuple, attributes?: EdgeAttributesObject): EdgeModel;
341
+ subgraph(id: string, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
342
+ subgraph(id: string, attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
343
+ subgraph(attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
344
+ subgraph(callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
345
+ node(id: string, callback?: (node: NodeModel) => void): NodeModel;
346
+ node(id: string, attributes: NodeAttributesObject, callback?: (node: NodeModel) => void): NodeModel;
347
+ node(attributes: NodeAttributesObject): void;
348
+ edge(targets: EdgeTargetLikeTuple, callback?: (edge: EdgeModel) => void): EdgeModel;
349
+ edge(targets: EdgeTargetLikeTuple, attributes: EdgeAttributesObject, callback?: (edge: EdgeModel) => void): EdgeModel;
350
+ edge(attributes: EdgeAttributesObject): void;
351
+ graph(attributes: SubgraphAttributesObject): void;
352
+ }
132
353
 
133
354
  /**
134
- * This interface provides options for converting DOT to a model.
135
- * @group Convert DOT to Model
355
+ * Base class for Graph objects.
356
+ * @group Models
136
357
  */
137
- export declare interface FromDotOptions<T extends 'Dot' | 'Graph' | 'Node' | 'Edge' | 'Subgraph'> {
138
- /**
139
- * Options for parsing DOT.
140
- */
141
- parse?: ParseOptions<T>;
142
- /**
143
- * Options for converting the parsed DOT to a model.
144
- */
145
- convert?: ConvertToModelOptions;
358
+ declare abstract class GraphBase_2<T extends AttributeKey> extends AttributesBase_4<T> implements GraphBaseModel<T> {
359
+ #private;
360
+ readonly id?: string;
361
+ comment?: string;
362
+ readonly attributes: Readonly<GraphCommonAttributes>;
363
+ get nodes(): ReadonlyArray<NodeModel>;
364
+ get edges(): ReadonlyArray<EdgeModel>;
365
+ get subgraphs(): ReadonlyArray<SubgraphModel>;
366
+ with(models: Partial<ModelsContext>): void;
367
+ addNode(node: NodeModel): void;
368
+ addEdge(edge: EdgeModel): void;
369
+ addSubgraph(subgraph: SubgraphModel): void;
370
+ existNode(nodeId: string): boolean;
371
+ existEdge(edge: EdgeModel): boolean;
372
+ existSubgraph(subgraph: SubgraphModel): boolean;
373
+ createSubgraph(id?: string, attributes?: SubgraphAttributesObject): SubgraphModel;
374
+ createSubgraph(attributes?: SubgraphAttributesObject): SubgraphModel;
375
+ removeNode(node: NodeModel | string): void;
376
+ removeEdge(edge: EdgeModel): void;
377
+ removeSubgraph(subgraph: SubgraphModel): void;
378
+ createNode(id: string, attributes?: NodeAttributesObject): NodeModel;
379
+ getSubgraph(id: string): SubgraphModel | undefined;
380
+ getNode(id: string): NodeModel | undefined;
381
+ createEdge(targets: EdgeTargetLikeTuple, attributes?: EdgeAttributesObject): EdgeModel;
382
+ subgraph(id: string, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
383
+ subgraph(id: string, attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
384
+ subgraph(attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
385
+ subgraph(callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
386
+ node(id: string, callback?: (node: NodeModel) => void): NodeModel;
387
+ node(id: string, attributes: NodeAttributesObject, callback?: (node: NodeModel) => void): NodeModel;
388
+ node(attributes: NodeAttributesObject): void;
389
+ edge(targets: EdgeTargetLikeTuple, callback?: (edge: EdgeModel) => void): EdgeModel;
390
+ edge(targets: EdgeTargetLikeTuple, attributes: EdgeAttributesObject, callback?: (edge: EdgeModel) => void): EdgeModel;
391
+ edge(attributes: EdgeAttributesObject): void;
392
+ graph(attributes: SubgraphAttributesObject): void;
146
393
  }
147
394
 
148
395
  /**
149
- * DOT object class representing a graph.
396
+ * Base class for Graph objects.
150
397
  * @group Models
151
398
  */
152
- export declare class Graph extends RootGraph {
153
- get directed(): boolean;
399
+ declare abstract class GraphBase_3<T extends AttributeKey> extends AttributesBase_5<T> implements GraphBaseModel<T> {
400
+ #private;
401
+ readonly id?: string;
402
+ comment?: string;
403
+ readonly attributes: Readonly<GraphCommonAttributes>;
404
+ get nodes(): ReadonlyArray<NodeModel>;
405
+ get edges(): ReadonlyArray<EdgeModel>;
406
+ get subgraphs(): ReadonlyArray<SubgraphModel>;
407
+ with(models: Partial<ModelsContext>): void;
408
+ addNode(node: NodeModel): void;
409
+ addEdge(edge: EdgeModel): void;
410
+ addSubgraph(subgraph: SubgraphModel): void;
411
+ existNode(nodeId: string): boolean;
412
+ existEdge(edge: EdgeModel): boolean;
413
+ existSubgraph(subgraph: SubgraphModel): boolean;
414
+ createSubgraph(id?: string, attributes?: SubgraphAttributesObject): SubgraphModel;
415
+ createSubgraph(attributes?: SubgraphAttributesObject): SubgraphModel;
416
+ removeNode(node: NodeModel | string): void;
417
+ removeEdge(edge: EdgeModel): void;
418
+ removeSubgraph(subgraph: SubgraphModel): void;
419
+ createNode(id: string, attributes?: NodeAttributesObject): NodeModel;
420
+ getSubgraph(id: string): SubgraphModel | undefined;
421
+ getNode(id: string): NodeModel | undefined;
422
+ createEdge(targets: EdgeTargetLikeTuple, attributes?: EdgeAttributesObject): EdgeModel;
423
+ subgraph(id: string, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
424
+ subgraph(id: string, attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
425
+ subgraph(attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
426
+ subgraph(callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
427
+ node(id: string, callback?: (node: NodeModel) => void): NodeModel;
428
+ node(id: string, attributes: NodeAttributesObject, callback?: (node: NodeModel) => void): NodeModel;
429
+ node(attributes: NodeAttributesObject): void;
430
+ edge(targets: EdgeTargetLikeTuple, callback?: (edge: EdgeModel) => void): EdgeModel;
431
+ edge(targets: EdgeTargetLikeTuple, attributes: EdgeAttributesObject, callback?: (edge: EdgeModel) => void): EdgeModel;
432
+ edge(attributes: EdgeAttributesObject): void;
433
+ graph(attributes: SubgraphAttributesObject): void;
154
434
  }
155
435
 
156
436
  /**
157
- * graph is a factory for creating Graph objects.
158
- * @group Model Factory
437
+ * Base class for Graph objects.
438
+ * @group Models
159
439
  */
160
- export declare const graph: ModelFactory;
440
+ declare abstract class GraphBase_4<T extends AttributeKey> extends AttributesBase_8<T> implements GraphBaseModel<T> {
441
+ #private;
442
+ readonly id?: string;
443
+ comment?: string;
444
+ readonly attributes: Readonly<GraphCommonAttributes>;
445
+ get nodes(): ReadonlyArray<NodeModel>;
446
+ get edges(): ReadonlyArray<EdgeModel>;
447
+ get subgraphs(): ReadonlyArray<SubgraphModel>;
448
+ with(models: Partial<ModelsContext>): void;
449
+ addNode(node: NodeModel): void;
450
+ addEdge(edge: EdgeModel): void;
451
+ addSubgraph(subgraph: SubgraphModel): void;
452
+ existNode(nodeId: string): boolean;
453
+ existEdge(edge: EdgeModel): boolean;
454
+ existSubgraph(subgraph: SubgraphModel): boolean;
455
+ createSubgraph(id?: string, attributes?: SubgraphAttributesObject): SubgraphModel;
456
+ createSubgraph(attributes?: SubgraphAttributesObject): SubgraphModel;
457
+ removeNode(node: NodeModel | string): void;
458
+ removeEdge(edge: EdgeModel): void;
459
+ removeSubgraph(subgraph: SubgraphModel): void;
460
+ createNode(id: string, attributes?: NodeAttributesObject): NodeModel;
461
+ getSubgraph(id: string): SubgraphModel | undefined;
462
+ getNode(id: string): NodeModel | undefined;
463
+ createEdge(targets: EdgeTargetLikeTuple, attributes?: EdgeAttributesObject): EdgeModel;
464
+ subgraph(id: string, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
465
+ subgraph(id: string, attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
466
+ subgraph(attributes: SubgraphAttributesObject, callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
467
+ subgraph(callback?: (subgraph: SubgraphModel) => void): SubgraphModel;
468
+ node(id: string, callback?: (node: NodeModel) => void): NodeModel;
469
+ node(id: string, attributes: NodeAttributesObject, callback?: (node: NodeModel) => void): NodeModel;
470
+ node(attributes: NodeAttributesObject): void;
471
+ edge(targets: EdgeTargetLikeTuple, callback?: (edge: EdgeModel) => void): EdgeModel;
472
+ edge(targets: EdgeTargetLikeTuple, attributes: EdgeAttributesObject, callback?: (edge: EdgeModel) => void): EdgeModel;
473
+ edge(attributes: EdgeAttributesObject): void;
474
+ graph(attributes: SubgraphAttributesObject): void;
475
+ }
161
476
 
162
477
  /**
163
478
  * Base class for Graph objects.
164
479
  * @group Models
165
480
  */
166
- export declare abstract class GraphBase<T extends AttributeKey> extends AttributesBase<T> implements GraphBaseModel<T> {
481
+ declare abstract class GraphBase_5<T extends AttributeKey> extends AttributesBase_9<T> implements GraphBaseModel<T> {
167
482
  #private;
168
483
  readonly id?: string;
169
484
  comment?: string;
@@ -201,123 +516,73 @@ export declare abstract class GraphBase<T extends AttributeKey> extends Attribut
201
516
  }
202
517
 
203
518
  /**
204
- * @group Model Factory
205
- */
206
- export declare interface ModelFactories {
207
- /**
208
- * API for creating directional graph objects.
209
- */
210
- digraph: ModelFactory;
211
- /**
212
- * API for creating omnidirectional graph objects.
213
- */
214
- graph: ModelFactory;
215
- }
216
-
217
- /**
218
- * @group Model Factory
219
- */
220
- export declare interface ModelFactoriesWithStrict extends ModelFactories {
221
- strict: ModelFactories;
222
- }
223
-
224
- /**
225
- * ModelFactory is an interface that provides a way to create a {@link RootGraphModel} object.
226
- *
227
- * @param id - Optional string parameter that specifies the id of the {@link RootGraphModel} object.
228
- * @param attributes - Optional GraphAttributesObject parameter that specifies the attributes of the {@link RootGraphModel} object.
229
- * @param callback - Optional callback function that takes a {@link RootGraphModel} object as a parameter.
230
- *
231
- * @returns {@link RootGraphModel} - Returns a {@link RootGraphModel} object.
232
- * @group Model Factory
233
- */
234
- export declare interface ModelFactory {
235
- (id?: string, attributes?: GraphAttributesObject, callback?: (g: RootGraphModel) => void): RootGraphModel;
236
- (attributes?: GraphAttributesObject, callback?: (g: RootGraphModel) => void): RootGraphModel;
237
- (id?: string, callback?: (g: RootGraphModel) => void): RootGraphModel;
238
- (callback?: (g: RootGraphModel) => void): RootGraphModel;
239
- }
240
-
241
- /**
242
- * DOT object class representing a node.
243
- * @group Models
244
- */
245
- declare class Node_2 extends DotObject implements NodeModel {
246
- readonly id: string;
247
- get $$type(): 'Node';
248
- comment?: string;
249
- readonly attributes: AttributesGroup<NodeAttributeKey>;
250
- constructor(id: string, attributes?: NodeAttributesObject);
251
- port(port: string | Partial<Port>): ForwardRefNode;
252
- }
253
- export { Node_2 as Node }
254
-
255
- /**
256
- * Base class representing a root graph(digraph, graph).
257
- * @group Models
258
- */
259
- export declare abstract class RootGraph extends GraphBase<GraphAttributeKey> implements RootGraphModel {
260
- get $$type(): 'Graph';
261
- readonly id?: string;
262
- abstract readonly directed: boolean;
263
- strict: boolean;
264
- constructor(id?: string, attributes?: GraphAttributesObject);
265
- constructor(id?: string, strict?: boolean, attributes?: GraphAttributesObject);
266
- constructor(strict?: boolean, attributes?: GraphAttributesObject);
267
- constructor(attributes?: GraphAttributesObject);
268
- }
269
-
270
- /**
271
- * Provides a strict mode API.
272
- * @group Model Factory
273
- */
274
- export declare const strict: ModelFactories;
275
-
276
- /**
277
- * DOT object class representing a subgraph.
278
- * @group Models
279
- */
280
- export declare class Subgraph extends GraphBase<SubgraphAttributeKey | ClusterSubgraphAttributeKey> implements SubgraphModel {
281
- get $$type(): 'Subgraph';
282
- readonly id?: string;
283
- constructor(id?: string, attributes?: SubgraphAttributesObject);
284
- constructor(attributes?: SubgraphAttributesObject);
285
- isSubgraphCluster(): boolean;
286
- }
287
-
288
- /**
289
- * Convert Model to DOT string.
290
- *
291
- * @group Convert Model to DOT
292
- *
293
- * @param model Dot Object Model, like {@link Digraph}, {@link Graph}, {@link Subgraph}, {@link Node}, and {@link Edge}
294
- * @param options Optional options for the conversion.
295
- * @returns DOT string
296
- */
297
- export declare function toDot(model: DotObjectModel, options?: ToDotOptions): string;
298
-
299
- /**
300
- * This interface provides options for converting a model to DOT.
301
- * @group Convert Model to DOT
302
- */
303
- export declare interface ToDotOptions {
304
- /**
305
- * Options for converting the model to DOT.
306
- */
307
- convert?: ConvertFromModelOptions;
308
- /**
309
- * Options for printing DOT.
310
- */
311
- print?: PrintOptions;
312
- }
313
-
314
- /**
315
- * withContext creates a {@link ModelFactoriesWithStrict} object with the given context.
316
- *
317
- * @param models - An object containing the models to be used in the context.
318
- *
319
- * @returns A ModelFactoriesWithStrict object containing the factories. * @group Model Factory
320
- */
321
- export declare function withContext(models: Partial<ModelsContext>): ModelFactoriesWithStrict;
322
-
323
- export { }
519
+ * DOT object class representing a node.
520
+ * @group Models
521
+ */
522
+ export declare class Node extends DotObject_9 implements NodeModel {
523
+ readonly id: string;
524
+ get $$type(): 'Node';
525
+ comment?: string;
526
+ readonly attributes: AttributesGroup_2<NodeAttributeKey>;
527
+ constructor(id: string, attributes?: NodeAttributesObject);
528
+ port(port: string | Partial<Port>): ForwardRefNode;
529
+ }
530
+
531
+ /**
532
+ * Base class representing a root graph(digraph, graph).
533
+ * @group Models
534
+ */
535
+ export declare abstract class RootGraph extends GraphBase_4<GraphAttributeKey> implements RootGraphModel {
536
+ get $$type(): 'Graph';
537
+ readonly id?: string;
538
+ abstract readonly directed: boolean;
539
+ strict: boolean;
540
+ constructor(id?: string, attributes?: GraphAttributesObject);
541
+ constructor(id?: string, strict?: boolean, attributes?: GraphAttributesObject);
542
+ constructor(strict?: boolean, attributes?: GraphAttributesObject);
543
+ constructor(attributes?: GraphAttributesObject);
544
+ }
545
+
546
+ /**
547
+ * Base class representing a root graph(digraph, graph).
548
+ * @group Models
549
+ */
550
+ declare abstract class RootGraph_2 extends GraphBase_2<GraphAttributeKey> implements RootGraphModel {
551
+ get $$type(): 'Graph';
552
+ readonly id?: string;
553
+ abstract readonly directed: boolean;
554
+ strict: boolean;
555
+ constructor(id?: string, attributes?: GraphAttributesObject);
556
+ constructor(id?: string, strict?: boolean, attributes?: GraphAttributesObject);
557
+ constructor(strict?: boolean, attributes?: GraphAttributesObject);
558
+ constructor(attributes?: GraphAttributesObject);
559
+ }
560
+
561
+ /**
562
+ * Base class representing a root graph(digraph, graph).
563
+ * @group Models
564
+ */
565
+ declare abstract class RootGraph_3 extends GraphBase_3<GraphAttributeKey> implements RootGraphModel {
566
+ get $$type(): 'Graph';
567
+ readonly id?: string;
568
+ abstract readonly directed: boolean;
569
+ strict: boolean;
570
+ constructor(id?: string, attributes?: GraphAttributesObject);
571
+ constructor(id?: string, strict?: boolean, attributes?: GraphAttributesObject);
572
+ constructor(strict?: boolean, attributes?: GraphAttributesObject);
573
+ constructor(attributes?: GraphAttributesObject);
574
+ }
575
+
576
+ /**
577
+ * DOT object class representing a subgraph.
578
+ * @group Models
579
+ */
580
+ export declare class Subgraph extends GraphBase_5<SubgraphAttributeKey | ClusterSubgraphAttributeKey> implements SubgraphModel {
581
+ get $$type(): 'Subgraph';
582
+ readonly id?: string;
583
+ constructor(id?: string, attributes?: SubgraphAttributesObject);
584
+ constructor(attributes?: SubgraphAttributesObject);
585
+ isSubgraphCluster(): boolean;
586
+ }
587
+
588
+ export { }