Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: export g6 getExtension, getExtensions and register from ssr #6661

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确保从@antv/g6导出的getExtensiongetExtensionsregister函数在SSR环境中正常工作。建议在合并前进行相关测试。

export { createCanvas } from './canvas';
export { createGraph } from './graph';
export type { Graph, MetaData, Options } from './types';
Loading