|
1 | 1 | ---
|
2 |
| -description: How to extend ts-graphviz with custom classes. |
| 2 | +description: How to extend ts-graphviz for advanced use cases. |
3 | 3 | ---
|
4 | 4 | # Extending ts-graphviz
|
5 | 5 |
|
6 |
| -`ts-graphviz` is designed to be extensible, allowing advanced users to customize and enhance the library's functionality to meet specific needs. This section covers how to extend the type system and create custom implementations. |
| 6 | +`ts-graphviz` is designed to be extensible, allowing intermediate users to customize and enhance the library's functionality to meet specific needs. This section covers how to extend the type system and create custom implementations. |
7 | 7 |
|
8 | 8 | ## Creating Custom Classes
|
9 | 9 |
|
@@ -172,3 +172,49 @@ console.log(
|
172 | 172 | ),
|
173 | 173 | );
|
174 | 174 | ```
|
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | + |
| 179 | +## Internal Package Overview |
| 180 | + |
| 181 | +For users interested in extending or customizing `ts-graphviz`, understanding the internal packages can be valuable. Below is an overview of the internal packages and how they can be used in advanced scenarios. |
| 182 | + |
| 183 | + |
| 184 | +### `@ts-graphviz/adapter` |
| 185 | + |
| 186 | +**Purpose**: Provides interfaces to execute Graphviz commands and convert DOT language strings into various output formats. |
| 187 | + |
| 188 | +**Usage**: |
| 189 | + |
| 190 | +- Convert DOT strings to streams or files. |
| 191 | +- Use in environments where you need to render graphs to images or other formats. |
| 192 | + |
| 193 | +### `@ts-graphviz/ast` |
| 194 | + |
| 195 | +**Purpose**: Allows manipulation of the DOT language at the Abstract Syntax Tree (AST) level. |
| 196 | + |
| 197 | +**Usage**: |
| 198 | + |
| 199 | +- Parse DOT strings into AST nodes. |
| 200 | +- Manipulate and transform the AST programmatically. |
| 201 | +- Useful for advanced analysis or transformations of existing DOT code. |
| 202 | + |
| 203 | +### `@ts-graphviz/common` |
| 204 | + |
| 205 | +**Purpose**: Centralizes Graphviz domain knowledge, providing type definitions, constants, and utilities. It is designed to handle use cases such as extending types. |
| 206 | + |
| 207 | +**Usage**: |
| 208 | + |
| 209 | +- Extend or customize types and attributes. |
| 210 | +- Ensure type safety when working with custom attributes. |
| 211 | +- Aggregate domain knowledge of Graphviz for consistent usage across packages. |
| 212 | + |
| 213 | +### `@ts-graphviz/core` |
| 214 | + |
| 215 | +**Purpose**: Contains the core implementations of the models and functions provided to users. |
| 216 | + |
| 217 | +**Usage**: |
| 218 | + |
| 219 | +- Use object-oriented APIs for fine-grained control over graph elements. |
| 220 | +- Extend classes for custom behaviors or attributes. |
0 commit comments