Skip to content

Commit

Permalink
chore: export g6 getExtension, getExtensions and register from ssr (#…
Browse files Browse the repository at this point in the history
…6661)

* chore: export g6 getExtension, getExtensions and register from ssr

* chore: update version

* docs: update readme
  • Loading branch information
Aarebecca authored Dec 23, 2024
1 parent 29757b6 commit 2c2950b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions packages/g6-ssr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,31 @@ When render in CLI, you can pass `-t` or `--type` option to export SVG or PDF.
npx g6-ssr export -i [graph-options].json -o ./file -t pdf
```

### Register Custom G6 Extensions

If you need to register custom extensions of G6, please use the `registry` function exported from `@antv/g6-ssr`.

```js
import { createGraph, registry } from '@antv/g6-ssr';
import { BaseNode, ExtensionCategory } from '@antv/g6';

class CustomNode extends BaseNode {
// custom node
}

registry(ExtensionCategory.Node, 'custom-node', CustomNode);

const graph = await createGraph({
width: 500,
height: 500,
node: {
type: 'custom-node',
// other options
},
// other options
});
```

## License

MIT
2 changes: 1 addition & 1 deletion packages/g6-ssr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6-ssr",
"version": "0.0.7",
"version": "0.0.8",
"description": "Support SSR for G6",
"keywords": [
"antv",
Expand Down
1 change: 1 addition & 0 deletions packages/g6-ssr/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { getExtension, getExtensions, register } from '@antv/g6';
export { createCanvas } from './canvas';
export { createGraph } from './graph';
export type { Graph, MetaData, Options } from './types';

0 comments on commit 2c2950b

Please sign in to comment.