ts-graphviz
Advanced tools
Comparing version 1.0.0 to 1.0.1
import { Compass, AttributeKey, ASTType, DotObjectType, DotObjectModel } from '#lib/common'; | ||
/** | ||
* @group AST | ||
*/ | ||
interface FilePosition { | ||
@@ -8,2 +11,5 @@ offset: number; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface FileRange { | ||
@@ -15,2 +21,3 @@ start: FilePosition; | ||
* AST common propaties. | ||
* @group AST | ||
*/ | ||
@@ -20,3 +27,9 @@ interface ASTCommonPropaties { | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
declare type DotASTPropaties = ASTCommonPropaties; | ||
/** | ||
* @group AST | ||
*/ | ||
interface GraphASTPropaties extends ASTCommonPropaties { | ||
@@ -27,2 +40,5 @@ id?: LiteralASTNode; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface LiteralASTPropaties<T extends string = string> extends ASTCommonPropaties { | ||
@@ -32,11 +48,23 @@ value: T; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface SubgraphASTPropaties extends ASTCommonPropaties { | ||
id?: LiteralASTNode; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface NodeASTPropaties extends ASTCommonPropaties { | ||
id: LiteralASTNode; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface EdgeASTPropaties extends ASTCommonPropaties { | ||
targets: [from: EdgeTargetASTNode, to: EdgeTargetASTNode, ...rest: EdgeTargetASTNode[]]; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface NodeRefASTPropaties extends ASTCommonPropaties { | ||
@@ -47,3 +75,9 @@ id: LiteralASTNode; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
declare type NodeRefGroupASTPropaties = ASTCommonPropaties; | ||
/** | ||
* @group AST | ||
*/ | ||
interface AttributeASTPropaties<T extends AttributeKey = AttributeKey> extends ASTCommonPropaties { | ||
@@ -53,6 +87,15 @@ key: LiteralASTNode<T>; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface AttributeListASTPropaties extends ASTCommonPropaties { | ||
kind: 'Graph' | 'Edge' | 'Node'; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
declare type CommentKind = 'Block' | 'Slash' | 'Macro'; | ||
/** | ||
* @group AST | ||
*/ | ||
interface CommentASTPropaties extends ASTCommonPropaties { | ||
@@ -64,2 +107,3 @@ kind: CommentKind; | ||
* AST node. | ||
* @group AST | ||
*/ | ||
@@ -73,8 +117,17 @@ interface ASTBaseNode { | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface ASTBaseParentNode<STMT extends ASTBaseNode = ASTBaseNode> extends ASTBaseNode { | ||
children: STMT[]; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface LiteralASTNode<T extends string = string> extends ASTBaseParentNode<never>, LiteralASTPropaties<T> { | ||
type: 'Literal'; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
interface DotASTNode extends ASTBaseParentNode<StatementASTNode>, DotASTPropaties { | ||
@@ -85,2 +138,3 @@ type: 'Dot'; | ||
* Graph AST object. | ||
* @group AST | ||
*/ | ||
@@ -92,2 +146,3 @@ interface GraphASTNode extends ASTBaseParentNode<ClusterStatementASTNode>, GraphASTPropaties { | ||
* Attribute AST object. | ||
* @group AST | ||
*/ | ||
@@ -101,2 +156,3 @@ interface AttributeASTNode<T extends AttributeKey = AttributeKey> | ||
* Comment AST object. | ||
* @group AST | ||
*/ | ||
@@ -106,28 +162,55 @@ interface CommentASTNode extends ASTBaseParentNode<never>, CommentASTPropaties { | ||
} | ||
/** Attributes AST object. */ | ||
/** | ||
* Attributes AST object. | ||
* @group AST | ||
*/ | ||
interface AttributeListASTNode extends ASTBaseParentNode<AttributeASTNode | CommentASTNode>, AttributeListASTPropaties { | ||
type: 'AttributeList'; | ||
} | ||
/** NodeRef AST object. */ | ||
/** | ||
* NodeRef AST object. | ||
* @group AST | ||
*/ | ||
interface NodeRefASTNode extends ASTBaseParentNode<never>, NodeRefASTPropaties { | ||
type: 'NodeRef'; | ||
} | ||
/** NodeRefGroup AST object. */ | ||
/** | ||
* NodeRefGroup AST object. | ||
* @group AST | ||
*/ | ||
interface NodeRefGroupASTNode extends ASTBaseParentNode<NodeRefASTNode>, NodeRefGroupASTPropaties { | ||
type: 'NodeRefGroup'; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
declare type EdgeTargetASTNode = NodeRefASTNode | NodeRefGroupASTNode; | ||
/** Edge AST object. */ | ||
/** | ||
* Edge AST object. | ||
* @group AST | ||
*/ | ||
interface EdgeASTNode extends ASTBaseParentNode<AttributeASTNode | CommentASTNode>, EdgeASTPropaties { | ||
type: 'Edge'; | ||
} | ||
/** Node AST object. */ | ||
/** | ||
* Node AST object. | ||
* @group AST | ||
*/ | ||
interface NodeASTNode extends ASTBaseParentNode<AttributeASTNode | CommentASTNode>, NodeASTPropaties { | ||
type: 'Node'; | ||
} | ||
/** Subgraph AST object. */ | ||
/** | ||
* Subgraph AST object. | ||
* @group AST | ||
*/ | ||
interface SubgraphASTNode extends ASTBaseParentNode<ClusterStatementASTNode>, SubgraphASTPropaties { | ||
type: 'Subgraph'; | ||
} | ||
/** | ||
* @group AST | ||
*/ | ||
declare type StatementASTNode = GraphASTNode | CommentASTNode; | ||
/** | ||
* @group AST | ||
*/ | ||
declare type ClusterStatementASTNode = | ||
@@ -140,2 +223,5 @@ | AttributeASTNode | ||
| CommentASTNode; | ||
/** | ||
* @group AST | ||
*/ | ||
declare type ASTNode = | ||
@@ -153,22 +239,18 @@ | LiteralASTNode | ||
| SubgraphASTNode; | ||
/** | ||
* @group AST | ||
*/ | ||
declare type ASTChildNode<T> = T extends ASTBaseParentNode<infer C> ? C : never; | ||
declare type ModelToAST<T> = T extends { | ||
$$type: infer U extends DotObjectType; | ||
} | ||
? U extends 'Graph' | ||
? GraphASTNode | DotASTNode | ||
: U extends 'AttributeList' | ||
? AttributeListASTNode | ||
: U extends 'Edge' | ||
? EdgeASTNode | ||
: U extends 'Node' | ||
? NodeASTNode | ||
: U extends 'Subgraph' | ||
? SubgraphASTNode | ||
: never | ||
: never; | ||
/** | ||
* @group Create AST | ||
* @alpha | ||
*/ | ||
interface BuilderOptions { | ||
locationFunction: () => FileRange; | ||
} | ||
/** | ||
* @group Create AST | ||
* @alpha | ||
*/ | ||
interface CreateElement { | ||
@@ -200,2 +282,6 @@ <T extends string>( | ||
} | ||
/** | ||
* @group Create AST | ||
* @alpha | ||
*/ | ||
interface ASTBuilder { | ||
@@ -205,4 +291,8 @@ createElement: CreateElement; | ||
/** | ||
* @group Create AST | ||
*/ | ||
declare class Builder implements ASTBuilder { | ||
private options?; | ||
/** @internal */ | ||
private getLocation; | ||
@@ -213,4 +303,19 @@ constructor(options?: Partial<BuilderOptions> | undefined); | ||
/** | ||
* @group Create AST | ||
*/ | ||
declare const createElement: CreateElement; | ||
/** | ||
* @group Convert AST to DOT | ||
*/ | ||
declare type IndentStyle = 'space' | 'tab'; | ||
/** | ||
* @group Convert AST to DOT | ||
*/ | ||
declare type EndOfLine = 'lf' | 'crlf'; | ||
/** | ||
* @group Convert AST to DOT | ||
* @alpha | ||
*/ | ||
interface PrintOptions { | ||
@@ -221,2 +326,6 @@ indentStyle?: IndentStyle; | ||
} | ||
/** | ||
* @group Convert AST to DOT | ||
* @alpha | ||
*/ | ||
interface PrintContext extends Required<PrintOptions> { | ||
@@ -226,2 +335,6 @@ directed: boolean; | ||
} | ||
/** | ||
* @group Convert AST to DOT | ||
* @alpha | ||
*/ | ||
interface PrintPlugin<T extends ASTNode = ASTNode> { | ||
@@ -232,2 +345,5 @@ match(ast: ASTNode): boolean; | ||
/** | ||
* @group Convert AST to DOT | ||
*/ | ||
declare class Printer { | ||
@@ -237,25 +353,5 @@ #private; | ||
constructor(options?: PrintOptions); | ||
use(plugin: PrintPlugin): this; | ||
print(ast: ASTNode): string; | ||
} | ||
interface ConvertOptions { | ||
commentKind?: CommentKind; | ||
} | ||
interface ConvertContext extends Required<ConvertOptions> { | ||
convert<T extends DotObjectModel>(model: T): ModelToAST<T>; | ||
} | ||
interface ConvertPlugin<T extends DotObjectModel> { | ||
match(model: T): boolean; | ||
convert(context: ConvertContext, model: T): ModelToAST<T>; | ||
} | ||
declare class Converter { | ||
#private; | ||
private options; | ||
constructor(options?: ConvertOptions); | ||
use(plugin: ConvertPlugin<DotObjectModel>): this; | ||
convert<T extends DotObjectModel>(model: T): ModelToAST<T>; | ||
} | ||
/** | ||
@@ -266,7 +362,6 @@ * Stringify Graphviz AST Node. | ||
* @returns DOT language string. | ||
* @group Convert AST to DOT | ||
*/ | ||
declare function stringify(ast: ASTNode, options?: PrintOptions): string; | ||
declare const createElement: CreateElement; | ||
interface IFilePosition { | ||
@@ -310,3 +405,3 @@ offset: number; | ||
| IOtherExpectation; | ||
declare class SyntaxError extends Error { | ||
declare class SyntaxError$1 extends Error { | ||
static buildMessage(expected: Expectation[], found: string | null): string; | ||
@@ -327,2 +422,5 @@ message: string; | ||
/** | ||
* @group Convert DOT to AST | ||
*/ | ||
declare type Rule = | ||
@@ -337,8 +435,18 @@ | 'Dot' | ||
| 'ClusterStatements'; | ||
/** | ||
* @group Convert DOT to AST | ||
*/ | ||
interface CommonParseOptions { | ||
filename?: string; | ||
} | ||
/** | ||
* @group Convert DOT to AST | ||
*/ | ||
interface ParseOptions<T extends Rule> extends CommonParseOptions { | ||
startRule?: T; | ||
} | ||
/** | ||
* @throws {@link SyntaxError} | ||
* @group Convert DOT to AST | ||
*/ | ||
declare function parse(input: string): DotASTNode; | ||
@@ -353,5 +461,63 @@ declare function parse(input: string, options?: ParseOptions<'Dot'>): DotASTNode; | ||
declare function parse(input: string, options?: ParseOptions<'ClusterStatements'>): ClusterStatementASTNode[]; | ||
/** | ||
* @group Convert DOT to AST | ||
*/ | ||
declare const SyntaxError: typeof SyntaxError$1; | ||
declare function fromModel<T extends DotObjectModel>(model: T, options?: ConvertOptions): ModelToAST<T>; | ||
/** | ||
* @group AST | ||
*/ | ||
declare type ModelToAST<T> = T extends { | ||
$$type: infer U extends DotObjectType; | ||
} | ||
? U extends 'Graph' | ||
? GraphASTNode | DotASTNode | ||
: U extends 'AttributeList' | ||
? AttributeListASTNode | ||
: U extends 'Edge' | ||
? EdgeASTNode | ||
: U extends 'Node' | ||
? NodeASTNode | ||
: U extends 'Subgraph' | ||
? SubgraphASTNode | ||
: never | ||
: never; | ||
/** | ||
* @group Convert Model to AST | ||
* @alpha | ||
*/ | ||
interface ConvertFromModelOptions { | ||
commentKind?: CommentKind; | ||
} | ||
/** | ||
* @group Convert Model to AST | ||
* @alpha | ||
*/ | ||
interface ConvertFromModelContext extends Required<ConvertFromModelOptions> { | ||
convert<T extends DotObjectModel>(model: T): ModelToAST<T>; | ||
} | ||
/** | ||
* @group Convert Model to AST | ||
* @alpha | ||
*/ | ||
interface ConvertFromModelPlugin<T extends DotObjectModel> { | ||
match(model: T): boolean; | ||
convert(context: ConvertFromModelContext, model: T): ModelToAST<T>; | ||
} | ||
/** | ||
* @group Convert Model to AST | ||
*/ | ||
declare class FromModelConverter { | ||
#private; | ||
private options; | ||
constructor(options?: ConvertFromModelOptions); | ||
convert<T extends DotObjectModel>(model: T): ModelToAST<T>; | ||
} | ||
/** | ||
* @group Convert Model to AST | ||
*/ | ||
declare function fromModel<T extends DotObjectModel>(model: T, options?: ConvertFromModelOptions): ModelToAST<T>; | ||
export { | ||
@@ -375,6 +541,5 @@ ASTBaseNode, | ||
CommonParseOptions, | ||
ConvertContext, | ||
ConvertOptions, | ||
ConvertPlugin, | ||
Converter, | ||
ConvertFromModelContext, | ||
ConvertFromModelOptions, | ||
ConvertFromModelPlugin, | ||
CreateElement, | ||
@@ -389,2 +554,3 @@ DotASTNode, | ||
FileRange, | ||
FromModelConverter, | ||
GraphASTNode, | ||
@@ -391,0 +557,0 @@ GraphASTPropaties, |
/** | ||
* Directive indicating which direction the Edge should point. | ||
* @group Attribute Types | ||
*/ | ||
@@ -9,2 +10,3 @@ declare type Compass = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw' | 'c' | '_'; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/addDouble/ addDouble} | ||
* @group Attribute Types | ||
*/ | ||
@@ -16,2 +18,3 @@ declare type AddDouble = `+${Double}`; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/double/ double} | ||
* @group Attribute Types | ||
*/ | ||
@@ -23,2 +26,3 @@ declare type Double = number; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/portPos/ portPos} | ||
* @group Attribute Types | ||
*/ | ||
@@ -30,2 +34,3 @@ declare type PortPos = `${string}:${Compass}` | Compass; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/doubleList/ doubleList} | ||
* @group Attribute Types | ||
*/ | ||
@@ -46,2 +51,3 @@ declare type DoubleList = | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/int/ int} | ||
* @group Attribute Types | ||
*/ | ||
@@ -51,2 +57,3 @@ declare type Int = number; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/shape/ shape} | ||
* @group Attribute Types | ||
*/ | ||
@@ -56,2 +63,3 @@ declare type Shape = string; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/smoothType/ smoothType} | ||
* @group Attribute Types | ||
*/ | ||
@@ -61,4 +69,6 @@ declare type SmoothType = 'none' | 'avg_dist' | 'graph_dist' | 'power_dist' | 'rng' | 'spring' | 'triangle'; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/splineType/ splineType} | ||
* @group Attribute Types | ||
*/ | ||
declare type SplineType = SplineType.spline | string; | ||
/** @hidden */ | ||
declare namespace SplineType { | ||
@@ -73,4 +83,6 @@ type prefix = endp | startp | `${endp}${startp}` | ''; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/startType/ startType} | ||
* @group Attribute Types | ||
*/ | ||
declare type StartType = `${StartType.style}${StartType.seed}`; | ||
/** @hidden */ | ||
declare namespace StartType { | ||
@@ -82,2 +94,3 @@ type style = 'regular' | 'self' | 'random'; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/style/ style} | ||
* @group Attribute Types | ||
*/ | ||
@@ -89,2 +102,3 @@ declare type Style = | ||
| `${Style.styleItem},${Style.styleItem},${Style.styleItem},${Style.styleItem}`; | ||
/** @hidden */ | ||
declare namespace Style { | ||
@@ -110,2 +124,3 @@ type styleItem = | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/viewPort/ viewPort} | ||
* @group Attribute Types | ||
*/ | ||
@@ -118,2 +133,3 @@ declare type ViewPort = `${Double},${Double},${Double},${Double},${Double}` | `${Double},${Double},${Double},${string}`; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/layerList/ layerList} | ||
* @group Attribute Types | ||
*/ | ||
@@ -125,2 +141,3 @@ declare type LayerList = string; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/layerRange/ layerRange} | ||
* @group Attribute Types | ||
*/ | ||
@@ -147,2 +164,3 @@ declare type LayerRange = string; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/escString/ escString} | ||
* @group Attribute Types | ||
*/ | ||
@@ -152,2 +170,3 @@ declare type EscString = string; | ||
* @see {@link https://graphviz.org/doc/info/shapes.html#html HTML-Like Labels} | ||
* @group Attribute Types | ||
*/ | ||
@@ -159,2 +178,3 @@ declare type HTMLLikeLabel = `<${string}>`; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/lblString/ lblString} | ||
* @group Attribute Types | ||
*/ | ||
@@ -168,4 +188,6 @@ declare type LblString = HTMLLikeLabel | EscString; | ||
* If dim=3, point may also have the format `"%f,%f,%f('!')?"` to represent the point (x,y,z). | ||
* @group Attribute Types | ||
*/ | ||
declare type Point = Point.position | `${Point.position}!`; | ||
/** @hidden */ | ||
declare namespace Point { | ||
@@ -186,2 +208,3 @@ type position = | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/addPoint/ addPoint} | ||
* @group Attribute Types | ||
*/ | ||
@@ -191,2 +214,3 @@ declare type AddPoint = `+${Point}`; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/pointList/ pointList} | ||
* @group Attribute Types | ||
*/ | ||
@@ -206,2 +230,3 @@ declare type PointList = | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/outputMode/ outputMode} | ||
* @group Attribute Types | ||
*/ | ||
@@ -211,2 +236,3 @@ declare type OutputMode = 'breadthfirst' | 'nodesfirst' | 'edgesfirst'; | ||
* @see {@link https://graphviz.org/docs/attr-types/packMode/ packMode} | ||
* @group Attribute Types | ||
*/ | ||
@@ -219,2 +245,3 @@ declare type PackMode = 'node' | 'clust' | 'graph' | `array${string}`; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/quadType/ quadType} | ||
* @group Attribute Types | ||
*/ | ||
@@ -229,2 +256,3 @@ declare type QuadType = 'normal' | 'fast' | 'none'; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/rankdir/ rankdir} | ||
* @group Attribute Types | ||
*/ | ||
@@ -234,2 +262,3 @@ declare type Rankdir = 'TB' | 'LR' | 'BT' | 'RL'; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/rankType/ rankType} | ||
* @group Attribute Types | ||
*/ | ||
@@ -244,2 +273,3 @@ declare type RankType = 'same' | 'min' | 'source' | 'max' | 'sink'; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/rect/ rect} | ||
* @group Attribute Types | ||
*/ | ||
@@ -254,4 +284,6 @@ declare type Rect = `${Double},${Double},${Double},${Double}`; | ||
* @see {@link https://graphviz.org/docs/attr-types/arrowType/ arrowType} | ||
* @group Attribute Types | ||
*/ | ||
declare type ArrowType = ArrowType.aname | `${ArrowType.aname}${ArrowType.aname}`; | ||
/** @hidden */ | ||
declare namespace ArrowType { | ||
@@ -265,2 +297,3 @@ type shape = 'box' | 'crow' | 'curve' | 'icurve' | 'diamond' | 'dot' | 'inv' | 'none' | 'normal' | 'tee' | 'vee'; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/clusterMode/ clusterMode} | ||
* @group Attribute Types | ||
*/ | ||
@@ -270,4 +303,6 @@ declare type ClusterMode = 'local' | 'global' | 'none'; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/color/ color} | ||
* @group Attribute Types | ||
*/ | ||
declare type Color = Color.RGB_RGBA | Color.HSV | Color.ColorName | number; | ||
/** @hidden */ | ||
declare namespace Color { | ||
@@ -1127,2 +1162,3 @@ /** | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/colorList/} | ||
* @group Attribute Types | ||
*/ | ||
@@ -1134,2 +1170,3 @@ declare type ColorList = string; | ||
* @see {@link https://graphviz.gitlab.io/docs/attr-types/dirType/ dirType} | ||
* @group Attribute Types | ||
*/ | ||
@@ -1141,4 +1178,6 @@ declare type DirType = 'forward' | 'back' | 'both' | 'none'; | ||
* @see {@link https://graphviz.org/docs/attr-types/pagedir/ pagedir} | ||
* @group Attribute Types | ||
*/ | ||
declare type Pagedir = `${Pagedir.TB}${Pagedir.RL}`; | ||
/** @hidden */ | ||
declare namespace Pagedir { | ||
@@ -1151,2 +1190,3 @@ type TB = 'T' | 'B'; | ||
* Attribute types available for edges. | ||
* @group Attribute | ||
*/ | ||
@@ -1222,2 +1262,3 @@ declare type EdgeAttributeKey = | ||
* Attribute types available for nodes. | ||
* @group Attribute | ||
*/ | ||
@@ -1276,2 +1317,3 @@ declare type NodeAttributeKey = | ||
* Attribute types available for graph. | ||
* @group Attribute | ||
*/ | ||
@@ -1380,2 +1422,3 @@ declare type GraphAttributeKey = | ||
* Attribute types available for subgraph. | ||
* @group Attribute | ||
*/ | ||
@@ -1385,2 +1428,3 @@ declare type SubgraphAttributeKey = 'rank'; | ||
* Attribute types available for cluster subgraph. | ||
* @group Attribute | ||
*/ | ||
@@ -1420,2 +1464,3 @@ declare type ClusterSubgraphAttributeKey = | ||
* Attribute types. | ||
* @group Attribute | ||
*/ | ||
@@ -1603,4 +1648,10 @@ declare type AttributeKey = | ||
} | ||
/** | ||
* @group Attribute | ||
*/ | ||
declare type Attribute<T extends AttributeKey> = KeyValueMapping[T]; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type ASTType = | ||
@@ -1620,27 +1671,83 @@ | 'Literal' | ||
* Objects that can be Edge destinations satisfy this interface. | ||
* @group Models | ||
*/ | ||
declare type NodeRef = NodeModel | ForwardRefNode; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type NodeRefGroup = NodeRef[]; | ||
/** | ||
* string or an object implementing IEdgeTarget. | ||
* string or an object implementing EdgeTarget. | ||
* @group Models | ||
*/ | ||
declare type NodeRefLike = NodeRef | string; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type NodeRefGroupLike = NodeRefLike[]; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type EdgeTarget = NodeRef | NodeRefGroup; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type EdgeTargetLike = NodeRefLike | NodeRefGroupLike; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type EdgeTargetTuple = [from: EdgeTarget, to: EdgeTarget, ...rest: EdgeTarget[]]; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type EdgeTargetLikeTuple = [from: EdgeTargetLike, to: EdgeTargetLike, ...rest: EdgeTargetLike[]]; | ||
/** | ||
* An objects of attribute key/value pairs. | ||
* @group Models | ||
*/ | ||
declare type AttributesObject<T extends AttributeKey> = { | ||
[K in T]?: Attribute<K>; | ||
}; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type AttributeValue = Attribute<AttributeKey>; | ||
/** | ||
* An array of attribute key/value tuple. | ||
* @group Models | ||
*/ | ||
declare type AttributesEntities<T extends AttributeKey> = readonly [T, Attribute<T>][]; | ||
/** | ||
* Attribute object that can be set to Edge. | ||
* @group Models | ||
*/ | ||
declare type EdgeAttributesObject = AttributesObject<EdgeAttributeKey>; | ||
/** | ||
* Attribute object that can be set to Node. | ||
* @group Models | ||
*/ | ||
declare type NodeAttributesObject = AttributesObject<NodeAttributeKey>; | ||
/** | ||
* Attribute object that can be set to Graph. | ||
* @group Models | ||
*/ | ||
declare type GraphAttributesObject = AttributesObject<GraphAttributeKey>; | ||
/** | ||
* Attribute object that can be set to Subgraph. | ||
* @group Models | ||
*/ | ||
declare type SubgraphAttributesObject = AttributesObject<ClusterSubgraphAttributeKey | SubgraphAttributeKey>; | ||
/** | ||
* @group Models | ||
*/ | ||
declare type DotObjectType = 'AttributeList' | 'Node' | 'Edge' | 'Subgraph' | 'Graph'; | ||
/** | ||
* @group Models | ||
*/ | ||
interface DotObjectModel<T extends DotObjectType = DotObjectType> { | ||
$$type: T; | ||
} | ||
/** | ||
* @group Models | ||
*/ | ||
interface HasComment { | ||
@@ -1650,19 +1757,61 @@ /** Comments to include when outputting with toDot. */ | ||
} | ||
/** | ||
* @group Models | ||
*/ | ||
interface HasAttributes<T extends AttributeKey> { | ||
readonly attributes: AttributesGroup<T>; | ||
} | ||
/** | ||
* @group Models | ||
*/ | ||
interface ForwardRefNode extends Partial<Port> { | ||
readonly id: string; | ||
} | ||
/** | ||
* DOT object with the property | ||
* that attributes can be held as a set of keys and values. | ||
* | ||
* @typeParam T - The attribute keys to set DOT object. | ||
* @group Models | ||
*/ | ||
interface Attributes<T extends AttributeKey> { | ||
/** Size of the set of keys and values held by the DOT object. */ | ||
readonly size: number; | ||
/** The key/value tuples of the object attributes. */ | ||
readonly values: ReadonlyArray<[T, Attribute<T>]>; | ||
/** | ||
* Get the value of an attribute by a DOT object by specifying its key. | ||
* | ||
* If the value corresponding to the key does not exist, undefined is returned. | ||
*/ | ||
get(key: T): Attribute<T> | undefined; | ||
/** Set a value, by specifying the key of the attributes in the DOT object. */ | ||
set(key: T, value: Attribute<T>): void; | ||
/** | ||
* Apply keys and values that can be specified for DOT objects collectively. | ||
* | ||
* @param attributes - An array of objects or tuples of attribute key/value pairs. | ||
*/ | ||
apply(attributes: AttributesObject<T> | AttributesEntities<T>): void; | ||
/** Delete the value of an attribute from a DOT object by specifying a key. */ | ||
delete(key: T): void; | ||
/** Delete all attributes specified for the DOT object. */ | ||
clear(): void; | ||
} | ||
/** | ||
* @group Models | ||
*/ | ||
interface AttributesGroup<T extends AttributeKey> extends Attributes<T>, HasComment {} | ||
/** | ||
* @group Models | ||
*/ | ||
declare type AttributeListKind = 'Graph' | 'Edge' | 'Node'; | ||
/** | ||
* A list object of attributes commonly specified for nodes, subgraphs, and edges | ||
* under graph and subgraph. | ||
* | ||
* @typeParam K - The type of object is being specified. | ||
* @typeParam T - The attribute keys to set DOT object. | ||
* @group Models | ||
*/ | ||
interface AttributeListModel<K extends AttributeListKind = AttributeListKind, T extends AttributeKey = AttributeKey> | ||
@@ -1674,2 +1823,6 @@ extends Attributes<T>, | ||
} | ||
/** | ||
* Port on an edge node. | ||
* @group Models | ||
*/ | ||
interface Port { | ||
@@ -1679,6 +1832,16 @@ port: string; | ||
} | ||
/** | ||
* Model that can be converted to Node in DOT language. | ||
* @group Models | ||
*/ | ||
interface NodeModel extends HasComment, HasAttributes<NodeAttributeKey>, DotObjectModel<'Node'> { | ||
/** ID of the node */ | ||
readonly id: string; | ||
/** Returns ForwardRefNode with port and compass specified. */ | ||
port(port: string | Partial<Port>): ForwardRefNode; | ||
} | ||
/** | ||
* Model that can be converted to Edge in DOT language. | ||
* @group Models | ||
*/ | ||
interface EdgeModel extends HasComment, HasAttributes<EdgeAttributeKey>, DotObjectModel<'Edge'> { | ||
@@ -1689,18 +1852,24 @@ readonly targets: EdgeTargetTuple; | ||
* Cluster common attribute interface. | ||
* | ||
* @hidden | ||
* @group Models | ||
*/ | ||
interface GraphCommonAttributes { | ||
/** Manage common attributes of graphs in a cluster. */ | ||
/** Manage common attributes of graphs in a graph. */ | ||
graph: AttributeListModel<'Graph', SubgraphAttributeKey | ClusterSubgraphAttributeKey>; | ||
/** Manage common attributes of edges in a cluster. */ | ||
/** Manage common attributes of edges in a graph. */ | ||
edge: AttributeListModel<'Edge', EdgeAttributeKey>; | ||
/** Manage common attributes of nodes in a cluster. */ | ||
/** Manage common attributes of nodes in a graph. */ | ||
node: AttributeListModel<'Node', NodeAttributeKey>; | ||
} | ||
/** | ||
* DOT model representing a graph/digraph/subgraph. | ||
* @group Models | ||
*/ | ||
interface GraphBaseModel<T extends AttributeKey = AttributeKey> extends HasComment, Attributes<T> { | ||
readonly id?: string; | ||
readonly attributes: Readonly<GraphCommonAttributes>; | ||
/** Node objects in the graph. */ | ||
readonly nodes: ReadonlyArray<NodeModel>; | ||
/** Edge objects in the graph. */ | ||
readonly edges: ReadonlyArray<EdgeModel>; | ||
/** Subgraph objects in the graph. */ | ||
readonly subgraphs: ReadonlyArray<SubgraphModel>; | ||
@@ -1749,2 +1918,5 @@ /** | ||
* Create a Subgraph and add it to the graph. | ||
* | ||
* @param id - Subgraph ID | ||
* @param attributes - Subgraph attribute object | ||
*/ | ||
@@ -2030,7 +2202,16 @@ createSubgraph(id?: string, attributes?: SubgraphAttributesObject): SubgraphModel; | ||
} | ||
/** | ||
* DOT model representing a subgraph. | ||
* @group Models | ||
*/ | ||
interface SubgraphModel | ||
extends GraphBaseModel<SubgraphAttributeKey | ClusterSubgraphAttributeKey>, | ||
DotObjectModel<'Subgraph'> { | ||
/** Determines whether the Subgraph is a SubgraphCluster. */ | ||
isSubgraphCluster(): boolean; | ||
} | ||
/** | ||
* DOT model representing a root graphs(digraph and graph). | ||
* @group Models | ||
*/ | ||
interface RootGraphModel extends GraphBaseModel<GraphAttributeKey>, DotObjectModel<'Graph'> { | ||
@@ -2049,9 +2230,17 @@ directed: boolean; | ||
} | ||
/** @hidden */ | ||
declare function isForwardRefNode(object: unknown): object is ForwardRefNode; | ||
/** @hidden */ | ||
declare function isNodeModel(object: unknown): object is NodeModel; | ||
/** @hidden */ | ||
declare function isNodeRef(node: unknown): node is NodeRef; | ||
/** @hidden */ | ||
declare function isNodeRefLike(node: unknown): node is NodeRefLike; | ||
/** @hidden */ | ||
declare function isNodeRefGroupLike(target: NodeRefLike | NodeRefGroupLike): target is NodeRefGroupLike; | ||
/** @hidden */ | ||
declare function isCompass(c: string): c is Compass; | ||
/** @hidden */ | ||
declare function toNodeRef(target: NodeRefLike): NodeRef; | ||
/** @hidden */ | ||
declare function toNodeRefGroup(targets: NodeRefGroupLike): NodeRefGroup; | ||
@@ -2058,0 +2247,0 @@ |
@@ -0,19 +1,26 @@ | ||
/** @hidden */ | ||
function isForwardRefNode(object) { | ||
return typeof object === 'object' && object !== null && typeof object.id === 'string'; | ||
} | ||
/** @hidden */ | ||
function isNodeModel(object) { | ||
return typeof object === 'object' && object !== null && object.$$type === 'Node' && typeof object.id === 'string'; | ||
} | ||
/** @hidden */ | ||
function isNodeRef(node) { | ||
return isNodeModel(node) || isForwardRefNode(node); | ||
} | ||
/** @hidden */ | ||
function isNodeRefLike(node) { | ||
return typeof node === 'string' || isNodeRef(node); | ||
} | ||
/** @hidden */ | ||
function isNodeRefGroupLike(target) { | ||
return Array.isArray(target) && target.every(isNodeRefLike); | ||
} | ||
/** @hidden */ | ||
function isCompass(c) { | ||
return ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'c'].includes(c); | ||
} | ||
/** @hidden */ | ||
function toNodeRef(target) { | ||
@@ -29,2 +36,3 @@ if (isNodeRef(target)) { | ||
} | ||
/** @hidden */ | ||
function toNodeRefGroup(targets) { | ||
@@ -31,0 +39,0 @@ if (targets.length < 2 && (isNodeRefLike(targets[0]) && isNodeRefLike(targets[1])) === false) { |
import { isNodeRefGroupLike, toNodeRefGroup, toNodeRef, isNodeRefLike } from '#lib/common'; | ||
import { fromModel, stringify } from '#lib/ast'; | ||
/** | ||
* @group Attribute | ||
*/ | ||
const attribute = new Proxy(Object.freeze({}), { | ||
@@ -9,11 +12,10 @@ get: (_, key) => key, | ||
/** | ||
* Classes implemented in the 'ts-graphviz' library are designed to inherit from this class. | ||
* Base class for DOT objects. | ||
* @group Models | ||
*/ | ||
class GraphvizObject {} | ||
class DotObject {} | ||
/** | ||
* Classes implemented in the 'ts-graphviz' library that implement the `toDot` method are designed to inherit from this class. | ||
* Base class for DOT objects with attributes. | ||
* @group Models | ||
*/ | ||
class DotObject extends GraphvizObject {} | ||
/** | ||
*/ | ||
class AttributesBase extends DotObject { | ||
@@ -31,11 +33,8 @@ /** @hidden */ | ||
} | ||
/** The size of the attribute. */ | ||
get size() { | ||
return this.#attrs.size; | ||
} | ||
/** The size of the attribute. */ | ||
get(key) { | ||
return this.#attrs.get(key); | ||
} | ||
/** Set a value to the attribute. */ | ||
set(key, value) { | ||
@@ -61,5 +60,5 @@ if (value !== null && value !== undefined) { | ||
* A set of attribute values for any object. | ||
* @group Models | ||
*/ | ||
class AttributesGroupModel extends AttributesBase { | ||
/** Comments to include when outputting with toDot. */ | ||
comment; | ||
@@ -69,2 +68,3 @@ } | ||
* A set of attribute values for any object. | ||
* @group Models | ||
*/ | ||
@@ -76,3 +76,2 @@ class AttributeList extends AttributesBase { | ||
} | ||
/** Comments to include when outputting with toDot. */ | ||
comment; | ||
@@ -85,31 +84,18 @@ constructor($$kind, attributes) { | ||
/** | ||
* Base class for clusters. | ||
* @hidden | ||
* Base class for Graph objects. | ||
* @group Models | ||
*/ | ||
class GraphBase extends AttributesBase { | ||
/** Cluster ID */ | ||
id; | ||
/** Comments to include when outputting with toDot. */ | ||
comment; | ||
/** | ||
* Nodes in the cluster. | ||
* @hidden | ||
*/ | ||
get nodes() { | ||
return Array.from(this.#objects.nodes.values()); | ||
} | ||
/** | ||
* Edges in the cluster. | ||
* @hidden | ||
*/ | ||
get edges() { | ||
return Array.from(this.#objects.edges.values()); | ||
} | ||
/** | ||
* Subgraphs in the cluster. | ||
* @hidden | ||
*/ | ||
get subgraphs() { | ||
return Array.from(this.#objects.subgraphs.values()); | ||
} | ||
/** @hidden */ | ||
#objects = { | ||
@@ -120,35 +106,17 @@ nodes: new Map(), | ||
}; | ||
/** | ||
* Add a Node to the cluster. | ||
*/ | ||
addNode(node) { | ||
this.#objects.nodes.set(node.id, node); | ||
} | ||
/** | ||
* Add Edge to the cluster. | ||
*/ | ||
addEdge(edge) { | ||
this.#objects.edges.add(edge); | ||
} | ||
/** | ||
* Add a Subgraph to the cluster. | ||
*/ | ||
addSubgraph(subgraph) { | ||
this.#objects.subgraphs.add(subgraph); | ||
} | ||
/** | ||
* Check if the Node exists in the cluster. | ||
*/ | ||
existNode(nodeId) { | ||
return this.#objects.nodes.has(nodeId); | ||
} | ||
/** | ||
* Check if the Edge exists in the cluster. | ||
*/ | ||
existEdge(edge) { | ||
return this.#objects.edges.has(edge); | ||
} | ||
/** | ||
* Check if the Subgraph exists in the cluster. | ||
*/ | ||
existSubgraph(subgraph) { | ||
@@ -164,23 +132,11 @@ return this.#objects.subgraphs.has(subgraph); | ||
} | ||
/** | ||
* Remove Node from the cluster. | ||
*/ | ||
removeNode(node) { | ||
this.#objects.nodes.delete(typeof node === 'string' ? node : node.id); | ||
} | ||
/** | ||
* Remove Edge from the cluster. | ||
*/ | ||
removeEdge(edge) { | ||
this.#objects.edges.delete(edge); | ||
} | ||
/** | ||
* Remove Subgraph from the cluster. | ||
*/ | ||
removeSubgraph(subgraph) { | ||
this.#objects.subgraphs.delete(subgraph); | ||
} | ||
/** | ||
* Create a Node in the cluster. | ||
*/ | ||
createNode(id, attributes) { | ||
@@ -191,20 +147,8 @@ const node = new Node(id, attributes); | ||
} | ||
/** | ||
* Get Subgraph in cluster by specifying id. | ||
* | ||
* If there is no Subgraph with the specified id in the cluster, return undefined. | ||
*/ | ||
getSubgraph(id) { | ||
return Array.from(this.#objects.subgraphs.values()).find((subgraph) => subgraph.id === id); | ||
} | ||
/**EdgeAttributesObject | ||
* Get Node in cluster by specifying id. | ||
* | ||
* @description | ||
* If there is no Node with the specified id in the cluster, return undefined. | ||
*/ | ||
getNode(id) { | ||
return this.#objects.nodes.get(id); | ||
} | ||
/** Create Edge and add it to the cluster. */ | ||
createEdge(targets, attributes) { | ||
@@ -262,23 +206,2 @@ const ts = targets.map((t) => (isNodeRefGroupLike(t) ? toNodeRefGroup(t) : toNodeRef(t))); | ||
} | ||
/** | ||
* Set a common attribute for the clusters in the cluster. | ||
* | ||
* ```ts | ||
* const G = digraph('G', (g) => { | ||
* g.graph({ | ||
* [attribute.color]: 'red', | ||
* [attribute.label]: 'my label', | ||
* }); | ||
* }); | ||
* | ||
* console.log(toDot(G)); | ||
* // digraph "G" { | ||
* // graph [ | ||
* // color = "red", | ||
* // label = "my label", | ||
* // ]; | ||
* // } | ||
* ``` | ||
* @param attributes Object of attributes to be adapted to the clusters. | ||
*/ | ||
graph(attributes) { | ||
@@ -289,3 +212,4 @@ this.attributes.graph.apply(attributes); | ||
/** | ||
* Subgraph object. | ||
* DOT object class representing a subgraph. | ||
* @group Models | ||
*/ | ||
@@ -310,3 +234,2 @@ class Subgraph extends GraphBase { | ||
} | ||
/** Determines whether the Subgraph is a SubgraphCluster. */ | ||
isSubgraphCluster() { | ||
@@ -320,3 +243,4 @@ if (typeof this.id === 'string') { | ||
/** | ||
* Node object. | ||
* DOT object class representing a node. | ||
* @group Models | ||
*/ | ||
@@ -328,3 +252,2 @@ class Node extends DotObject { | ||
} | ||
/** Comments to include when outputting with toDot. */ | ||
comment; | ||
@@ -337,3 +260,2 @@ attributes; | ||
} | ||
/** Returns ForwardRefNode with port and compass specified. */ | ||
port(port) { | ||
@@ -347,2 +269,4 @@ if (typeof port === 'string') { | ||
/** | ||
* DOT object class representing a edge. | ||
* @group Models | ||
*/ | ||
@@ -354,3 +278,2 @@ class Edge extends DotObject { | ||
} | ||
/** Comments to include when outputting with toDot. */ | ||
comment; | ||
@@ -368,4 +291,4 @@ attributes; | ||
/** | ||
* Base class for RootGraph. | ||
* | ||
* Base class representing a root graph(digraph, graph). | ||
* @group Models | ||
*/ | ||
@@ -377,11 +300,2 @@ class RootGraph extends GraphBase { | ||
id; | ||
/** | ||
* Strict mode. | ||
* | ||
* @description | ||
* A graph may also be described as strict. | ||
* This forbids the creation of multi-edges, i.e., there can be at most one edge with a given tail node and head node in the directed case. | ||
* For undirected graphs, there can be at most one edge connected to the same two nodes. | ||
* Subsequent edge statements using the same two nodes will identify the edge with the previously defined one and apply any attributes given in the edge statement. | ||
*/ | ||
strict; | ||
@@ -403,2 +317,6 @@ attributes = Object.freeze({ | ||
} | ||
/** | ||
* DOT object class representing a graph. | ||
* @group Models | ||
*/ | ||
class Graph extends RootGraph { | ||
@@ -409,2 +327,6 @@ get directed() { | ||
} | ||
/** | ||
* DOT object class representing a digraph. | ||
* @group Models | ||
*/ | ||
class Digraph extends RootGraph { | ||
@@ -430,14 +352,38 @@ get directed() { | ||
} | ||
/** API for creating directional graph objects. */ | ||
/** | ||
* API for creating directional graph objects. | ||
* @group Model Builder | ||
*/ | ||
const digraph = builder(true, false); | ||
/** API for creating omnidirectional graph objects. */ | ||
/** | ||
* API for creating omnidirectional graph objects. | ||
* @group Model Builder | ||
*/ | ||
const graph = builder(false, false); | ||
/** Provides a strict mode API. */ | ||
/** | ||
* Provides a strict mode API. | ||
* @group Model Builder | ||
*/ | ||
const strict = Object.freeze({ | ||
/** API for creating directional graph objects in strict mode. */ | ||
/** | ||
* API for creating directional graph objects in strict mode. | ||
* @group Model Builder | ||
*/ | ||
digraph: builder(true, true), | ||
/** API for creating omnidirectional graph objects in strict mode. */ | ||
/** | ||
* API for creating omnidirectional graph objects in strict mode. | ||
* @group Model Builder | ||
*/ | ||
graph: builder(false, true), | ||
}); | ||
/** | ||
* Convert Model to DOT string. | ||
* | ||
* @group Convert Model to DOT | ||
* | ||
* @param model Dot Object Model, like {@link Digraph}, {@link Graph}, {@link Node}, and {@link Edge} | ||
* @param options | ||
* @returns DOT string | ||
*/ | ||
function toDot(model, options) { | ||
@@ -457,3 +403,2 @@ const ast = fromModel(model, options?.convert); | ||
GraphBase, | ||
GraphvizObject, | ||
Node, | ||
@@ -460,0 +405,0 @@ RootGraph, |
{ | ||
"name": "ts-graphviz", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "kamiazya <yuki@kamiazya.tech>", | ||
@@ -50,3 +50,3 @@ "description": "Graphviz library for TypeScript.", | ||
"scripts": { | ||
"build:peggy": "peggy --plugin ts-pegjs --extra-options-file src/ast/parser/peggy.options.json -o src/ast/parser/index.ts src/ast/parser/dot.peggy", | ||
"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", | ||
"prebuild": "yarn build:peggy", | ||
@@ -84,5 +84,5 @@ "build": "tsc -p tsconfig.build.json && rollup -c", | ||
"ts-pegjs": "^2.1.0", | ||
"typedoc": "^0.22.4", | ||
"typedoc": "^0.23.15", | ||
"typescript": "^4.7.4" | ||
} | ||
} |
[![GitHub Action](https://github.com/kamiazya/ts-graphviz/workflows/NodeCI/badge.svg)](https://github.com/kamiazya/ts-graphviz/actions?workflow=NodeCI) | ||
[![npm version](https://badge.fury.io/js/ts-graphviz.svg)](https://badge.fury.io/js/ts-graphviz) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) | ||
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com) | ||
![npm](https://img.shields.io/npm/dm/ts-graphviz) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg)](#contributors) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
[![code style: prettier](https://img.shields.io/badge/code%20style-prettier-ff69b4?logo=prettier&style=flat)](https://github.com/facebook/jest) | ||
[![test: jest](https://img.shields.io/badge/tested%20with-jest-99424f?logo=jest&style=flat)](https://github.com/facebook/jest) | ||
![node version](https://img.shields.io/node/v/ts-graphviz) | ||
![npm](https://img.shields.io/npm/dm/ts-graphviz) | ||
[![All Contributors](https://img.shields.io/github/all-contributors/ts-graphviz/ts-graphviz?color=orange)](#contributors) | ||
[English](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.md) | [日本語](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.ja.md) | ||
# ts-graphviz | ||
@@ -16,4 +15,10 @@ | ||
> [GitHub](https://github.com/ts-graphviz/ts-graphviz) | [npm](https://www.npmjs.com/package/ts-graphviz)([yarn](https://github.com/ts-graphviz/ts-graphviz)) | [document](https://ts-graphviz.github.io/ts-graphviz/) | ||
[![GitHub](https://img.shields.io/badge/-GitHub-181717?logo=GitHub&style=flat)](https://github.com/ts-graphviz/ts-graphviz) | ||
[![npm](https://img.shields.io/badge/-npm-CB3837?logo=npm&style=flat)](https://www.npmjs.com/package/ts-graphviz) | ||
[![yarn](https://img.shields.io/badge/-yarn-ffffff?logo=Yarn&style=flat)](https://github.com/ts-graphviz/ts-graphviz) | ||
[![Refarence](https://img.shields.io/badge/-Refarence-3178C6?logo=TypeScript&style=flat&logoColor=fff)](https://ts-graphviz.github.io/ts-graphviz/) | ||
[![Suponser](https://img.shields.io/badge/-Suponser-fff?logo=GitHub%20Sponsors&style=flat)](https://github.com/sponsors/kamiazya) | ||
> [English](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.md) | [日本語](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.ja.md) | ||
## 主な機能 ✨ | ||
@@ -220,2 +225,4 @@ | ||
> このパッケージのステータスは ![beta](https://img.shields.io/badge/-beta-orange) です。 | ||
高度な利用のためにASTを扱うためのAPIを提供しています。 | ||
@@ -222,0 +229,0 @@ |
[![GitHub Action](https://github.com/kamiazya/ts-graphviz/workflows/NodeCI/badge.svg)](https://github.com/kamiazya/ts-graphviz/actions?workflow=NodeCI) | ||
[![npm version](https://badge.fury.io/js/ts-graphviz.svg)](https://badge.fury.io/js/ts-graphviz) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) | ||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) | ||
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com) | ||
![npm](https://img.shields.io/npm/dm/ts-graphviz) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg)](#contributors) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
[![code style: prettier](https://img.shields.io/badge/code%20style-prettier-ff69b4?logo=prettier&style=flat)](https://github.com/facebook/jest) | ||
[![test: jest](https://img.shields.io/badge/tested%20with-jest-99424f?logo=jest&style=flat)](https://github.com/facebook/jest) | ||
![node version](https://img.shields.io/node/v/ts-graphviz) | ||
![npm](https://img.shields.io/npm/dm/ts-graphviz) | ||
[![All Contributors](https://img.shields.io/github/all-contributors/ts-graphviz/ts-graphviz?color=orange)](#contributors) | ||
> [English](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.md) | [日本語](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.ja.md) | ||
# ts-graphviz | ||
@@ -16,4 +15,10 @@ | ||
> [GitHub](https://github.com/ts-graphviz/ts-graphviz) | [npm](https://www.npmjs.com/package/ts-graphviz)([yarn](https://github.com/ts-graphviz/ts-graphviz)) | [document](https://ts-graphviz.github.io/ts-graphviz/) | ||
[![GitHub](https://img.shields.io/badge/-GitHub-181717?logo=GitHub&style=flat)](https://github.com/ts-graphviz/ts-graphviz) | ||
[![npm](https://img.shields.io/badge/-npm-CB3837?logo=npm&style=flat)](https://www.npmjs.com/package/ts-graphviz) | ||
[![yarn](https://img.shields.io/badge/-yarn-ffffff?logo=Yarn&style=flat)](https://github.com/ts-graphviz/ts-graphviz) | ||
[![Refarence](https://img.shields.io/badge/-Refarence-3178C6?logo=TypeScript&style=flat&logoColor=fff)](https://ts-graphviz.github.io/ts-graphviz/) | ||
[![Suponser](https://img.shields.io/badge/-Suponser-fff?logo=GitHub%20Sponsors&style=flat)](https://github.com/sponsors/kamiazya) | ||
> [English](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.md) | [日本語](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.ja.md) | ||
## Key Features ✨ | ||
@@ -220,2 +225,4 @@ | ||
> This module status is ![beta](https://img.shields.io/badge/-beta-orange). | ||
An API is provided to handle ASTs for advanced use. | ||
@@ -222,0 +229,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17678
394
537813