@antv/layout 2.0.0-alpha.4 β†’ 2.0.0-beta.0

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.
Files changed (2) hide show
  1. package/README.md +85 -23
  2. package/package.json +5 -3
package/README.md CHANGED
@@ -1,43 +1,105 @@
1
- <h1 align="center">
2
- <b>@antv/layout</b>
3
- </h1>
1
+ <div align="center">
2
+
3
+ # AntV Layout
4
+
5
+ Basic layout algorithms for visualization
4
6
 
5
7
  [![Build Status](https://github.com/antvis/layout/actions/workflows/build.yml/badge.svg)](https://github.com/antvis/layout/actions)
6
- [![Coverage Status](https://img.shields.io/coveralls/github/antvis/layout/v5.svg)](https://coveralls.io/github/antvis/layout?branch=v5)
8
+ [![Coverage](https://codecov.io/gh/antvis/layout/branch/v5/graph/badge.svg)](https://app.codecov.io/gh/antvis/layout/tree/v5)
7
9
  [![npm Version](https://img.shields.io/npm/v/@antv/layout.svg)](https://www.npmjs.com/package/@antv/layout)
8
10
  [![npm Download](https://img.shields.io/npm/dm/@antv/layout.svg)](https://www.npmjs.com/package/@antv/layout)
9
11
  [![npm License](https://img.shields.io/npm/l/@antv/layout.svg)](https://www.npmjs.com/package/@antv/layout)
10
12
 
11
- This is a collection of basic layout algorithms. This repository publishes a single package:
13
+ <img src="https://mdn.alipayobjects.com/huamei_aphk1k/afts/img/A*oV6nR7oW4PMAAAAAgFAAAAgAegfkAQ/original" width="720" alt="AntV Layout Preview">
12
14
 
13
- - [@antv/layout](https://www.npmjs.com/package/@antv/layout) Implemented with TypeScript. [Online Demo](https://observablehq.com/d/2db6b0cc5e97d8d6)
15
+ </div>
14
16
 
15
- Online benchmarks: https://antv.vision/layout/index.html
17
+ **@antv/layout** is a collection of basic layout algorithms. It ships with a wide range of layouts, unifies graph data and layout APIs, and turns graph structures into renderable coordinates.
16
18
 
17
- ## Development
19
+ <div align="center">
20
+ <a href="https://layout.antv.vision/">
21
+ <img src="https://img.shields.io/badge/Website-2F54EB?style=for-the-badge" alt="Website" />
22
+ </a>
23
+ <a href="https://layout.antv.vision/guide/start/getting-started">
24
+ <img src="https://img.shields.io/badge/Docs-722ED1?style=for-the-badge" alt="Docs" />
25
+ </a>
26
+ <a href="https://layout.antv.vision/guide/api/api/introduction">
27
+ <img src="https://img.shields.io/badge/API%20Reference-13C2C2?style=for-the-badge" alt="API Reference" />
28
+ </a>
29
+ <!-- <a href="https://observablehq.com/d/2db6b0cc5e97d8d6">
30
+ <img src="https://img.shields.io/badge/Demo-FA8C16?style=for-the-badge" alt="Demo" />
31
+ </a> -->
32
+ <a href="https://layout.antv.vision/perf">
33
+ <img src="https://img.shields.io/badge/Benchmark-D46A6A?style=for-the-badge" alt="Benchmark" />
34
+ </a>
35
+ </div>
18
36
 
19
- We use [Vite](https://vitejs.dev/) to start a dev server:
37
+ ## ✨ Highlights
20
38
 
21
- ```bash
22
- $ npm install
23
- $ npm run dev
24
- ```
39
+ - **Coverage**: common graph layouts (force, dagre, radial, grid, combo)
40
+ - **Built for visualization**: real-world scenarios and workflows
41
+ - **Performance**: fast defaults + optional WebWorker offloading
42
+ - **Integration**: easy to plug into your rendering pipeline
43
+ - **TypeScript & docs**: typed APIs with complete documentation
25
44
 
26
- ## Test
45
+ ## 🧩 Layouts
27
46
 
28
- ```bash
29
- $ npm test
30
- ```
47
+ | Layout | Preview | Description |
48
+ | --- | --- | --- |
49
+ | <img alt="Force" src="https://img.shields.io/badge/Force-2F54EB?style=flat-square"> [ForceAtlas2](https://layout.antv.vision/guide/api/force/force-atlas2) | <img alt="ForceAtlas2" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*-HgiS6CyuuEAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Force-directed layout for large graphs with acceleration options (e.g. Barnes–Hut). |
50
+ | <img alt="Force" src="https://img.shields.io/badge/Force-2F54EB?style=flat-square"> [Force](https://layout.antv.vision/guide/api/force/force) | <img alt="Force" src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*Ce2WSIlo_fcAAAAAAAAAAABkARQnAQ" width="240" /> | Highly configurable force model for fine-grained tuning and process control. |
51
+ | <img alt="Force" src="https://img.shields.io/badge/Force-2F54EB?style=flat-square"> [Fruchterman](https://layout.antv.vision/guide/api/force/fruchterman) | <img alt="Fruchterman" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*1AvnTorIogUAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Classic force-directed layout for small/medium graphs with balanced distribution. |
52
+ | <img alt="Force" src="https://img.shields.io/badge/Force-2F54EB?style=flat-square"> [D3Force](https://layout.antv.vision/guide/api/force/d3-force) | <img alt="D3Force" src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*9VXcQLLyzHgAAAAAAAAAAABkARQnAQ" width="240" /> | d3-force style simulation wrapper for composing link/manyBody/collide forces. |
53
+ | <img alt="Force" src="https://img.shields.io/badge/Force-2F54EB?style=flat-square"> [D3Force3D](https://layout.antv.vision/guide/api/force/d3-force-3d) | <img alt="D3Force3D" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*4mbSTJLOXkgAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | 3D force layout based on d3-force-3d with z-axis forces and z output. |
54
+ | <img alt="Hierarchy" src="https://img.shields.io/badge/Hierarchy-722ED1?style=flat-square"> [Dagre](https://layout.antv.vision/guide/api/hierarchy/dagre) | <img alt="Dagre" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*v5mBSopYr_wAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Layered directed layout for DAGs, workflows, and dependency graphs. |
55
+ | <img alt="Hierarchy" src="https://img.shields.io/badge/Hierarchy-722ED1?style=flat-square"> [AntVDagre](https://layout.antv.vision/guide/api/hierarchy/antv-dagre) | <img alt="AntVDagre" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*gQGOTYlN6BMAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Production-oriented hierarchical layout with spacing, alignment, and path info. |
56
+ | <img alt="Radial" src="https://img.shields.io/badge/Radial-13C2C2?style=flat-square"> [Circular](https://layout.antv.vision/guide/api/radial/circular) | <img alt="Circular" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*qJi5Q4qg6W8AAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Place nodes on a circle (or spiral) with ordering, angle, and radius controls. |
57
+ | <img alt="Radial" src="https://img.shields.io/badge/Radial-13C2C2?style=flat-square"> [Concentric](https://layout.antv.vision/guide/api/radial/concentric) | <img alt="Concentric" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*KXunQKOLCSAAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Layer nodes by an importance score (default: degree), pulling higher scores inward. |
58
+ | <img alt="Radial" src="https://img.shields.io/badge/Radial-13C2C2?style=flat-square"> [Radial](https://layout.antv.vision/guide/api/radial/radial) | <img alt="Radial" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*vpXjTIFKy1QAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Focus-centered rings based on shortest-path distance for relationship exploration. |
59
+ | <img alt="Regular" src="https://img.shields.io/badge/Regular-52C41A?style=flat-square"> [Grid](https://layout.antv.vision/guide/api/regular/grid) | <img alt="Grid" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*8RYVTrENVCcAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Stable grid placement for predictable layouts like cards, lists, and matrices. |
60
+ | <img alt="Others" src="https://img.shields.io/badge/Others-8C8C8C?style=flat-square"> [MDS](https://layout.antv.vision/guide/api/others/mds) | <img alt="MDS" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*myM6T6R_d34AAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Multidimensional scaling to match ideal distances and produce a balanced global structure. |
61
+ | <img alt="Combo" src="https://img.shields.io/badge/Combo-FA8C16?style=flat-square"> [ComboCombined](https://layout.antv.vision/guide/api/combo/combo-combined) | <img alt="ComboCombined" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*zPAzSZ3XxpUAAAAAAAAAAAAADmJ7AQ/original" width="240" /> | Composite layout for combos/subgraphs with per-level strategies and consistent bounds/spacing. |
31
62
 
32
- ## Publish
63
+ ## πŸš€ Installation
33
64
 
34
65
  ```bash
35
- $ npm publish
66
+ npm install @antv/layout
36
67
  ```
37
68
 
38
- If you want to publish prerelease versions:
69
+ ## πŸ“ Quick Start
39
70
 
40
- ```bash
41
- $ npm version prerelease --preid alpha
42
- $ npm publish --tag alpha
71
+ ```ts
72
+ import { CircularLayout } from '@antv/layout';
73
+
74
+ const data = {
75
+ nodes: [{ id: 'node1' }, { id: 'node2' }, { id: 'node3' }],
76
+ edges: [
77
+ { source: 'node1', target: 'node2' },
78
+ { source: 'node2', target: 'node3' },
79
+ ],
80
+ };
81
+
82
+ async function run() {
83
+ const layout = new CircularLayout({ center: [200, 200], radius: 150 });
84
+
85
+ await layout.execute(data);
86
+
87
+ layout.forEachNode((node) => {
88
+ console.log(node.id, node.x, node.y);
89
+ });
90
+ }
91
+
92
+ run();
43
93
  ```
94
+
95
+ ## 🧡 Worker support
96
+
97
+ Set `enableWorker: true` to run layouts in a WebWorker when supported. See the docs for worker setup and layout configuration details.
98
+
99
+ ## 🀝 Contributing
100
+
101
+ Contributions are welcome. See `CONTRIBUTING.md` for guidelines and local workflows.
102
+
103
+ ## πŸ“„ License
104
+
105
+ MIT licensed. See `LICENSE` for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/layout",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "graph layout algorithm",
5
5
  "main": "dist/index.min.js",
6
6
  "module": "lib/index.js",
@@ -66,6 +66,7 @@
66
66
  "eslint-config-airbnb-base": "^14.2.1",
67
67
  "eslint-config-prettier": "^6.15.0",
68
68
  "eslint-plugin-import": "^2.29.1",
69
+ "gh-pages": "^6.3.0",
69
70
  "husky": "^7.0.4",
70
71
  "interactjs": "^1.10.27",
71
72
  "jest": "^30.2.0",
@@ -101,11 +102,12 @@
101
102
  "size": "limit-size",
102
103
  "test:coverage:open": "open-cli coverage/lcov-report/index.html",
103
104
  "test:coverage": "jest --coverage",
104
- "test": "jest"
105
+ "test": "jest",
106
+ "deploy": "npm --prefix site run build && gh-pages -d site/doc_build"
105
107
  },
106
108
  "publishConfig": {
107
109
  "access": "public",
108
- "tag": "alpha",
110
+ "tag": "beta",
109
111
  "registry": "https://registry.npmjs.org/"
110
112
  },
111
113
  "limit-size": [