ts-graphviz 1.5.5-dev.bdbba8a60 → 1.5.6-dev.29eb2444f
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 +75 -0
- package/lib/adapter/browser/index.cjs +0 -11
- package/lib/adapter/browser/index.js +0 -11
- package/lib/adapter/deno/mod.js +2 -2
- package/lib/adapter/node/index.cjs +1 -13
- package/lib/adapter/node/index.d.ts +1 -1
- package/lib/adapter/node/index.js +2 -14
- package/lib/adapter/types/index.d.ts +27 -2
- package/lib/adapter/utils/index.cjs +5 -4
- package/lib/adapter/utils/index.d.ts +8 -2
- package/lib/adapter/utils/index.js +5 -4
- package/lib/ast/index.cjs +0 -47
- package/lib/ast/index.d.ts +328 -17
- package/lib/ast/index.js +0 -47
- package/lib/common/index.cjs +0 -17
- package/lib/common/index.d.ts +3871 -1278
- package/lib/common/index.js +0 -17
- package/lib/core/index.cjs +0 -75
- package/lib/core/index.d.ts +40 -2491
- package/lib/core/index.js +0 -75
- package/lib/index.d.ts +1 -0
- package/lib/utils/index.d.ts +8 -1
- package/package.json +2 -2
package/lib/core/index.js
CHANGED
|
@@ -8,25 +8,13 @@ import {
|
|
|
8
8
|
} from '../common/index.js';
|
|
9
9
|
import { fromModel, stringify, parse, toModel } from '../ast/index.js';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* @group Attribute
|
|
13
|
-
*/
|
|
14
11
|
const attribute = new Proxy(Object.freeze({}), {
|
|
15
12
|
get: (_, key) => key,
|
|
16
13
|
});
|
|
17
14
|
|
|
18
|
-
/**
|
|
19
|
-
* Base class for DOT objects.
|
|
20
|
-
* @group Models
|
|
21
|
-
*/
|
|
22
15
|
class DotObject {}
|
|
23
16
|
|
|
24
|
-
/**
|
|
25
|
-
* Base class for DOT objects with attributes.
|
|
26
|
-
* @group Models
|
|
27
|
-
*/
|
|
28
17
|
class AttributesBase extends DotObject {
|
|
29
|
-
/** @hidden */
|
|
30
18
|
#attrs = new Map();
|
|
31
19
|
constructor(attributes) {
|
|
32
20
|
super();
|
|
@@ -62,10 +50,6 @@ class AttributesBase extends DotObject {
|
|
|
62
50
|
}
|
|
63
51
|
}
|
|
64
52
|
|
|
65
|
-
/**
|
|
66
|
-
* A set of attribute values for any object.
|
|
67
|
-
* @group Models
|
|
68
|
-
*/
|
|
69
53
|
class AttributeList extends AttributesBase {
|
|
70
54
|
$$kind;
|
|
71
55
|
get $$type() {
|
|
@@ -78,12 +62,7 @@ class AttributeList extends AttributesBase {
|
|
|
78
62
|
}
|
|
79
63
|
}
|
|
80
64
|
|
|
81
|
-
/**
|
|
82
|
-
* Base class for Graph objects.
|
|
83
|
-
* @group Models
|
|
84
|
-
*/
|
|
85
65
|
class GraphBase extends AttributesBase {
|
|
86
|
-
/** @hidden */
|
|
87
66
|
#models = RootModelsContext;
|
|
88
67
|
id;
|
|
89
68
|
comment;
|
|
@@ -101,7 +80,6 @@ class GraphBase extends AttributesBase {
|
|
|
101
80
|
get subgraphs() {
|
|
102
81
|
return Array.from(this.#objects.subgraphs.values());
|
|
103
82
|
}
|
|
104
|
-
/** @hidden */
|
|
105
83
|
#objects = {
|
|
106
84
|
nodes: new Map(),
|
|
107
85
|
edges: new Set(),
|
|
@@ -211,10 +189,6 @@ class GraphBase extends AttributesBase {
|
|
|
211
189
|
}
|
|
212
190
|
}
|
|
213
191
|
|
|
214
|
-
/**
|
|
215
|
-
* Base class representing a root graph(digraph, graph).
|
|
216
|
-
* @group Models
|
|
217
|
-
*/
|
|
218
192
|
class RootGraph extends GraphBase {
|
|
219
193
|
get $$type() {
|
|
220
194
|
return 'Graph';
|
|
@@ -232,30 +206,18 @@ class RootGraph extends GraphBase {
|
|
|
232
206
|
}
|
|
233
207
|
}
|
|
234
208
|
|
|
235
|
-
/**
|
|
236
|
-
* DOT object class representing a digraph.
|
|
237
|
-
* @group Models
|
|
238
|
-
*/
|
|
239
209
|
class Digraph extends RootGraph {
|
|
240
210
|
get directed() {
|
|
241
211
|
return true;
|
|
242
212
|
}
|
|
243
213
|
}
|
|
244
214
|
|
|
245
|
-
/**
|
|
246
|
-
* DOT object class representing a graph.
|
|
247
|
-
* @group Models
|
|
248
|
-
*/
|
|
249
215
|
class Graph extends RootGraph {
|
|
250
216
|
get directed() {
|
|
251
217
|
return false;
|
|
252
218
|
}
|
|
253
219
|
}
|
|
254
220
|
|
|
255
|
-
/**
|
|
256
|
-
* DOT object class representing a subgraph.
|
|
257
|
-
* @group Models
|
|
258
|
-
*/
|
|
259
221
|
class Subgraph extends GraphBase {
|
|
260
222
|
get $$type() {
|
|
261
223
|
return 'Subgraph';
|
|
@@ -277,18 +239,10 @@ class Subgraph extends GraphBase {
|
|
|
277
239
|
}
|
|
278
240
|
}
|
|
279
241
|
|
|
280
|
-
/**
|
|
281
|
-
* A set of attribute values for any object.
|
|
282
|
-
* @group Models
|
|
283
|
-
*/
|
|
284
242
|
class AttributesGroup extends AttributesBase {
|
|
285
243
|
comment;
|
|
286
244
|
}
|
|
287
245
|
|
|
288
|
-
/**
|
|
289
|
-
* DOT object class representing a node.
|
|
290
|
-
* @group Models
|
|
291
|
-
*/
|
|
292
246
|
class Node extends DotObject {
|
|
293
247
|
id;
|
|
294
248
|
get $$type() {
|
|
@@ -309,10 +263,6 @@ class Node extends DotObject {
|
|
|
309
263
|
}
|
|
310
264
|
}
|
|
311
265
|
|
|
312
|
-
/**
|
|
313
|
-
* DOT object class representing a edge.
|
|
314
|
-
* @group Models
|
|
315
|
-
*/
|
|
316
266
|
class Edge extends DotObject {
|
|
317
267
|
targets;
|
|
318
268
|
get $$type() {
|
|
@@ -338,7 +288,6 @@ Object.assign(RootModelsContext, {
|
|
|
338
288
|
Edge,
|
|
339
289
|
});
|
|
340
290
|
|
|
341
|
-
/** @hidden */
|
|
342
291
|
function ModelFactoryBuilder(directed, strictMode) {
|
|
343
292
|
return (...args) => {
|
|
344
293
|
const G = directed ? this.Digraph : this.Graph;
|
|
@@ -361,24 +310,9 @@ function createModelFactories(strict, context = RootModelsContext) {
|
|
|
361
310
|
}
|
|
362
311
|
|
|
363
312
|
const noStrict = createModelFactories(false);
|
|
364
|
-
/**
|
|
365
|
-
* API for creating directional graph objects.
|
|
366
|
-
* @group Model Factory
|
|
367
|
-
*/
|
|
368
313
|
const digraph = noStrict.digraph;
|
|
369
|
-
/**
|
|
370
|
-
* API for creating omnidirectional graph objects.
|
|
371
|
-
* @group Model Factory
|
|
372
|
-
*/
|
|
373
314
|
const graph = noStrict.graph;
|
|
374
|
-
/**
|
|
375
|
-
* Provides a strict mode API.
|
|
376
|
-
* @group Model Factory
|
|
377
|
-
*/
|
|
378
315
|
const strict = createModelFactories(true);
|
|
379
|
-
/**
|
|
380
|
-
* @group Model Factory
|
|
381
|
-
*/
|
|
382
316
|
function withContext(models) {
|
|
383
317
|
const context = createModelsContext(models);
|
|
384
318
|
return Object.freeze({
|
|
@@ -387,15 +321,6 @@ function withContext(models) {
|
|
|
387
321
|
});
|
|
388
322
|
}
|
|
389
323
|
|
|
390
|
-
/**
|
|
391
|
-
* Convert Model to DOT string.
|
|
392
|
-
*
|
|
393
|
-
* @group Convert Model to DOT
|
|
394
|
-
*
|
|
395
|
-
* @param model Dot Object Model, like {@link Digraph}, {@link Graph}, {@link Subgraph}, {@link Node}, and {@link Edge}
|
|
396
|
-
* @param options
|
|
397
|
-
* @returns DOT string
|
|
398
|
-
*/
|
|
399
324
|
function toDot(model, options) {
|
|
400
325
|
const ast = fromModel(model, options?.convert);
|
|
401
326
|
return stringify(ast, options?.print);
|
package/lib/index.d.ts
CHANGED
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
type $keywords<T extends string> = {
|
|
5
|
+
[key in T]: key;
|
|
6
|
+
};
|
|
7
|
+
|
|
1
8
|
type F<A extends any[], O> = (...args: A) => O;
|
|
2
9
|
type IO<I, O> = F<[I], O>;
|
|
3
10
|
declare function pipe<I extends any[], O>(f0: F<I, O>): F<I, O>;
|
|
@@ -19,4 +26,4 @@ declare function pipe<I extends any[], T1, T2, T3, T4, O>(
|
|
|
19
26
|
declare const map: <T, O>(selector: (item: T) => O) => (src: Iterable<T>) => O[];
|
|
20
27
|
declare const filter: <T>(pred: (item: T) => boolean) => (src: Iterable<T>) => T[];
|
|
21
28
|
|
|
22
|
-
export { F, IO, filter, map, pipe };
|
|
29
|
+
export { $keywords, F, IO, filter, map, pipe };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-graphviz",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6-dev.29eb2444f",
|
|
4
4
|
"author": "kamiazya <yuki@kamiazya.tech>",
|
|
5
5
|
"description": "Graphviz library for TypeScript.",
|
|
6
6
|
"homepage": "https://ts-graphviz.github.io/ts-graphviz/",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"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",
|
|
87
87
|
"prebuild": "yarn build:peggy",
|
|
88
88
|
"build:deno": "mkdir -p lib/adapter/deno && cp -r src/adapter/deno/* lib/adapter/deno && sed -i \"s/index.ts/index.js/g\" lib/adapter/deno/mod.js && sed -i \"s/index.ts/index.d.ts/g\" lib/adapter/deno/mod.d.ts",
|
|
89
|
-
"build:node": "tsc -p tsconfig.build.json && rollup -c",
|
|
89
|
+
"build:node": "tsc -p tsconfig.build.json --declaration && tsc -p tsconfig.build.json --removeComments && rollup -c",
|
|
90
90
|
"build": "yarn build:node && yarn build:deno",
|
|
91
91
|
"postbuild": "prettier --write ./lib/**/*.{js,cjs,d.ts}",
|
|
92
92
|
"pretest": "yarn build:peggy",
|